mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-29 19:31:48 -05:00
kubectl and synchronize are now part of community.kubernetes and ansible.posix collections, respectively. This change installs these collections to a local directory to be used in inventory and isolated management playbooks. awx issue #6930
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
---
|
|
# The following variables will be set by the runner of this playbook:
|
|
# src: /tmp/some/path/private_data_dir/
|
|
|
|
- name: Poll for status of active job.
|
|
hosts: all
|
|
gather_facts: false
|
|
collections:
|
|
- ansible.posix
|
|
|
|
tasks:
|
|
|
|
- name: Determine if daemon process is alive.
|
|
shell: "ansible-runner is-alive {{src}}"
|
|
register: is_alive
|
|
ignore_errors: true
|
|
|
|
- name: Copy artifacts from the isolated host.
|
|
synchronize:
|
|
src: "{{src}}/artifacts/"
|
|
dest: "{{src}}/artifacts/"
|
|
mode: pull
|
|
delete: true
|
|
recursive: true
|
|
when: ansible_kubectl_config is not defined
|
|
|
|
- name: Copy daemon log from the isolated host
|
|
synchronize:
|
|
src: "{{src}}/daemon.log"
|
|
dest: "{{src}}/daemon.log"
|
|
mode: pull
|
|
when: ansible_kubectl_config is not defined
|
|
|
|
- name: Copy artifacts from pod
|
|
synchronize:
|
|
src: "{{src}}/artifacts/"
|
|
dest: "{{src}}/artifacts/"
|
|
mode: pull
|
|
delete: true
|
|
recursive: true
|
|
set_remote_user: false
|
|
rsync_opts:
|
|
- "--blocking-io"
|
|
- "--rsh=$RSH"
|
|
environment:
|
|
RSH: "oc rsh --config={{ ansible_kubectl_config }}"
|
|
delegate_to: localhost
|
|
when: ansible_kubectl_config is defined
|
|
|
|
- name: Copy daemon log from pod
|
|
synchronize:
|
|
src: "{{src}}/daemon.log"
|
|
dest: "{{src}}/daemon.log"
|
|
mode: pull
|
|
set_remote_user: false
|
|
rsync_opts:
|
|
- "--blocking-io"
|
|
- "--rsh=$RSH"
|
|
environment:
|
|
RSH: "oc rsh --config={{ ansible_kubectl_config }}"
|
|
delegate_to: localhost
|
|
when: ansible_kubectl_config is defined
|
|
|
|
- name: Fail if previous check determined that process is not alive.
|
|
fail:
|
|
msg: "isolated task is still running"
|
|
when: "is_alive.rc == 0"
|