kayobe/roles/kayobe-diagnostics/tasks/post.yml

30 lines
804 B
YAML

---
- name: Write host variables to a file
copy:
content: "{{ hostvars[inventory_hostname] | to_nice_json }}"
dest: "{{ kayobe_diagnostics_log_dir }}/facts.json"
- name: Run diagnostics script
script: get_logs.sh
register: get_logs_result
become: true
failed_when: false
environment:
LOG_DIR: "{{ kayobe_diagnostics_log_dir }}"
CONFIG_DIR: "{{ kayobe_diagnostics_config_dir }}"
PREVIOUS_CONFIG_DIR: "{{ kayobe_diagnostics_previous_config_dir }}"
- name: Print get_logs.sh output
debug:
msg: "{{ get_logs_result.stdout }}"
- name: Download logs to executor
synchronize:
src: "{{ kayobe_diagnostics_log_dir }}/"
dest: "{{ kayobe_diagnostics_executor_log_dir }}/"
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- "--quiet"