Skip to content

Executing playbook encountered an error #9

@z3473

Description

@z3473

ansible-playbook --syntax-check create-user.yml -e "hosts=test user_name=test"
ERROR! The field 'hosts' has an invalid value, which includes an undefined variable. The error was: 'inventory' is undefined

The error appears to be in '/etc/ansible/create-user.yml': line 5, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  • hosts: '{{inventory}}'
    ^ here
    We could be wrong, but this one looks like it might be an issue with
    missing quotes. Always quote template expression brackets when they
    start a value. For instance:

    with_items:
    - {{ foo }}

Should be written as:

with_items:
  - "{{ foo }}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions