Thank you very much Brian, moving encrypted.yml into
"host_vars/{{inventory_hostname}}/" fixed my issue. ansible_become_pass is
now imported and available for all my plays.
I'm sure what I was doing before was bad form, but it's strange that it
works fine in Ansible 1.9.4 but not now.
What I meant by scope was importing variables at the beginning of a
playbook using the below play first made the variables in `{{
inventory_hostname}}-encrypted.yml` available for all subsequent plays.
- hosts: all
vars_files:
- host_vars/{{inventory_hostname}}.yml
- host_vars/{{inventory_hostname}}-encrypted.yml
tags: [ 'always' ]
To me, it seems that (in recent Ansible versions) variables imported using
this command are only available in the play where the vars_files: statement
is located.
Maybe it's related to this bug
https://github.com/ansible/ansible/issues/9723? (found after looking into
this dupe https://github.com/ansible/ansible/issues/10000)
Either way, thanks for taking the time to correct me.
On Monday, April 25, 2016 at 11:45:13 AM UTC-8, Brian Coca wrote:
>
> Also, you should not need to import these files, the first should already
> be loaded automatically (ansible aways matches hostname inside host_vars).
>
> A way to have both autoloaded is:
>
> host_vars/{{inventory_hostname}}/clear.yml
> host_vars/{{inventory_hostname}}/encyrpted.yml
>
> as it will match the directory and import all files for that host.
>
>
> As per scoping, I'm not sure what you mean, Ansible does not distinguish
> on variable names, but when/where they are defined.
>
> ----------
> Brian Coca
>
--
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/201537a8-9d32-4c52-8a51-0b732afdd26f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.