linux_wiki:ansible

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:ansible [2018/07/21 00:23]
billdozor [Repo Controlled]
linux_wiki:ansible [2019/05/25 23:50] (current)
Line 237: Line 237:
 \\ \\
 **Playbooks map ansible groups to roles** **Playbooks map ansible groups to roles**
-  * Example playbook<code bash># File: webservers_nginx.yml+  * Example playbook<code yaml># File: webservers_nginx.yml
 # Description: Nginx Webservers # Description: Nginx Webservers
 # Last Updated: 2018-04-08 # Last Updated: 2018-04-08
Line 261: Line 261:
  
 If you do need to gather facts, consider gathering a subset of facts instead of everything in order to keep the fact collection fast. If you do need to gather facts, consider gathering a subset of facts instead of everything in order to keep the fact collection fast.
-  * Example: Collect only the ansible_distribution facts<code bash># Gather host facts for this playbook+  * Example: Collect only the ansible_distribution facts<code yaml># Gather host facts for this playbook
   gather_facts: yes   gather_facts: yes
   # Gather only ansible_distribution info (OS attributes)   # Gather only ansible_distribution info (OS attributes)
Line 278: Line 278:
   * You can test your subset commands like this   * You can test your subset commands like this
     * ad-hoc<code bash>ansible -m setup -a 'gather_subset=!all,!min,distribution' localhost</code>     * ad-hoc<code bash>ansible -m setup -a 'gather_subset=!all,!min,distribution' localhost</code>
 +
 +**Available Fact Subsets**:
 +  * all
 +  * min
 +  * hardware
 +  * network
 +  * virtual
 +  * ohai
 +  * facter
  
 \\ \\
Line 341: Line 350:
     - Navigate to the playbooks directory<code bash>cd ${HOME}/repos/ansible/playbooks/</code>     - Navigate to the playbooks directory<code bash>cd ${HOME}/repos/ansible/playbooks/</code>
     - Copy your playbook template to a new playbook yaml file.<code bash>cp TEMPLATE_PLAYBOOK.yml my_new_playbook.yml</code>     - Copy your playbook template to a new playbook yaml file.<code bash>cp TEMPLATE_PLAYBOOK.yml my_new_playbook.yml</code>
-      - Playbook Template<code bash TEMPLATE_PLAYBOOK.yml># File: TEMPLATE_PLAYBOOK.yml+      - Playbook Template<code yaml TEMPLATE_PLAYBOOK.yml># File: TEMPLATE_PLAYBOOK.yml
 # Description: PLAYBOOK DESCRIPTION HERE # Description: PLAYBOOK DESCRIPTION HERE
 # Last Updated: 2018-03-15 # Last Updated: 2018-03-15
Line 358: Line 367:
   gather_facts: no   gather_facts: no
 </code> </code>
-    - Edit the new playbook<code bash>vim ansible/playbooks/my_new_playbook.yml+    - Edit the new playbook (vim ansible/playbooks/my_new_playbook.yml)<code yaml>
 - hosts: my_ansible_group - hosts: my_ansible_group
   roles:   roles:
  • linux_wiki/ansible.1532147027.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)