On 4/28/14, 9:15 AM, [email protected] wrote:
This pops up in a significant share of my scripts:

- hosts: 127.0.0.1
   connection: local
   gather_facts: false

Is there any way to shortcut this to something shorter like

- local_script

or somesuch?


On an individual task level you can do either:

<modulename>: <moduleargs>
delegate_to: localhost


or

local_action: <modulename> <moduleargs>


which will do a local action. However it would do this X times, where X == the number of hosts in your hosts: definition for that play.

The most clean way to do a single local action is to do like you've been, create a play with hosts: localhost and the tasks you wish to execute there. Because it really is a separate play, outside the host loop of other plays, you do need the play headers.

As of 1.5, localhost is an implicit member of your inventory, with a default connection of local, so you shouldn't have to specify that bit.


-jlk

--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/535EA6D5.9090801%40j2solutions.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to