On Sat, 9 May 2020 16:32:49 -0700 (PDT)
David Sudia <
dsu...@gospotcheck.com> wrote:
> dba.yml (a playbook)
> inventory/
> union.gcp.yml (a dynamic gcp inventory)
> group_vars/
> all/
> vars.yml
> vault.yml
> dba/
> vars.yml
> roles/
> someroleshere/
>
> $ ansible-playbook -i inventory --vault-password-file=/path/to/file dba.yml
>
> Whether I put disks in the dba/vars.yml (the correct place for it to be) or
> all/vars.yml, Ansible gets to that variable and says it's undefined.
There is nothing wrong with this
shell> cat group_vars/dba/vars.yml
disks: var from group_vars/dba/vars.yml
shell> cat inventory/hosts
[dba]
test_01
test_02
test_03
shell> cat dba.yml
- hosts: dba
tasks:
- debug:
var: disks
shell> ansible-playbook -i inventory/hosts dba.yml
PLAY [dba] **********
TASK [debug] ********
ok: [test_02] => {
"disks": "var from group_vars/dba/vars.yml"
}
ok: [test_01] => {
"disks": "var from group_vars/dba/vars.yml"
}
ok: [test_03] => {
"disks": "var from group_vars/dba/vars.yml"
}
--