Difference between revisions of "Gather facts"
Jump to navigation
Jump to search
Line 31: | Line 31: | ||
* <code>[[bolt task run facts --targets]]</code> | * <code>[[bolt task run facts --targets]]</code> | ||
* [[Chef]]: <code>[[inspec detect]]</code> | * [[Chef]]: <code>[[inspec detect]]</code> | ||
− | |||
* <code>[[ansible.builtin.set_fact]]</code> module | * <code>[[ansible.builtin.set_fact]]</code> module | ||
Revision as of 11:16, 18 October 2023
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 | yes ]
Example:
#!/usr/bin/env ansible-playbook - hosts: localhost gather_facts: no
Using facts:
tasks: - name: Shut down Debian flavored systems ansible.builtin.command: /sbin/shutdown -t now when: ansible_facts['os_family'] == "Debian"
The following modules failed to execute: ansible.legacy.setup
TASK [Gathering Facts] ********************************************************************************************************* ok: [SERVER_NAME]
Related terms
gathering
in/etc/ansible/ansible.cfg
ios_ping
bolt task run facts --targets
- Chef:
inspec detect
ansible.builtin.set_fact
module
See also
- Ansible
setup
module: https://docs.ansible.com/ansible/latest/modules/setup_module.html - Ansible modules:
gather_facts, set_fact
,ansible.builtin.file
,lineinfile
,stat
,group
,mount
,git:
,package:
,command:
,shell:
,raw:
,template:
,register:
,user:
, Ansible playbooks examples,tasks:
,lineinfile, blockinfile:
,shell:
,command:
,raw:
,ansible.builtin.file, service:, aws.ecs_taskdefinition, aws.asg, docker_container, kubernetes.core.k8s
,community.
,include_tasks
Advertising: