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
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND