Difference between revisions of "Gather facts"

From wikieduonline
Jump to navigation Jump to search
Line 10: Line 10:
 
ok: [SERVER_NAME]
 
ok: [SERVER_NAME]
 
</pre>
 
</pre>
 +
 +
tasks:
 +
  - name: Shut down Debian flavored systems
 +
    ansible.builtin.command: /sbin/shutdown -t now
 +
    [[when:]] [[ansible_facts]]['os_family'] == "Debian"
 +
 +
  
  

Revision as of 13:53, 13 October 2020

Ansible gather_facts module, new in Ansible 2.8 (May 2019), allows to gather useful variables about remote hosts that can be used in playbooks


gather_facts: no
gather_facts: yes
TASK [Gathering Facts] *********************************************************************************************************
ok: [SERVER_NAME]
tasks:
 - name: Shut down Debian flavored systems
   ansible.builtin.command: /sbin/shutdown -t now
   when: ansible_facts['os_family'] == "Debian"



See also

Advertising: