Skip to content

Commit

Permalink
Ansible 2.9 (#27)
Browse files Browse the repository at this point in the history
* Test 2.9 debug

* Remove extra tests

Signed-off-by: Timur Gadiev <[email protected]>
  • Loading branch information
tgadiev authored Nov 15, 2019
1 parent 4729e11 commit 31fe7c1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
5 changes: 2 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ before_script:
variables:
GET_SOURCES_ATTEMPTS: "5"

AWS role from cookiecutter test:
AWS role cookiecutter:
variables:
AWS_REGION: us-east-1
stage: deployment test
Expand All @@ -23,8 +23,7 @@ AWS role from cookiecutter test:
tags:
- aws


AZURE role from cookiecutter test:
AZURE role cookiecutter:
stage: deployment test
script:
- cookiecutter -f --no-input https://github.com/lean-delivery/ansible-development-kit
Expand Down
2 changes: 1 addition & 1 deletion AZURE/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
unique_vmss_name: >-
{{ unique_vmss_name | default({})
| combine({ item.name: 'tst-' + ((item.name + '-' + ci_branch_name)
| to_uuid)[:8] }) }}
| to_uuid)[:11] }) }}
loop: '{{ molecule_yml.platforms }}'
loop_control:
label: '{{ item.name }}'
Expand Down
56 changes: 31 additions & 25 deletions AZURE/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
unique_vmss_name: >-
{{ unique_vmss_name | default({})
| combine({ item.name: 'tst-' + ((item.name + '-' + ci_branch_name)
| to_uuid)[:8] }) }}
| to_uuid)[:11] }) }}
loop: '{{ molecule_yml.platforms }}'

- name: Destroy molecule instance(s)
Expand Down Expand Up @@ -55,65 +55,71 @@

- name: Get list of Load balancers
azure_rm_loadbalancer_facts:
resource_group: "{{ az_resource_group_name }}"
tags: "{{ vmss_tags[item.name] }}"
loop: "{{ molecule_yml.platforms }}"
resource_group: '{{ az_resource_group_name }}'
tags: '{{ vmss_tags[item.name] }}'
loop: '{{ molecule_yml.platforms }}'
register: lb_sets

- name: Destroy Load balancer resources
azure_rm_loadbalancer:
resource_group: "{{ az_resource_group_name }}"
location: "{{ az_location }}"
name: "{{ item.ansible_facts.azure_loadbalancers[0].name }}"
resource_group: '{{ az_resource_group_name }}'
location: '{{ az_location }}'
name: >-
{{ item.values() | map(attribute='azure_loadbalancers')
| select('defined') | list | first | map(attribute='name') | list | first }}
state: absent
register: lbs
loop: "{{ lb_sets.results }}"
loop: '{{ lb_sets.results }}'
loop_control:
label: "{{ item.item.name }}"
when: item.ansible_facts.azure_loadbalancers | length > 0
label: '{{ item.item.name }}'
when: (item.values() | map(attribute='azure_loadbalancers')
| select('defined') | list | first | length)
async: 7200
poll: 0

- name: Wait for LBs deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
jid: '{{ item.ansible_job_id }}'
when: item.ansible_job_id is defined
loop: "{{ lbs.results }}"
loop: '{{ lbs.results }}'
loop_control:
label: "{{ item.item.item.name }}"
label: '{{ item.item.item.name }}'
register: lbs_delete
until: lbs_delete.finished
delay: 10
retries: 300

- name: Get list of IPs
azure_rm_publicipaddress_facts:
resource_group: "{{ az_resource_group_name }}"
tags: "{{ vmss_tags[item.name] }}"
loop: "{{ molecule_yml.platforms }}"
resource_group: '{{ az_resource_group_name }}'
tags: '{{ vmss_tags[item.name] }}'
loop: '{{ molecule_yml.platforms }}'
register: ip_sets

- name: Destroy Public IP address resources
azure_rm_publicipaddress:
resource_group: "{{ az_resource_group_name }}"
location: "{{ az_location }}"
name: "{{ item.ansible_facts.azure_publicipaddresses[0].name }}"
resource_group: '{{ az_resource_group_name }}'
location: '{{ az_location }}'
name: >-
{{ item.values() | map(attribute='azure_publicipaddresses')
| select('defined') | list | first | map(attribute='name') | list | first }}
state: absent
register: ips
loop: "{{ ip_sets.results }}"
loop: '{{ ip_sets.results }}'
loop_control:
label: "{{ item.item.name }}"
when: item.ansible_facts.azure_publicipaddresses | length > 0
label: '{{ item.item.name }}'
when: (item.values() | map(attribute='azure_publicipaddresses')
| select('defined') | list | first | length)
async: 7200
poll: 0

- name: Wait for Public IP address resource deletion to complete
async_status:
jid: "{{ item.ansible_job_id }}"
jid: '{{ item.ansible_job_id }}'
when: item.ansible_job_id is defined
loop: "{{ ips.results }}"
loop: '{{ ips.results }}'
loop_control:
label: "{{ item.item.item.name }}"
label: '{{ item.item.item.name }}'
register: ip_delete
until: ip_delete.finished
delay: 10
Expand Down

0 comments on commit 31fe7c1

Please sign in to comment.