1
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2024-12-12 08:43:55 +02:00
matrix-docker-ansible-deploy/roles/matrix-awx/tasks/delete_server.yml
2021-08-20 09:35:12 +08:00

47 lines
1.2 KiB
YAML
Executable File

- name: Include hosting vars of digital_ocean.yml
delegate_to: 127.0.0.1
include_vars:
file: /var/lib/awx/projects/hosting/hosting_vars.yml
no_log: True
- name: Load vars from organisation.yml
delegate_to: 127.0.0.1
include_vars:
file: '/var/lib/awx/projects/clients/{{ member_id }}/organisation.yml'
- name: Load vars from server_vars.yml
delegate_to: 127.0.0.1
include_vars:
file: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/server_vars.yml'
ignore_errors: yes
- name: Remove existing Digital Ocean Droplet
delegate_to: 127.0.0.1
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
#- name: Delete fake DNS record for faster testing
# delegate_to: 127.0.0.1
# shell: |
# sed -i -c '/{{ matrix_domain }}/d' /etc/hosts
# Doesn't allow letsencrypt to generate certs :S