Re: [ansible-project] Using group_vars with dynamic inventory groups

1,488 views
Skip to first unread message
Message has been deleted

Brian Coca

unread,
Feb 16, 2015, 10:09:04 AM2/16/15
to ansible...@googlegroups.com
for static groups vars to be loaded try adding the group in a static
file also, even if just empty.

static_inventory:

[test_env_test]


--
Brian Coca

ddffgpmfn

unread,
Feb 16, 2015, 10:18:26 AM2/16/15
to ansible...@googlegroups.com
added line to "./inventory/test/test" as suggested:

[local]
localhost target_environment="test" dev_key="aws-xxx"

[tag_env_test]


No change. Variable is still not defined.

Serge van Ginderachter

unread,
Feb 16, 2015, 10:24:43 AM2/16/15
to ansible...@googlegroups.com
​What Brian suggested should IIRC not be needed. The host/group_vars are loaded after all InventoryParsers are done.

Which ansible version are you using?​
 
​I think that was a bug in 1.7, solved in 1.8, not sure if backported.​


ddffgpmfn

unread,
Feb 16, 2015, 10:32:20 AM2/16/15
to ansible...@googlegroups.com
$ ansible --version
ansible 1.8.2
  configured module search path = None

$ ansible-playbook --version
ansible-playbook 1.8.2
  configured module search path = None

Is there anything else I can show to work out whether I have made a mistake or there is a bug?

Serge van Ginderachter

unread,
Feb 16, 2015, 10:41:38 AM2/16/15
to ansible...@googlegroups.com

On 16 February 2015 at 16:32, ddffgpmfn <t...@aioue.net> wrote:
Is there anything else I can show to work out whether I have made a mistake or there is a bug?


Perhaps if you could put a minimal example in a gist, that reproduces this?​

ddffgpmfn

unread,
Feb 16, 2015, 11:15:48 AM2/16/15
to ansible...@googlegroups.com
Edited out a proof of concept from the repo:

Serge van Ginderachter

unread,
Feb 16, 2015, 1:21:12 PM2/16/15
to ansible...@googlegroups.com

On 16 February 2015 at 17:15, ddffgpmfn <t...@aioue.net> wrote:
Edited out a proof of concept from the repo:



​I'm afraid I don't have any AWS credentials to test this.
Can you perhaps provide the plain json dump​ - can be redacted?

ddffgpmfn

unread,
Feb 16, 2015, 1:39:15 PM2/16/15
to ansible...@googlegroups.com
Are you looking for the output of the config playbook with -vvvv?

Serge van Ginderachter

unread,
Feb 16, 2015, 1:47:03 PM2/16/15
to ansible...@googlegroups.com

On 16 February 2015 at 19:39, ddffgpmfn <t...@aioue.net> wrote:
Are you looking for the output of the config playbook with -vvvv?


​no the output of your inventory plugin, which is json​

ddffgpmfn

unread,
Feb 17, 2015, 1:22:42 PM2/17/15
to ansible...@googlegroups.com

Serge van Ginderachter

unread,
Feb 17, 2015, 2:08:25 PM2/17/15
to ansible...@googlegroups.com
Seems I can't reproduce your problem:

[mstr] serge@cyberlab:~/tmp/ansible-test$ tree
.
├── aws-configure.yml
├── aws-provision.yml
├── inventory
│   ├── ec2.py-output.json
│   └── group_vars
│       └── tag_env_test.yml
├── README.md
└── vars
    ├── aws_secrets.yml
    └── aws_vars.yml

3 directories, 7 files
[mstr] serge@cyberlab:~/tmp/ansible-test$ ANSIBLE_NOCOWS=1 ansible-playbook -i inventory aws-configure.yml

PLAY [!local;tag_role_db:&tag_status_new] *************************************

TASK: [debug var=groups['tag_env_test']] **************************************
ok: [54.x] => {
    "groups['tag_env_test']": [
        "54.x"
    ]
}

TASK: [debug var={{ region }}] ************************************************
ok: [54.x] => {
    "eu-west-1": "eu-west-1"
}

PLAY RECAP ********************************************************************
54.x                       : ok=2    changed=0    unreachable=0    failed=0  




Tested with ansible 1.7.2, 1.8.2 and latest devel.


On 17 February 2015 at 19:22, ddffgpmfn <t...@aioue.net> wrote:

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3abd0104-2bed-434d-83e8-b2986be9986c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages