Difference between revisions of "Gather facts"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Line 23: Line 23:
 
* <code>[[set fact:]]</code>
 
* <code>[[set fact:]]</code>
 
*<code>[[inspec detect]]</code>
 
*<code>[[inspec detect]]</code>
 +
* https://docs.ansible.com/ansible/latest/user_guide/playbooks_vars_facts.html#ansible-facts
  
 
== See also ==
 
== See also ==

Revision as of 09:45, 1 September 2021

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"


Related terms

See also

Advertising: