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.
Yeah go ahead and open an issue for this, as it should only run once no matter what.
Thanks!
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])
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)
"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.