February 2018
Intermediate to advanced
200 pages
5h 51m
English
We will begin with a standard variable file, let us call it secret.yml, in Ansible:
---mysecret: secret-value
To use this in a playbook, we can include the file as a variable and call it in a task:
---- hosts: localhost tasks: - name: include secret include_vars: secret.yml - name: get value debug: msg: "The value is: {{ mysecret }}"
Let us run our playbook to verify that everything is good:
$ ansible-playbook playbook.ymlPLAY [localhost] ***************************************************************TASK [setup] *******************************************************************ok: [localhost]TASK [include secret] **********************************************************ok: [localhost]TASK [get value] *************************************************************** ...
Read now
Unlock full access