Am I misunderstanding something? It works when using an ad-hoc command
using the same parameters. Is this a hostvars issue? The groups exist with
the correct hosts and thus as mentioned does contain the ec2_ facts. If I
execute the same via an ad-hoc command, you see the ansible_ facts show up
just fine.
cb_ansible_deploy $ ansible 'db:&prd' -m setup | grep ansible_hostname
"ansible_hostname": "cbdb-e1b-04",
"ansible_hostname": "cbdb-e1a-02",
"ansible_hostname": "cbdb-e1b-02",
"ansible_hostname": "cbdb-e1b-05",
"ansible_hostname": "cbdb-e1a-05",
"ansible_hostname": "cbdb-e1a-03",
"ansible_hostname": "cbdb-e1a-01",
"ansible_hostname": "cbdb-e1b-03",
"ansible_hostname": "cbdb-e1a-06",
"ansible_hostname": "cbdb-e1b-01",
"ansible_hostname": "cbdb-e1b-06",
"ansible_hostname": "cbdb-e1a-04",
cb_ansible_deploy $ ansible-playbook wiki.yml -l 'db:&prd' --list-hosts
playbook: wiki.yml
play #1 (api:db:lb:d3:&prd): api:db:lb:d3:&prd TAGS: [facts]
pattern: [u'api:db:lb:d3:&prd']
hosts (12):
cbdb_e1a_01_cb_comcast_net
cbdb_e1a_06_cb_comcast_net
cbdb_e1b_05_cb_comcast_net
cbdb_e1b_03_cb_comcast_net
cbdb_e1b_06_cb_comcast_net
cbdb_e1a_05_cb_comcast_net
cbdb_e1b_02_cb_comcast_net
cbdb_e1a_04_cb_comcast_net
cbdb_e1a_02_cb_comcast_net
cbdb_e1b_01_cb_comcast_net
cbdb_e1b_04_cb_comcast_net
cbdb_e1a_03_cb_comcast_net
play #2 (localhost): localhost TAGS: [local]
pattern: [u'localhost']
hosts (0):
play #3 (adm): adm TAGS: [adm]
pattern: [u'adm']
hosts (0):
cb_ansible_deploy $ ansible-playbook wiki.yml
PLAY [db:&prd]
*****************************************************************
TASK [setup]
*******************************************************************
ok: [cbdb_e1a_02]
ok: [cbdb_e1a_04]
ok: [cbdb_e1a_06]
ok: [cbdb_e1a_05]
ok: [cbdb_e1b_04]
ok: [cbdb_e1b_03]
ok: [cbdb_e1b_05]
ok: [cbdb_e1b_01]
ok: [cbdb_e1a_03]
ok: [cbdb_e1a_01]
ok: [cbdb_e1b_02]
ok: [cbdb_e1b_06]
PLAY [localhost]
***************************************************************
TASK [store date time]
*********************************************************
ok: [127.0.0.1]
TASK [build wiki]
**************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, "msg":
"AnsibleUndefinedVariable: 'dict object' has no attribute
'ansible_hostname'"}
On Feb 2, 2017 1:37 PM, "Brian Coca" <[email protected]> wrote:
> Doesn't it work as expected? you avoid gathering facts for machines in
> groups['db'] that are not also in 'prd'.
>
>
> ----------
> Brian Coca
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/to
> pic/ansible-project/6NxLxbNUxwc/unsubscribe.
> To unsubscribe from this group and all its topics, 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/ms
> gid/ansible-project/CACVha7eW_Jqayzjra8YqwdsEphZ%2B7CaX0NHHs
> FSUA6onwAk_Cg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CA%2BHjMCKmxS9W%3DATwo-KVX1vSkfX11NdmsPOFL28n-dYL2kM00A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.