run_once and serial

1,264 views
Skip to first unread message

Michael Peters

unread,
Jul 25, 2014, 10:09:01 AM7/25/14
to ansible...@googlegroups.com
I'm testing out the new run_once feature and overall it's working
great. But I then tried it in an upgrade playbook using serial. The
task is no longer run just once per-play, it's run once
per-host-group. So for a serial of 2 in a target group of 10 servers
it's run once per pair, so 5 times.

This seems like a bug to me, but I just wanted to make sure before I
filed a ticket on it.

James Cammarata

unread,
Jul 25, 2014, 2:25:12 PM7/25/14
to ansible...@googlegroups.com
Yeah go ahead and open an issue for this, as it should only run once no matter what.

Thanks!



--
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/CAJQqANeXOLpmD%2BDQ_qafQTQS1dw5KjYnD%2Bdupk2mgg%2BFsRJfyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
Jul 25, 2014, 3:30:02 PM7/25/14
to ansible...@googlegroups.com
It will probably just be easiest to make it an error to use run_once with serial, because I don't want to have to pass a parameter to runner like "run_once_has_ran" and keep an internal hash for this.

In your case, solve the problem by having another play for the "run_once" steps outside of the host loop, that just affects localhost (or groupname[0])


Imran Khan

unread,
Aug 20, 2014, 6:23:07 AM8/20/14
to ansible...@googlegroups.com
I think the feature should be available because sometimes you need to run a task once, and then run the the playbook again, executing it by using some new result(s) ( such as content read from a file on a remote server) 

Michael DeHaan

unread,
Aug 20, 2014, 8:00:44 AM8/20/14
to ansible...@googlegroups.com
"I think the feature should be available because sometimes you need to run a task once, and then run the the playbook again, executing it by using some new result(s) ( such as content read from a file on a remote server) "

run_once with serial now runs things once per serial batch.

If you need to run something *exactly* once, you can put it in a seperate play above or below the play in the current playbook, and just target that host.




Reply all
Reply to author
Forward
0 new messages