remove delete subscription section
This commit is contained in:
parent
463e9a6196
commit
6ecd947c72
|
@ -1,271 +0,0 @@
|
|||
|
||||
- name: Install jq in AWX
|
||||
delegate_to: 127.0.0.1
|
||||
yum:
|
||||
name: jq
|
||||
state: latest
|
||||
when: cancel_deletion|bool
|
||||
|
||||
- name: Collect AWX admin token the hard way!
|
||||
delegate_to: 127.0.0.1
|
||||
shell: |
|
||||
curl -sku {{ tower_username }}:{{ tower_password }} -H "Content-Type: application/json" -X POST -d '{"description":"Tower CLI", "application":null, "scope":"write"}' https://{{ tower_host }}/api/v2/users/1/personal_tokens/ | jq '.token' | sed -r 's/\"//g'
|
||||
when: cancel_deletion|bool
|
||||
register: tower_token
|
||||
no_log: True
|
||||
|
||||
- name: Remove schedule for '<< SUBSCRIPTION DELETION IN PROGRESS >>' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_schedule:
|
||||
name: "{{ subscription_id }} - << SUBSCRIPTION DELETION IN PROGRESS >>"
|
||||
enabled: yes
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: cancel_deletion|bool
|
||||
|
||||
- name: Grant execute permission on 'Deploy/Update a Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 0 - Deploy/Update a Server"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Backup Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 0 - Backup Server"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Self-Check' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 0 - Self-Check"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Start/Restart all Services' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 0 - Start/Restart all Services"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Stop all Services' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 0 - Stop all Services"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Corporal (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Corporal (Advanced)"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Dimension' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Dimension"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Element' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Element"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Element Subdomain' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Element Subdomain"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Email Relay' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Email Relay"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Jitsi' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Jitsi"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure ma1sd (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure ma1sd (Advanced)"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Synapse' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Synapse"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Configure Synapse Admin' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 1 - Configure Synapse Admin"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Create User' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 2 - Create User"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Purge Media (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 2 - Purge Media (Advanced)"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Grant execute permission on 'Purge Database (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_role:
|
||||
team: "{{ member_id }}"
|
||||
job_template: "{{ matrix_domain }} - 2 - Purge Database (Advanced)"
|
||||
role: execute
|
||||
state: present
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: (matrix_domain is defined) and (cancel_deletion|bool)
|
||||
|
||||
- name: Save new 'Delete Job Template' survey.json to the AWX tower, template
|
||||
delegate_to: 127.0.0.1
|
||||
template:
|
||||
src: '{{ role_path }}/templates/delete_job_template.json.j2'
|
||||
dest: '/var/lib/awx/projects/hosting/delete_job_template.json'
|
||||
when: cancel_deletion|bool
|
||||
|
||||
- name: Re-create '00 - Cleanup Deletion Template' job template
|
||||
awx.awx.tower_job_template:
|
||||
name: "00 - Cleanup Deletion Template"
|
||||
description: "Deletes the remaining '<< SUBSCRIPTION DELETION IN PROGRESS >>' job template."
|
||||
job_type: run
|
||||
inventory: "{{ org_name }} [Admin]"
|
||||
project: "Ansible Create Delete Subscription Membership"
|
||||
playbook: cleanup_deletion_job_template.yml
|
||||
extra_vars: "{{ lookup('file', '/var/lib/awx/projects/hosting/delete_job_template.json') }}"
|
||||
ask_extra_vars: yes
|
||||
state: present
|
||||
verbosity: 1
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: cancel_deletion|bool
|
||||
|
||||
- name: Launch '00 - Cleanup Deletion Template' job template before ending
|
||||
awx.awx.tower_job_launch:
|
||||
job_template: "00 - Cleanup Deletion Template"
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: cancel_deletion|bool
|
||||
|
||||
- name: Set boolean value to exit playbook
|
||||
set_fact:
|
||||
end_playbook: true
|
||||
when: cancel_deletion|bool
|
||||
|
||||
- name: End playbook if this task list is called.
|
||||
meta: end_play
|
||||
when: (end_playbook is defined) and end_playbook|bool and cancel_deletion|bool
|
|
@ -1,308 +0,0 @@
|
|||
|
||||
- name: Install jq in AWX
|
||||
delegate_to: 127.0.0.1
|
||||
yum:
|
||||
name: jq
|
||||
state: latest
|
||||
|
||||
- name: Collect AWX admin token the hard way!
|
||||
delegate_to: 127.0.0.1
|
||||
shell: |
|
||||
curl -sku {{ tower_username }}:{{ tower_password }} -H "Content-Type: application/json" -X POST -d '{"description":"Tower CLI", "application":null, "scope":"write"}' https://{{ tower_host }}/api/v2/users/1/personal_tokens/ | jq '.token' | sed -r 's/\"//g'
|
||||
register: tower_token
|
||||
no_log: True
|
||||
|
||||
- name: Remove original 'Provision Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "0 - {{ subscription_id }} - Provision a New Server"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
|
||||
- name: Remove 'Provision Wireguard Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "0 - {{ subscription_id }} - Provision Wireguard Server"
|
||||
job_type: run
|
||||
project: "Ansible Create Delete Subscription Membership"
|
||||
playbook: setup_wireguard_server.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
|
||||
- name: Remove schedule for 'Deploy a New Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_schedule:
|
||||
name: "{{ matrix_domain }} - 0 - Update Server Schedule"
|
||||
enabled: yes
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Backup Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 0 - Backup Server"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Export Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 0 - Export Server"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Deploy/Update a Server' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 0 - Deploy/Update a Server"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Self-Check' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 0 - Self-Check"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Start/Restart all Services' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 0 - Start/Restart all Services"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Stop all Services' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 0 - Stop all Services"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Corporal (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Corporal (Advanced)"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Dimension' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Dimension"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Element' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Element"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Element Subdomain' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Element Subdomain"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Email Relay' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Email Relay"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Jitsi' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Jitsi"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure ma1sd (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure ma1sd (Advanced)"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Synapse' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Synapse"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Synapse Admin' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Synapse Admin"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Access Export' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Access Export"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Configure Website + Access Export' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 1 - Configure Website + Access Export"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Create User' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 2 - Create User"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Purge Media (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 2 - Purge Media (Advanced)"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
||||
|
||||
- name: Remove 'Purge Database (Advanced)' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "{{ matrix_domain }} - 2 - Purge Database (Advanced)"
|
||||
job_type: run
|
||||
project: "{{ member_id }} - Matrix Docker Ansible Deploy"
|
||||
playbook: setup.yml
|
||||
state: absent
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
when: matrix_domain is defined
|
|
@ -1,22 +0,0 @@
|
|||
|
||||
- name: Include matrix server variables from matrix_vars.yml
|
||||
delegate_to: 127.0.0.1
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- files:
|
||||
- /var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/matrix_vars.yml
|
||||
skip: true
|
||||
no_log: True
|
||||
|
||||
- name: Install curl in AWX
|
||||
delegate_to: 127.0.0.1
|
||||
yum:
|
||||
name: curl
|
||||
state: latest
|
||||
|
||||
- name: Delete MailGun SMTP login
|
||||
delegate_to: 127.0.0.1
|
||||
shell: |
|
||||
curl -s --user 'api:{{ mg_private_api_key }}' -X DELETE https://{{ mg_api_url }}/v3/domains/{{ mg_sender_domain }}/credentials/{{ matrix_domain }}
|
||||
when: matrix_domain is defined
|
||||
no_log: True
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
- 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
|
|
@ -1,45 +0,0 @@
|
|||
|
||||
- name: Delete the servers directory on AWX
|
||||
delegate_to: 127.0.0.1
|
||||
file:
|
||||
path: '/var/lib/awx/projects/clients/{{ member_id }}/{{ subscription_id }}/'
|
||||
state: absent
|
||||
|
||||
- name: Save new 'Delete Job Template' survey.json to the AWX tower, template
|
||||
delegate_to: 127.0.0.1
|
||||
template:
|
||||
src: '{{ role_path }}/templates/cleanup_deletion_template.json.j2'
|
||||
dest: '/var/lib/awx/projects/hosting/cleanup_deletion_template.json'
|
||||
|
||||
- name: Re-create '00 - Cleanup Deletion Template' job template
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_template:
|
||||
name: "00 - Cleanup Deletion Template"
|
||||
description: "Deletes the remaining '<< SUBSCRIPTION DELETION IN PROGRESS >>' job template."
|
||||
job_type: run
|
||||
inventory: "{{ org_name }} [Admin]"
|
||||
project: "Ansible Create Delete Subscription Membership"
|
||||
playbook: cleanup_deletion_job_template.yml
|
||||
extra_vars: "{{ lookup('file', '/var/lib/awx/projects/hosting/cleanup_deletion_template.json') }}"
|
||||
ask_extra_vars: yes
|
||||
state: present
|
||||
verbosity: 1
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
|
||||
- name: Launch '00 - Cleanup Deletion Template' job template before ending
|
||||
delegate_to: 127.0.0.1
|
||||
awx.awx.tower_job_launch:
|
||||
job_template: "00 - Cleanup Deletion Template"
|
||||
tower_host: "https://{{ tower_host }}"
|
||||
tower_oauthtoken: "{{ tower_token.stdout }}"
|
||||
validate_certs: yes
|
||||
|
||||
- name: Set boolean value to exit playbook
|
||||
set_fact:
|
||||
end_playbook: true
|
||||
|
||||
- name: End playbook if this task list is called.
|
||||
meta: end_play
|
||||
when: end_playbook is defined and end_playbook|bool
|
|
@ -26,51 +26,6 @@
|
|||
tags:
|
||||
- backup-server
|
||||
|
||||
# Abort Subscription Deletion
|
||||
- include_tasks:
|
||||
file: "abort_deletion.yml"
|
||||
apply:
|
||||
tags: delete-subscription
|
||||
when: run_setup|bool and matrix_awx_enabled|bool
|
||||
tags:
|
||||
- delete-subscription
|
||||
|
||||
# Delete DigitalOcean Droplet/Space
|
||||
- include_tasks:
|
||||
file: "delete_server.yml"
|
||||
apply:
|
||||
tags: delete-subscription
|
||||
when: run_setup|bool and matrix_awx_enabled|bool
|
||||
tags:
|
||||
- delete-subscription
|
||||
|
||||
# Delete MailGun SMTP Account
|
||||
- include_tasks:
|
||||
file: "delete_mailgun.yml"
|
||||
apply:
|
||||
tags: delete-subscription
|
||||
when: run_setup|bool and matrix_awx_enabled|bool
|
||||
tags:
|
||||
- delete-subscription
|
||||
|
||||
# Delete AWX Job Templates for Server
|
||||
- include_tasks:
|
||||
file: "delete_awx_templates.yml"
|
||||
apply:
|
||||
tags: delete-subscription
|
||||
when: run_setup|bool and matrix_awx_enabled|bool
|
||||
tags:
|
||||
- delete-subscription
|
||||
|
||||
# Delete Organisation Directories
|
||||
- include_tasks:
|
||||
file: "delete_subscription_directory.yml"
|
||||
apply:
|
||||
tags: delete-subscription
|
||||
when: run_setup|bool and matrix_awx_enabled|bool
|
||||
tags:
|
||||
- delete-subscription
|
||||
|
||||
# Perform a export of the server
|
||||
- include_tasks:
|
||||
file: "export_server.yml"
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"matrix_domain": "{{ matrix_domain }}",
|
||||
"subscription_id": "{{ subscription_id }}",
|
||||
"member_id": "{{ member_id }}"
|
||||
}
|
Loading…
Reference in a new issue