I am using a playbook to configure machines provisioned and tagged with
Ansible but cannot reference variables named with ec2.py tag groups.
The output of "ec2.py" shows that the group with the tag name I am looking
for is present:
$ ./inventory/test/ec2.py
<snip>
"tag_env_test": [
"54.xx",
"54.xx",
"54.xx"
],
<snip>
There is a file "./inventory/group_vars/tag_env_test.yml" that contains the
variable I am trying to reference:
---
region: eu-west-1
When running the playbook, the I get output showing the group is present.
but a group_var for that same group causes an error:
- hosts:
- "!local"
- tag_role_db:&tag_status_new
gather_facts: false
remote_user: xx
tags: db
tasks:
- debug: var=groups['tag_env_test']
run_once: true
- debug: var={{ region }}
$ ansible-playbook aws-configure.yml -i inventory/test/ --ask-vault-pass -v
TASK: [debug var=groups['tag_env_test']]
**************************************
ok: [54.xx] => {
"groups['tag_env_test']": [
"54.xx",
"54.xx",
"54.xx"
]
}
TASK: [debug var={{ region }}]
************************************************
fatal: [54.xx] => One or more undefined variables: 'region' is undefined
...
How can I set variables for dynamic (ec2.py) created groups?
Thanks
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/cfc716db-c617-45ea-9ab5-6aaa5317b8c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.