Using vars_files with an include in ansible -


i have playbook want convert template, , include using include elsewhere, , override few variables, this:

$ cat env_demo.yml --- - include: template_standalone.yml   vars:     hosts: demo.example.com     environment_name: "demo environment" 

this works fine, i'd encrypt of variables, this:

$ cat env_demo_secret.yml --- - include: template_standalone.yml   vars:     hosts: demo.example.com   vars_files:     - secrets/demo.example.com.yml 

now error:

error! 'vars_files' not valid attribute playbookinclude 

my template_standalone.yml contains list of different roles...:

$ cat template_standalone.yml --- - name: setting standalone environment   hosts: "{{ hosts }}"   roles:    - role: php7       - role: nginx    ... 

...that need configuration server passwords, etc., i'd rather not have in plaintext in main file. thoughts on instead?

vars_files not supported included playbooks (as of ansible 2.3)

you may opt use variables file:

ansible-playbook -e @secrets/demo.example.com.yml env_demo.yml 

or use group variables file all group – place encrypted file ./group_vars/all/demo.example.com.yml.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -