Can someone please assist me here.
Ive gone though all ansible docs and my hostfile is at the same folder
level as group_vars and still, host/group variables defined in hostfile
arent picked.
Below is my structure.
--- ansible.cfg
--- inventory/
--- qa/
--- group_vars/
--- all.yml
--- hosts.ini
--- playbook.yml
--- roles
--- myrole
--- tasks
--- main.yml
--- vars
--- ctr1.yml
--- ctr2.yml
--- ctr3.yml
--- templates
--- ctr1.yml.j2
--- ctr2.yml.j2
--- ctr3.yml.j2
On Friday, May 24, 2019 at 8:42:13 PM UTC+5:30, Saranya N wrote:
>
> My structure looks like below.
>
> Inventory/qa folder has below.
>
> hosts # inventory file
>
> group_vars/
> all.yml
> myrole.yml
>
> myrole folder has below
>
> myrole/
>
> tasks/main.yml
> Vars/
> ctr1.yml
> Ctr2.yml
> Ctr 3.yml
> main.yml
> Templates/
> Ctr1.yml.j2
> Ctr2.yml.j2
> Ctr3.yml.j2
>
> My roles/tasks/main.yml decides which vars Ctrl file to load depending on
> my extravars c=1 or c=2 or c=3 .
>
> Inventory/qa/hosts has below.
>
> [Myapps]
> Ctr1
> Ctr2
> Ctr3
>
> [Ctr1:vars]
> Appname="{{ app }}-{{ ansible-host }}-{{ type }}"
>
> [Ctr2:vars]
> Appname="{{ app}}-{{ ansible-e to }}-{{ type }}"
>
> [Ctr2]
> Server1/dynt ansible-host=server1 type=dynt
> Server1/splunk ansible-host=server2 type=splunk
>
>
> Roles/tasks/main.yml ( I have customcli)
> Command: customcli --host {{ ansible-host }} --appname {{ Appname }}
>
>
> Roles tasks don't pick any variables defined under Check inventory file
>
> Can someone please help??
>
> I did research a lot in ansible docs and I'm unable to figure out my
> mistake.
>
> Can someone please guide me why it's not picking inventory variables
>
>
--
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/f92cb448-33f1-47ec-952b-96965c175f61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.