You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/legacy/roles/test_gcp_glb/tasks/teardown.yml

173 lines
5.3 KiB
YAML

# ============================================================
- name: Delete Global Forwarding Rule
# ============================================================
gcp_forwarding_rule:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
forwarding_rule_name: "{{ gfr }}"
target: "{{ targethttpproxy }}"
address: "{{ external_address_name }}"
port_range: 80
region: global
state: "absent"
register: result
ignore_errors: true
- name: "assert gfr absent"
assert:
that:
- 'result.state == "absent"'
- pause: seconds=5
# ============================================================
- name: Delete Static Address
# ============================================================
gce_eip:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: "{{ external_address_name }}"
region: global
state: "absent"
register: result
ignore_errors: true
- name: "assert static address absent"
assert:
that:
- 'result.changed'
- 'result.state == "absent"'
# ============================================================
- name: Delete TargetHTTPProxy
# ============================================================
gcp_target_proxy:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
target_proxy_name: "{{ targethttpproxy }}"
target_proxy_type: "HTTP"
url_map_name: "{{ urlmap }}"
state: "absent"
register: result
ignore_errors: true
- name: "assert targethttpproxy absent"
assert:
that:
- 'result.changed'
- 'result.state == "absent"'
- pause: seconds=5
# ============================================================
- name: Delete URLMap
# ============================================================
gcp_url_map:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
url_map_name: "{{ urlmap }}"
default_service: "{{ bes }}"
state: "absent"
register: result
ignore_errors: true
- name: "assert urlmap absent"
assert:
that:
- 'result.state == "absent"'
- pause: seconds=10
# ============================================================
- name: Delete BES
# ============================================================
gcp_backend_service:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
backend_service_name: "{{ bes }}"
backends:
- instance_group: "{{ mig_one }}"
- instance_group: "{{ mig_two }}"
healthchecks:
- "{{ bes_healthcheck }}"
port_name: "{{ http_port_name }}"
protocol: HTTP
timeout: 60
state: "absent"
register: result
- name: "assert backend service absent"
assert:
that:
# - 'result.changed'
- 'result.state == "absent"'
# ============================================================
- name: Delete Healthcheck
# ============================================================
gcp_healthcheck:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
healthcheck_name: "{{ bes_healthcheck }}"
healthcheck_type: "HTTP"
state: "absent"
- name: "assert healthcheck absent"
assert:
that:
- 'result.state == "absent"'
# ============================================================
- name: Delete MIG one
# ============================================================
gce_mig:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: "{{ mig_one }}"
zone: "{{ mig_one_zone }}"
state: "absent"
size: 1
template: "{{ instance_template }}"
named_ports:
- name: "{{ http_port_name }}"
port: "{{ http_port }}"
autoscaling:
enabled: yes
name: "{{ mig_one }}"
policy:
min_instances: 2
max_instances: 10
cool_down_period: 30
cpu_utilization:
target: 0.02
# ============================================================
- name: Delete MIG two
# ============================================================
gce_mig:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: "{{ mig_two }}"
zone: "{{ mig_two_zone }}"
state: "absent"
size: 1
template: "{{ instance_template }}"
named_ports:
- name: "{{ http_port_name }}"
port: "{{ http_port }}"
autoscaling:
enabled: yes
name: "{{ mig_two }}"
policy:
min_instances: 2
max_instances: 10
cool_down_period: 30
cpu_utilization:
target: 0.02
- pause: seconds=30
# ============================================================
- name: Delete Instance template
# ============================================================
gce_instance_template:
service_account_email: "{{ service_account_email }}"
credentials_file: "{{ credentials_file }}"
project_id: "{{ project_id }}"
name: "{{ instance_template }}"
image: rhel-7-v20170426
state: "absent"
tags:
- http-server