<commit_before>- hosts: all
  become: True
  vars:
    devstack_log_dir: "{{ devstack_base_dir|default('/opt/stack') }}/logs/"
    devstack_conf_dir: "{{ devstack_base_dir|default('/opt/stack') }}/devstack/"
    devstack_full_log: "{{ devstack_early_log|default('/opt/stack/logs/devstack-early.txt') }}"
  tasks:
    # NOTE(andreaf) If the tempest service is enabled, a tempest.log is
    # generated as part of lib/tempest, as a result of verify_tempest_config
    - name: Check if a tempest log exits
      stat:
        path: "{{ devstack_conf_dir }}/tempest.log"
      register: tempest_log
    - name: Link post-devstack tempest.log
      file:
        src: "{{ devstack_conf_dir }}/tempest.log"
        dest: "{{ stage_dir }}/verify_tempest_conf.log"
        state: hard
      when: tempest_log.stat.exists
  roles:
    - export-devstack-journal
    - apache-logs-conf
    - devstack-project-conf
    - role: stage-output
      zuul_copy_output:
        { '{{ devstack_conf_dir }}/local.conf': 'logs',
          '{{ devstack_conf_dir }}/localrc': 'logs',
          '{{ devstack_conf_dir }}/.stackenv': 'logs' ,
          '{{ devstack_log_dir }}/dstat-csv.log': 'logs',
          '{{ devstack_log_dir }}/devstacklog.txt': 'logs',
          '{{ devstack_log_dir }}/devstacklog.txt.summary': 'logs',
          '{{ devstack_full_log}}': 'logs',
          '{{ stage_dir }}/verify_tempest_conf.log': 'logs',
          '{{ stage_dir }}/apache': 'logs',
          '{{ stage_dir }}/apache_config': 'logs',
          '{{ stage_dir }}/etc': 'logs',
          '/var/log/rabbitmq': 'logs',
          '/var/log/postgresql': 'logs',
          '/var/log/mysql.err': 'logs',
          '/var/log/mysql.log': 'logs',
          '/var/log/libvirt': 'logs',
          '/etc/sudoers': 'logs',
          '/etc/sudoers.d': 'logs' }
      extensions_to_txt:
        - conf
        - log
        - localrc
        - summary
    # NOTE(andreaf) We need fetch-devstack-log-dir only as long as the base job
    # starts pulling logs for us from {{ ansible_user_dir }}/logs.
    # Meanwhile we already store things in ansible_user_dir and use
    # fetch-devstack-log-dir setting devstack_base_dir
    - role: fetch-devstack-log-dir
      devstack_base_dir: "{{ ansible_user_dir }}"<commit_msg>Make stackenv file visible<commit_after>- hosts: all
  become: True
  vars:
    devstack_log_dir: "{{ devstack_base_dir|default('/opt/stack') }}/logs/"
    devstack_conf_dir: "{{ devstack_base_dir|default('/opt/stack') }}/devstack/"
    devstack_full_log: "{{ devstack_early_log|default('/opt/stack/logs/devstack-early.txt') }}"
  tasks:
    # NOTE(andreaf) If the tempest service is enabled, a tempest.log is
    # generated as part of lib/tempest, as a result of verify_tempest_config
    - name: Check if a tempest log exits
      stat:
        path: "{{ devstack_conf_dir }}/tempest.log"
      register: tempest_log
    - name: Link post-devstack tempest.log
      file:
        src: "{{ devstack_conf_dir }}/tempest.log"
        dest: "{{ stage_dir }}/verify_tempest_conf.log"
        state: hard
      when: tempest_log.stat.exists
  roles:
    - export-devstack-journal
    - apache-logs-conf
    - devstack-project-conf
    - role: stage-output
      zuul_copy_output:
        { '{{ devstack_conf_dir }}/local.conf': 'logs',
          '{{ devstack_conf_dir }}/localrc': 'logs',
          '{{ devstack_conf_dir }}/.stackenv': 'logs' ,
          '{{ devstack_log_dir }}/dstat-csv.log': 'logs',
          '{{ devstack_log_dir }}/devstacklog.txt': 'logs',
          '{{ devstack_log_dir }}/devstacklog.txt.summary': 'logs',
          '{{ devstack_full_log}}': 'logs',
          '{{ stage_dir }}/verify_tempest_conf.log': 'logs',
          '{{ stage_dir }}/apache': 'logs',
          '{{ stage_dir }}/apache_config': 'logs',
          '{{ stage_dir }}/etc': 'logs',
          '/var/log/rabbitmq': 'logs',
          '/var/log/postgresql': 'logs',
          '/var/log/mysql.err': 'logs',
          '/var/log/mysql.log': 'logs',
          '/var/log/libvirt': 'logs',
          '/etc/sudoers': 'logs',
          '/etc/sudoers.d': 'logs' }
      extensions_to_txt:
        - conf
        - log
        - localrc
        - stackenv
        - summary
    # NOTE(andreaf) We need fetch-devstack-log-dir only as long as the base job
    # starts pulling logs for us from {{ ansible_user_dir }}/logs.
    # Meanwhile we already store things in ansible_user_dir and use
    # fetch-devstack-log-dir setting devstack_base_dir
    - role: fetch-devstack-log-dir
      devstack_base_dir: "{{ ansible_user_dir }}"