I try to set default value for hosts field in playbook with Jinja2 filter,
but it doesn't work:
---
> - hosts: "{{ host | default(localhost) }}"
> tasks:
> - name: show OS version info
> debug: msg="{{ansible_distribution}} {{ansible_distribution_version}}"
# ansible-playbook -i hosts dist.yml
PLAY [{{host | default(localhost)}}]
******************************************
skipping: no hosts matched
But when I execute it with command line parameter, it works ok:
# ansible-playbook -i hosts dist.yml --extra-vars 'host=localhost'
PLAY [localhost]
**************************************************************
...
???
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.