How to run Ansible without hosts file?

0 votes
How to run Ansible without hosts file?
Feb 1, 2019 in Ansible by Ruth
841 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
1,540 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 in Ansible by MD
• 65,720 points
281 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 in Ansible by MD
• 65,720 points
623 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 in Ansible by MD
• 65,720 points
412 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
727 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
180 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
6,588 views