Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ark-show-vars doesn't work as expected #19

Open
gittes opened this issue Sep 26, 2015 · 4 comments
Open

ark-show-vars doesn't work as expected #19

gittes opened this issue Sep 26, 2015 · 4 comments

Comments

@gittes
Copy link

gittes commented Sep 26, 2015

Do you require variables/facts to be in cache or have variables defined only in the inventory ini files?

When I have inventory files in it's own directory and group_vars directory with it's own files, atk-show-vars will only show me the heading lines with define group names.

What am I missing or doing wrong?

Below is output showing first the involved files, the involved files contents (host the same variable defined more than once) and then two sample outputs from ark-show-vars:

(ansible)christopherstewart ~/Temporary/ansible-toolkit-test ⚡ find . -type file
./development/stewness
./group_vars/all/proof
./group_vars/stewness_proof_all_dev
./group_vars/stewness_proof_all_nonprod
./group_vars/stewness_proof_web_dev
./host_vars/web003.dev.dc01
(ansible)christopherstewart ~/Temporary/ansible-toolkit-test ⚡ find . -type file | xargs -t -n1 cat
cat ./development/stewness
[stewness_proof_web_dev]
web001.dev.dc01
web002.dev.dc01
web003.dev.dc01

[stewness_proof_app_dev]
app001.dev.dc01
app002.dev.dc01
app003.dev.dc01

[stewness_proof_web_qa]
web001.qa.dc01
web002.qa.dc01
web003.qa.dc01

[stewness_proof_app_qa]
app001.qa.dc01
app002.qa.dc01
app003.qa.dc01

[stewness_proof_all_dev:children]
stewness_proof_web_dev
stewness_proof_app_dev

[stewness_proof_all_qa:children]
stewness_proof_web_qa
stewness_proof_app_qa

[stewness_proof_all_nonprod:children]
stewness_proof_all_dev
stewness_proof_all_qa
cat ./group_vars/all/proof
the_stewness: is all good
cat ./group_vars/stewness_proof_all_dev
the_stewness: 3
cat ./group_vars/stewness_proof_all_nonprod
the_stewness: 101
cat ./group_vars/stewness_proof_web_dev
the_stewness: 1
cat ./host_vars/web003.dev.dc01
the_stewnewss: about 3
(ansible)christopherstewart ~/Temporary/ansible-toolkit-test ⚡ atk-show-vars --inventory development app003.qa.dc01
Default Variables
Group Variables (all)
Group Variables (stewness_proof_all_nonprod)
Group Variables (stewness_proof_all_qa)
Group Variables (stewness_proof_app_qa)
Host Variables
Setup Cache
Play Variables
Play File Variables
Role Variables
Module Variables
Variables Cache
Role Parameters
Extra Variables
(ansible)christopherstewart ~/Temporary/ansible-toolkit-test ⚡ atk-show-vars --inventory development web003.qa.dc01
Default Variables
Group Variables (all)
Group Variables (stewness_proof_all_nonprod)
Group Variables (stewness_proof_all_qa)
Group Variables (stewness_proof_web_qa)
Host Variables
Setup Cache
Play Variables
Play File Variables
Role Variables
Module Variables
Variables Cache
Role Parameters
Extra Variables

@gittes
Copy link
Author

gittes commented Oct 13, 2015

Bump.

Would love insight how group vars are processed and leverage this wonderful tool. Would help my team a lot.

@dellis23
Copy link
Owner

Sorry, for some reason I'm not getting notifications for this repo. I've tried "watching" this, so hopefully it will work in the future. I will take a look and follow up soon.

@dellis23
Copy link
Owner

If I had to guess based on the output, I would say it's because ansible toolkit expects your group and host variables to be inside the directory containing your inventory. In your case, this would look something like development/group_vars/, and development/host_vars. I believe I originally picked this pattern up from the suggested structure for Ansible Tower, but it's clear Ansible supports more ways of structuring these.

If you have time and are interested, I'd love if you could come up with a patch to support both cases. Otherwise, I'm not sure when I will be able to get to this. Either way, it's on my radar, so thank you for the issue.

@gittes
Copy link
Author

gittes commented Oct 16, 2015

Confirmed! I put copies of my host_vars and group_vars into my development/ inventory and it worked as expected.

I pretty swamped for time, but knowing the problem is, I will try to contribute a patch.

ansible 2.0 beta1 is out too... I wonder if we need to wait and see how it handles all this stuff too.

Thank you, and I'll contribute what I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants