How to run Ansible without hosts file

0 votes
How to run Ansible without hosts file?
Feb 1, 2019 in Ansible by Ruth
2,896 views

1 answer to this question.

0 votes

Hey @Ruth, you can use ansible without using the hosts file in the following way

ansible all -i "<hostname-or-ip>," -a 'uptime'

Make sure you add a ',' at the end of the IP address, or it will be considered as hosts inventory filename.

Example:

ansible all -i "192.168.56.105," -a 'uptime'

192.168.56.105 | SUCCESS | rc=0 >>
 12:05:10 up 10 min,  1 user,  load average: 0.46, 0.23, 0.08
answered Feb 1, 2019 by Anisha

Related Questions In Ansible

0 votes
1 answer

How to encrypt and existing file using Ansible Vault?

Hey @Kyraa, to encrypt an existing file ...READ MORE

answered Jan 29, 2019 in Ansible by Kavya
3,448 views
+1 vote
1 answer

How to deploy war file into the Websphere using ansible playbook

Hi@M, You can use the below-given example. - name: ...READ MORE

answered Jun 29, 2020 in Ansible by MD
• 95,460 points
2,392 views
0 votes
1 answer

How to list down all the hosts in Ansible?

Hi@akhtar, You can use the option --list-hosts. It will ...READ MORE

answered Jul 28, 2020 in Ansible by MD
• 95,460 points
48,146 views
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
14,382 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,024 views
+2 votes
1 answer
0 votes
1 answer

How to create a new encrpted file using Ansible Vault?

If you are creating a new file ...READ MORE

answered Jan 29, 2019 in Ansible by Kyraa
1,020 views
0 votes
1 answer

Ansible playbook to wget a file

Hey @Celia, one recommendation, try not using ...READ MORE

answered Jan 16, 2019 in Ansible by Vaishu
17,639 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP