Hello there,
i’m trying to include a yml file as a pre-task in my playbook. The problem is i can’t pass custom parameters to it.
Here is my code:
pre_tasks:
- { include: includes/notifications-start.yml, msg: my-msg }
my-message
is a simple string, not a variable and also msg
is not used in any other place.
Here is the error i see when i run the playbook:
$ ansible-playbook -i hosts/staginghosts web_deploy.yml
ERROR! 'msg' is not a valid attribute for a Task
The error appears to have been in '/path/to/my/repo/ansible/web_deploy.yml': line 9, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
pre_tasks:
- { include: includes/notifications-start.yml, msg: my-task-name }
^ here
It appears that i can’t add any custom variable name there.
Ansible version:
$ ansible --version
ansible 2.0.0 (devel e8452c864e) last updated 2015/08/06 17:23:42 (GMT +200)
lib/ansible/modules/core: (detached HEAD 016b4ede2e) last updated 2015/08/06 17:23:45 (GMT +200)
lib/ansible/modules/extras: (detached HEAD 210ee3febc) last updated 2015/08/06 17:23:45 (GMT +200)
v1/ansible/modules/core: (detached HEAD f8d8af17cd) last updated 2015/08/06 17:24:03 (GMT +200)
v1/ansible/modules/extras: (detached HEAD 495ad450e5) last updated 2015/08/06 17:24:21 (GMT +200)
config file =
configured module search path = None
Thanks