mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-17 21:48:36 -05:00
30 lines
778 B
YAML
30 lines
778 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: "ansible-runner stop {{private_data_dir}}"
|
|
ignore_errors: yes
|
|
|
|
- name: remove build artifacts
|
|
file: path="{{item}}" state=absent
|
|
register: result
|
|
with_items: "{{cleanup_dirs}}"
|
|
until: result is 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 is succeeded
|