I'd like to stop Nginx just once if any of the items in a list are True
.
Because multiple items in the list could be True
, I only want to stop Nginx on the first and then not run this command again.
At a later point in the script I will use the same logic to start Nginx again.
- name: Nginx is temporarily shutting down
command: sudo systemctl stop nginx.service
when:
- item == True
with_items: "{{ saved_results_list }}"
Is there a way to only run this if an item in the list is True
, but not multiple times?