8

According the Ansible documentation defining variables at runtime, it says I can load variables from a file.

ansible-playbook release.yml --extra-vars  "@some_file"

However, in my case I have two files containing extra variables for my playbook invocation.

Concatenating them together is not an option because one is a secret file created and keyed using Vault. The other file is generated from an upstream process.

I have tried:

ansible-playbook release.yml --extra-vars  "@some_file @some_other_file"

... but it didn't work. Upon invocation I get

ERROR: file could not read: some_file @some_other_file

so my guess is it takes everything after the first @ symbols as the path of the file.

My questions is, can extra-vars accept multiple files?

U880D
  • 8,601
  • 6
  • 24
  • 40
paperclip
  • 650
  • 2
  • 8
  • 23

1 Answers1

14

It turns out I can use:

ansible-playbook release.yml --extra-vars=@some_file --extra-vars=@some_other_file

This does work for me. Please let me know if there is a better answer. Thanks.

paperclip
  • 650
  • 2
  • 8
  • 23