|
|
|
|
|
|
|
- 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|bools
|