---
- name: Set ansible log path
  set_fact:
    ansible_log_path: /var/log/ansible
  when: ansible_log_path is undefined

- name: "Check if {{ ansible_log_path }} directory exists"
  stat:
    path: "{{ ansible_log_path }}"
  register: ansible_log

- name: Copy ansible log files
  become: yes
  synchronize:
    src: "{{ ansible_log_path }}"
    dest: "{{ zuul.executor.log_root }}/controller/logs"
    mode: pull
  when: ansible_log.stat.exists
