matrix-docker-ansible-deploy/roles/matrix-awx/tasks/delete_server.yml

38 lines
1.1 KiB
YAML
Raw Normal View History

2021-08-18 15:07:44 +02:00
- name: Include hosting vars of digital_ocean.yml
2021-08-20 03:35:12 +02:00
delegate_to: 127.0.0.1
2021-08-18 15:07:44 +02:00
include_vars:
file: /var/lib/awx/projects/hosting/hosting_vars.yml
no_log: True
- name: Load vars from organisation.yml
2021-08-20 03:35:12 +02:00
delegate_to: 127.0.0.1
2021-08-18 15:07:44 +02:00
include_vars:
file: '/var/lib/awx/projects/clients/{{ member_id }}/organisation.yml'
- name: Load vars from server_vars.yml
2021-08-20 03:35:12 +02:00
delegate_to: 127.0.0.1
2021-08-18 15:07:44 +02:00
include_vars:
file: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/server_vars.yml'
ignore_errors: yes
- name: Remove existing Digital Ocean Droplet
2021-08-20 03:35:12 +02:00
delegate_to: 127.0.0.1
2021-08-18 15:07:44 +02:00
community.digitalocean.digital_ocean_droplet:
# needs ansible 2.8+ (AWX uses 2.9.10 at )
state: absent
id: '{{ do_droplet_id }}'
name: '{{ matrix_domain }}'
oauth_token: '{{ do_api_token }}'
size: '{{ slug_size }}'
region: '{{ do_droplet_region }}'
image: '{{ do_image }}'
wait: yes
unique_name: yes
register: deleted_server_info
when: do_droplet_id is defined
- debug:
msg: "{{ deleted_server_info }}"
when: do_droplet_id is defined