Ansible: Difference between revisions

m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
Line 138: Line 138:


*You can use a variables file to put sensitive data in a different file (one excluded from git).
*You can use a variables file to put sensitive data in a different file (one excluded from git).
<source lang="yaml">
<syntaxhighlight lang="yaml">
- hosts: all
- hosts: all
   remote_user: root
   remote_user: root
Line 145: Line 145:
   vars_files:
   vars_files:
     - /vars/top_secret.yml
     - /vars/top_secret.yml
</source>
</syntaxhighlight>


*You can use variables on the command line (and besides key=value pairs, you can use json or yml)
*You can use variables on the command line (and besides key=value pairs, you can use json or yml)
<source lang="yaml">
<syntaxhighlight lang="yaml">
---
---


Line 156: Line 156:
   tasks:
   tasks:
     - ...
     - ...
</source>
</syntaxhighlight>
<code>ansible-playbook release.yml --extra-vars "hosts=vipers user=starbuck"</code>
<code>ansible-playbook release.yml --extra-vars "hosts=vipers user=starbuck"</code>