Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Want to reacht this vars:
- ok: [localhost] => (item=app) => {
- "app": [
- {
- "name": "bla",
- "version": 1
- }
- ],
- "item": "app"
- }
- ok: [localhost] => (item=app_bla) => {
- "app_bla": [
- {
- "name": "blub",
- "version": 1
- }
- ],
- "item": "app_bla"
- }
- They are in a vars file:
- [root@websrv01 ansible]# cat version
- app:
- - name: bla
- version: 1
- app_bla:
- - name: blub
- version: 1
- now i got this inventory file:
- [root@websrv01 ansible]# cat hosts
- [app]
- localhost
- [app_bla]
- localhost
- and trying to install packages on all hosts that are member of the group with this play:
- - debug: msg="going to install {{item.0.name}}-{{item}} on {{inventory_hostname}}"
- with_items: group_names
- Output:
- TASK [debug] *******************************************************************
- [DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{group_names}}').
- This feature will be
- removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
- fatal: [localhost]: FAILED! => {"failed": true, "msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'unicode object' has no attribute 'name'\n\nThe error appears to have been in '/etc/ansible/play.yml': line 8, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n with_items: group_names\n - debug: msg=\"going to install {{item.name}}-{{item.version}} on {{inventory_hostname}}\"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with_items:\n - {{ foo }}\n\nShould be written as:\n\n with_items:\n - \"{{ foo }}\"\n"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement