Files
awx/awx/playbooks/clean_isolated.yml

30 lines
768 B
YAML

---
# The following variables will be set by the runner of this playbook:
# cleanup_dirs: ['/tmp/path/private_data_dir/', '/tmp//path/proot_temp_dir/']
# private_data_dir: '/tmp/path/private_data_dir/'
- name: Clean up from isolated job run.
hosts: all
gather_facts: false
tasks:
- name: cancel the job
command: "awx-expect stop {{private_data_dir}}"
ignore_errors: yes
- name: remove build artifacts
file: path="{{item}}" state=absent
register: result
with_items: "{{cleanup_dirs}}"
until: result|succeeded
ignore_errors: yes
retries: 3
delay: 5
- name: fail if build artifacts were not cleaned
fail:
msg: 'Unable to cleanup build artifacts'
when: not result|succeeded