Hi all

I know I have a custom setup, but I've discovered funny thing, not sure if 
it's a bug or not, but maybe to see a second thought here.

- name: webservers
  hosts: webservers #it's a group in hosts file
  
  vars:
    my_custom_variable: webservers
    /-- output omitted --/

  #vars_files: "{{ playbook_dir }}/{{ my_custom_variable }}_vault.yml"
  #vars_files: "{{ playbook_dir }}/{{ansible_play_name}}_vault.yml"

  become: yes
  roles:
    - common
/-- output omitted --/

So, thing is with vars_files.
IF I use "my_custom_variable" then vault.yml file is located and used.
IF I use "ansible_play_name" then it's not and I get error saying

ERROR! vars file {{ playbook_dir }}/{{ansible_play_name}}_vault.yml was not 
found
Could not find file on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see 
the remote_src option

But when I enter debug and print out those variables inside playbook task, 
then I can see that they are correct and point to correct names/directories.

What am I missing here? Why I cannot use ansible_play_name inside 
vars_files inside playbook. When I use the same variable inside template or 
in same playbook tasks section, everything is correct and "webservers" is 
used.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/a8cb6615-07b8-4282-84eb-77ba478df268o%40googlegroups.com.

Reply via email to