1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/aws_ses_rule_set/tasks/obtain-lock-wrapper.yaml
Ed Costello b70d5d9aee [AWS] ses rule set module for inbound email processing (#42781)
* Add module ses_rule_set for Amazon SES

* Update behaviours and naming to be consistent with other aws_ses_ modules.

* Add global lock around tests using active rule sets to prevent intermittent test failures.

* Fix deletion of rule sets so that we don't inactivate the active rule set
when force deleting an inactive rule set.
2018-11-14 12:15:24 -05:00

26 lines
1 KiB
YAML

# ============================================================
# Do While loops cannot be used on task includes.
# See: https://github.com/ansible/ansible/issues/17098
#
# So as a workaround we use a regular loop to repeatedly attempt
# obtaining a lock.
#
# For this to work we need to skip the subsequent iterations
# once we get a lock, and delay between iterations if we
# did not obtain the lock.
#
# This file encapsulates this logic to reduce the spam from
# skipped tasks in the ansible log.
# ============================================================
- include_tasks: obtain-lock.yaml
# Skip obtaining a lock if we've already succeeded in getting it
when: "not won_lock|default(False)|bool"
- name: Lock Retry Delay
wait_for:
# Add some random jitter to the delay to reduce lock contention
timeout: "{{ obtain_lock_delay_seconds + 15|random }}"
# Only delay if we're retrying, so skip the delay if we're
# on the last attempt or have got the lock
when: "obtain_lock_attempt < (max_obtain_lock_attempts - 1) and not won_lock|bool"