diff --git a/tests/integration/targets/cloudfront_distribution/tasks/main.yml b/tests/integration/targets/cloudfront_distribution/tasks/main.yml index f80797ebbef..7b827553d6a 100644 --- a/tests/integration/targets/cloudfront_distribution/tasks/main.yml +++ b/tests/integration/targets/cloudfront_distribution/tasks/main.yml @@ -1,8 +1,9 @@ - module_defaults: group/aws: - aws_access_key: "{{ aws_access_key }}" - aws_secret_key: "{{ aws_secret_key }}" - security_token: "{{ security_token | default(omit) }}" + # aws_access_key: "{{ aws_access_key }}" + # aws_secret_key: "{{ aws_secret_key }}" + # security_token: "{{ security_token | default(omit) }}" + aws_profile: eu_london cloudfront_distribution: alias: "{{ cloudfront_alias | default(omit) }}" viewer_certificate: "{{ cloudfront_viewer_cert | default(omit) }}" @@ -19,7 +20,7 @@ default_cache_behavior: target_origin_id: "{{ cloudfront_hostname }}-origin.example.com" state: present - purge_origins: yes + purge_origins: true register: cf_distribution - set_fact: @@ -49,7 +50,7 @@ cloudfront_distribution: state: present distribution_id: "{{ distribution_id }}" - ipv6_enabled: True + ipv6_enabled: true register: cf_update_ipv6 - name: ensure the 'ipv6_enabled' value has changed (new value is true) @@ -76,7 +77,7 @@ cloudfront_distribution: state: present distribution_id: "{{ distribution_id }}" - ipv6_enabled: True + ipv6_enabled: true register: cf_update_ipv6 - name: ensure the 'ipv6_enabled' value has changed (new value is true) @@ -167,7 +168,7 @@ id: "{{ resource_prefix }}2.example.com" default_root_object: index.html state: present - wait: yes + wait: true register: cf_add_origin - name: ensure origin was added @@ -186,7 +187,7 @@ http_port: 8080 - domain_name: "{{ resource_prefix }}2.example.com" default_root_object: index.html - wait: yes + wait: true state: present register: cf_rerun_second_origin @@ -221,7 +222,7 @@ - domain_name: "{{ resource_prefix }}2.example.com" default_cache_behavior: target_origin_id: "{{ resource_prefix }}2.example.com" - purge_origins: yes + purge_origins: true state: present register: cf_purge_origin @@ -278,11 +279,11 @@ - name: delete distribution cloudfront_distribution: distribution_id: "{{ distribution_id }}" - enabled: no - wait: yes + enabled: false + wait: true state: absent - - name: create distribution with tags + - name: create cloudfront distribution with tags cloudfront_distribution: origins: - domain_name: "{{ resource_prefix }}2.example.com" @@ -313,7 +314,7 @@ tags: ATag: tag1 Another: tag - purge_tags: yes + purge_tags: true state: present register: rerun_with_purge_tags @@ -330,7 +331,7 @@ - domain_name: "{{ resource_prefix }}2.example.com" tags: Third: thing - purge_tags: no + purge_tags: false state: present register: update_with_new_tag @@ -373,7 +374,7 @@ origins: - domain_name: "{{ resource_prefix }}2.example.com" cache_behaviors: "{{ cloudfront_test_cache_behaviors|reverse|list }}" - purge_cache_behaviors: yes + purge_cache_behaviors: true state: present register: reverse_cache_behaviors_with_purge @@ -389,10 +390,10 @@ origins: - domain_name: "{{ resource_prefix }}3.example.com" id: "{{ resource_prefix }}3.example.com" - purge_origins: yes + purge_origins: true state: present register: remove_origin_in_use - ignore_errors: yes + ignore_errors: true - name: check that removing in use origin fails assert: @@ -431,7 +432,7 @@ origins: - domain_name: "{{ resource_prefix }}-bucket.s3.amazonaws.com" id: "{{ resource_prefix }}3.example.com" - s3_origin_access_identity_enabled: yes + s3_origin_access_identity_enabled: true state: present register: update_origin_to_s3 @@ -448,7 +449,7 @@ origins: - domain_name: "{{ resource_prefix }}-bucket.s3.amazonaws.com" id: "{{ resource_prefix }}3.example.com" - s3_origin_access_identity_enabled: no + s3_origin_access_identity_enabled: false state: present register: update_origin_to_s3_without_origin_access @@ -470,12 +471,12 @@ origins: - domain_name: "{{ resource_prefix }}-bucket.s3.amazonaws.com" id: "{{ resource_prefix }}3.example.com" - s3_origin_access_identity_enabled: yes + s3_origin_access_identity_enabled: true custom_origin_config: origin_protocol_policy: 'http-only' state: present register: update_origin_to_s3_with_origin_access_and_with_custom_origin_config - ignore_errors: True + ignore_errors: true - name: check that custom origin with origin access identity fails assert: @@ -519,8 +520,24 @@ - name: clean up cloudfront distribution cloudfront_distribution: - distribution_id: "{{ distribution_id }}" - enabled: no - wait: yes + distribution_id: "{{ item }}" + enabled: false + wait: true state: absent + register: delete_distribution + ignore_errors: true + async: 1000 + poll: 0 + with_items: + - '{{ cf_second_distribution.id }}' + - '{{ cf_distribution.id }}' + + - name: Wait for cloudfront to be deleted + async_status: + jid: "{{ item.ansible_job_id }}" + register: _delete + until: _delete.finished + retries: 100 + delay: 5 + loop: "{{ delete_distribution.results }}" ignore_errors: true