How to run Ansible without hosts file?

0 votes
How to run Ansible without hosts file?
Feb 1, 2019 in Ansible by Ruth
627 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,254 views
0 votes
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
• 33,540 points
77 views
0 votes
1 answer

How to regex replace nested values in Ansible

I'm not aware of any built-in method ...READ MORE

answered Jun 16, 2018 in Ansible by shubham
• 6,910 points
1,939 views
0 votes
1 answer

How to use Ansible git module pull a branch with local changes?

You cannot achieve it using the git ...READ MORE

answered Jul 9, 2018 in Ansible by Atul
• 10,240 points
2,745 views
+13 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,420 points
547 views
0 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
150 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
5,211 views