matrix-docker-ansible-deploy/roles/matrix-awx/tasks/delete_awx_templates.yml
2021-08-24 18:35:00 +08:00

309 lines
10 KiB
YAML
Executable file

- 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