geerlingguy/ansible-role-awx

yaml.scanner.ScannerError: mapping values are not allowed here

agardnerIT opened this issue · 5 comments

AWX role fails with this error:

Configuration error - yaml.scanner.ScannerError: mapping values are not allowed here\\n  in \\\"/tmp/awxcompose/docker-compose.yml

Playbook:

---
- name: Install AWX
  hosts: awx
  become: yes

  vars:
    ansible_distribution_major_version: 6

  pre_tasks:

  - name: Install Python Pip
    package:
      name: python-pip
      state: present

  - name: Install Docker
    command: pip install docker

  - name: Install Docker Compose
    command: pip install docker-compose

  roles:

  - role: geerlingguy.repo-epel
  - role: geerlingguy.git
  - role: geerlingguy.ansible
  - role: geerlingguy.nodejs
  - role: geerlingguy.awx

I got this, too. It seems that some lines are wrongly indented. Thx to significant whitespaces in YAML this leads to an error while tokenizing.
The errors are in line 10, 11, 20, 32, 33 and 40.

version: '2'
services:

  web:
    image: ansible/awx_web:4.0.0
    container_name: awx_web
    depends_on:
      - rabbitmq
      - memcached
            - postgres
          ports:
      - "80:8052"
    hostname: awxweb
    user: root
    restart: unless-stopped
    volumes:
      - "/var/awx/compose/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/awx/compose/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/awx/compose/credentials.py:/etc/tower/conf.d/credentials.py"
                    environment:
      http_proxy:
      https_proxy:
      no_proxy:

  task:
    image: ansible/awx_task:4.0.0
    container_name: awx_task
    depends_on:
      - rabbitmq
      - memcached
      - web
            - postgres
          hostname: awx
    user: root
    restart: unless-stopped
    volumes:
      - "/var/awx/compose/SECRET_KEY:/etc/tower/SECRET_KEY"
      - "/var/awx/compose/environment.sh:/etc/tower/conf.d/environment.sh"
      - "/var/awx/compose/credentials.py:/etc/tower/conf.d/credentials.py"
                    environment:
      http_proxy:
      https_proxy:
      no_proxy:

  rabbitmq:
    image: ansible/awx_rabbitmq:3.7.4
    container_name: awx_rabbitmq
    restart: unless-stopped
    environment:
      RABBITMQ_DEFAULT_VHOST: "awx"
      RABBITMQ_DEFAULT_USER: "<REMOVED>"
      RABBITMQ_DEFAULT_PASS: "<REMOVED>"
      RABBITMQ_ERLANG_COOKIE: cookiemonster

  memcached:
    image: memcached:alpine
    container_name: awx_memcached
    restart: unless-stopped

    postgres:
    image: postgres:9.6
    container_name: awx_postgres
    restart: unless-stopped
    volumes:
      - /var/awx/postgres:/var/lib/postgresql/data:Z
    environment:
      POSTGRES_USER: <REMOVED>
      POSTGRES_PASSWORD: <REMOVED>
      POSTGRES_DB: awx
      PGDATA: /var/lib/postgresql/data/pgdata

As - postgres is the value of the key depends_on it should be on the same level as - memcached. Thus the intendation of your next key ports is wrong too. Again, it should be on the same level as depends_on. The same applies for -postgres, hostname: awx and environment: .

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

ERROR: yaml.scanner.ScannerError: mapping values are not allowed here
in "./docker-compose.yml", line 4, column 9
Show me this error I create space between version: '3' it's first mistake

my code look like this

version: "3"


services:
  app:
    build:
      context: .
    ports:
      - "8000:8000"
    volumes:
      - ./app:/app
    command: >
      sh -c "python manage.py runserver 0.0.0.0:8000"

when i write
docker-compose build
then show me one error more if any one show same read more my comment

ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

Then I fix this by adding just sudo then work fine
sudo docker-compose build