Ansible newbie

48 views
Skip to first unread message

Yvonne Butler

unread,
Dec 21, 2015, 12:27:17 PM12/21/15
to Ansible Project
Hi,

I'm new to using ansible and want to run a command on a number of servers which I have listed within a text file.  I've tried the command below where "hosts" is the file containing the server name list but no luck, any ideas how I can achieve this?

ansible @hosts -m shell -a '/u01/app/em/core/12.1.0.5.0/root.sh' -k --sudo --ask-sudo

Matt Martz

unread,
Dec 21, 2015, 12:44:30 PM12/21/15
to ansible...@googlegroups.com
I think what you are wanting is something like:

ansible all -i hosts -m shell -a '/u01/app/em/core/12.1.0.5.0/root.sh' -k --sudo --ask-sudo

The change there is to switch from `@hosts` to `all -i hosts`. `all` specifies to connect to all hosts in the hosts file, and `-i hosts` specifies the host file as `hosts`.

This inventory file information is documented at:



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/db7b9b3d-6702-4b39-8e03-39e7555f224e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages