Discussion:
[ansible-project] Ansible not pulling in group_vars
datsun80
2015-07-29 20:24:31 UTC
Permalink
I moved my inventory files to their own directory and now the group_vars
are not loading.

Ansible Docs state:
Tip: In Ansible 1.2 or later the group_vars/ and host_vars/ directories can
exist in either the playbook directory OR the inventory directory. If both
paths exist, variables in the playbook directory will override variables
set in the inventory directory.

My current layout is as follows:
├── hosts
│ └── dev
│ └── qa
├── group_vars
│ ├── all
│ └── dev
│ └── qa
├── roles
├── site.yml

What am I missing? If I move the inventory files back to the main directory
with site.yml Ansible correctly pickups the group_vars.
--
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-project+***@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/273794ec-6436-4921-9f0b-f46249075c49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
senorsmile
2015-07-29 23:11:25 UTC
Permalink
How are you setting the inventory (I assume the hosts folder contain your
inventory files). Give us a sample of what's in the inventory files?
Post by datsun80
I moved my inventory files to their own directory and now the group_vars
are not loading.
Tip: In Ansible 1.2 or later the group_vars/ and host_vars/ directories
can exist in either the playbook directory OR the inventory directory. If
both paths exist, variables in the playbook directory will override
variables set in the inventory directory.
├── hosts
│ └── dev
│ └── qa
├── group_vars
│ ├── all
│ └── dev
│ └── qa
├── roles
├── site.yml
What am I missing? If I move the inventory files back to the main
directory with site.yml Ansible correctly pickups the group_vars.
--
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-project+***@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/fcb6b6fd-28fc-4036-99bc-8943be128840%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
datsun80
2015-07-30 13:21:39 UTC
Permalink
Yes, the hosts folder contains the inventory files.

I am calling it like so:
ansible-playbook -i hosts/qa -t redis site.yml

In the inventory file I have:

- name: Redis Server
hosts: redis
sudo: yes
roles:
- { role: redis, tags: ['redis'] }
Post by senorsmile
How are you setting the inventory (I assume the hosts folder contain your
inventory files). Give us a sample of what's in the inventory files?
Post by datsun80
I moved my inventory files to their own directory and now the group_vars
are not loading.
Tip: In Ansible 1.2 or later the group_vars/ and host_vars/ directories
can exist in either the playbook directory OR the inventory directory. If
both paths exist, variables in the playbook directory will override
variables set in the inventory directory.
├── hosts
│ └── dev
│ └── qa
├── group_vars
│ ├── all
│ └── dev
│ └── qa
├── roles
├── site.yml
What am I missing? If I move the inventory files back to the main
directory with site.yml Ansible correctly pickups the group_vars.
--
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-project+***@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/944c4da6-e90d-4ba9-b7fb-d2d594086b7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Guy Matz
2015-07-30 15:29:08 UTC
Permalink
Is that your inventory? Or your site.yml?
Post by datsun80
Yes, the hosts folder contains the inventory files.
ansible-playbook -i hosts/qa -t redis site.yml
- name: Redis Server
hosts: redis
sudo: yes
- { role: redis, tags: ['redis'] }
Post by senorsmile
How are you setting the inventory (I assume the hosts folder contain your
inventory files). Give us a sample of what's in the inventory files?
Post by datsun80
I moved my inventory files to their own directory and now the group_vars
are not loading.
Tip: In Ansible 1.2 or later the group_vars/ and host_vars/ directories
can exist in either the playbook directory OR the inventory directory. If
both paths exist, variables in the playbook directory will override
variables set in the inventory directory.
├── hosts
│ └── dev
│ └── qa
├── group_vars
│ ├── all
│ └── dev
│ └── qa
├── roles
├── site.yml
What am I missing? If I move the inventory files back to the main
directory with site.yml Ansible correctly pickups the group_vars.
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/944c4da6-e90d-4ba9-b7fb-d2d594086b7b%40googlegroups.com
<https://groups.google.com/d/msgid/ansible-project/944c4da6-e90d-4ba9-b7fb-d2d594086b7b%40googlegroups.com?utm_medium=email&utm_source=footer>
.
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 ansible-project+***@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/CABnTgtVbGMco0o-%3DGWbiS46Ci7hAuX243%2Bua%3D_xk9KiFAfBk5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
datsun80
2015-07-30 15:32:25 UTC
Permalink
Yes, I mistyped. This is in my site.yml file:

- name: Redis Server
hosts: redis
sudo: yes
roles:
- { role: redis, tags: ['redis'] }
Post by Guy Matz
Is that your inventory? Or your site.yml?
--
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-project+***@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/f7d9cb6e-c06c-4c5d-9b83-04062a8800f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...