How to run Ansible without hosts file?

0 votes
How to run Ansible without hosts file?
Feb 1 in Ansible by Ruth
158 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 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 in Ansible by Kavya
565 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,890 points
1,124 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
1,659 views
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
128 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,380 points
208 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Ansible playbook to wget a file

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

answered Jan 16 in Ansible by Vaishu
1,773 views