ansible-role-collect-logs/infrared_plugin/main.yml
Martin Kopec 01ad1bb5e9 Add missing artcl_publish in infrared plugin
The patch adds a missing artcl_publish condition in the infrared
plugin definition - infrared_plugin/main.yml. The var is used to
controll publishing part of the role.

Change-Id: I138f9d892b8058ae3f7b2e69eb9fd335de9e7367
2020-07-03 18:44:17 +00:00

66 lines
1.9 KiB
YAML

---
# This file and plugin.spec are required by Infrared project
# This section collects data from the nodes
- hosts: "{{ other.openstack_nodes }}"
remote_user: "{{ other.remote_user }}"
ignore_errors: true
tasks:
- name: Remap infrared parameters to role variables
set_fact:
"{{ item.key }}": "{{ item.value }}"
with_dict: "{{ other }}"
- name: Ansible role collect logs
include_role:
name: ansible-role-collect-logs
# This section takes care of preparing the collected data for publishing
# and for publishing itself
- hosts: localhost
ignore_errors: true
tasks:
- name: Remap infrared parameters to role variables
set_fact:
"{{ item.key }}": "{{ item.value }}"
with_dict: "{{ other }}"
- name: Disable artcl_collect to prepare for publishing
set_fact:
# override artcl_collect to false because in ansible-role-collect-logs
# role collect and publish tasks are complementary
artcl_collect: false
when: artcl_publish|default(false)|bool
- name: Set path to a report server key
set_fact:
artcl_report_server_key: "-i {{ artcl_report_server_key }}"
when: artcl_report_server_key is defined
- name: Extract the logs
shell: |
cat *.tar | tar xf - -i
args:
chdir: "{{ artcl_collect_dir }}"
executable: /bin/bash
- name: delete the tar file after extraction
shell: |
rm -r *.tar
args:
chdir: "{{ artcl_collect_dir }}"
executable: /bin/bash
- name: Ansible role collect logs
include_role:
name: ansible-role-collect-logs
when: artcl_publish|default(false)|bool
- name: Delete artifact files from localhost
file:
state: absent
path: "{{ artcl_collect_dir }}"
when: not disable_artifacts_cleanup | default(false) | bool