run_once clause

When the run_once clause is present and set to a truthy value, the
instruction it is attached to will only be executed the first time it is
encountered.
This commit is contained in:
Emmanuel BENOîT 2022-09-17 12:22:40 +02:00
parent 14fca45cb7
commit 446280ab6e
3 changed files with 27 additions and 10 deletions

View file

@ -30,12 +30,15 @@ instructions:
- action: stop
# Only create the managed groups if we *have* managed hosts
- action: create_group
group: managed
- loop: [by_environment, by_network, by_failover_stack, by_service]
action: create_group
group: "{{ item }}"
parent: managed
- action: block
run_once: true
block:
- action: create_group
group: managed
- loop: [by_environment, by_network, by_failover_stack, by_service]
action: create_group
group: "{{ item }}"
parent: managed
# Copy inv__data fields to separate inv__ variables
- loop: