On Sat, 9 May 2020 16:32:49 -0700 (PDT)
David Sudia <[email protected]> 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"
  }

--

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20200510045424.51d84499%40gmail.com.

Attachment: pgpXQxLSDWPGu.pgp
Description: OpenPGP digital signature

Reply via email to