You can specify inventory file host path or comma separated host list. Except “localhost”, you can always specify a inventory using “-i INVENTORY” or –inventory=INVENTORY.
Also, there are two default groups: all and ungrouped. “all” contains every host of the inventory file host path or comma separated host list and “ungrouped” contains all hosts that don’t have another group aside from all.
Here is the example of one remote machine inventory using ansible adhoc program.
$ ansible all -i 10.7.8.9, -m setup -u usernmae -k -b
$ ansible all -i 10.7.8.9, -m yum -a "name=httpd state=installed" -u usernmae -k -b
$ ansible all -i 10.7.8.9,10.7.8.9, -m yum -a "name=httpd state=installed" -u usernmae -k -b
Here is the example of one remote machine inventory using ansible inventory
# content of inventory file
10.7.8.9
$ ansible-playbook -i inventory playbook.yaml -u usernmae -k -b
$ ansible-playbook -i inventory playbook.yaml -u usernmae -k -b
$ ansible-playbook -i inventory playbook.yaml -u usernmae -k -b
Ansible Fundamental tutorial by Manish in 2020
Ansible Advance Tutorial for Beginners with Demo 2020 — By DevOpsSchool
Ansible with network module (Part 01) — By DevOpsSchool
Ansible with network module (Part 02) — By DevOpsSchool
Ansible with network module (Part 03) — By DevOpsSchool
Ansible with network module (Part 04) — By DevOpsSchool
Ansible with network module (Part 05) — By DevOpsSchool
Ansible with network module (Part 06) — By DevOpsSchool
Ansible with network module (Part 07) — By DevOpsSchool
Ansible with network module (Part 08) — By DevOpsSchool
Ansible with network module (Part 09) — By DevOpsSchool
Ansible with network module (Part 10) — By DevOpsSchool
Ansible with network module (Part 11) — By DevOpsSchool
Ansible with network module (Part 12) — By DevOpsSchool
Ansible with network module (Part 13) — By DevOpsSchool
Latest posts by Rajesh Kumar (see all)
- Discover the Heart of India with Mera Apna Bihar - December 20, 2024
- Experience the Pulse of Bangalore with Bangalore Orbit - December 20, 2024
- Discover the City of Lakes with Bhopal Orbit - December 20, 2024