Skip to content

Commit

Permalink
gather-logs - parameterize the logs to collect (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
itewk authored Apr 5, 2018
1 parent 65a94d6 commit 50b952a
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions playbooks/gather-logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
hosts: all
gather_facts: True
tasks:
- name: CFME | Gather Logs | Set logs to gather
set_fact:
cfme_gather_logs_list:
- evm.log
- automation.log
- top_output.log
when: cfme_gather_logs_list is not defined

- name: CFME | Gather Logs | Set destination host
set_fact:
cfme_gather_logs_destination_host: "{{ groups['cfme-databases'][0] }}"
Expand Down Expand Up @@ -46,9 +54,7 @@
src: "/var/www/miq/vmdb/log/{{ item }}"
dest: "{{ cfme_gather_logs_destination_dir }}/{{ item }}-{{ inventory_hostname }}"
delegate_to: "{{ cfme_gather_logs_destination_host }}"
with_items:
- evm.log
- automation.log
with_items: "{{ cfme_gather_logs_list }}"

- name: CFME | Gather Logs | Create archive
archive:
Expand All @@ -57,6 +63,12 @@
run_once: True
delegate_to: "{{ cfme_gather_logs_destination_host }}"

- name: CFME | Gather Logs | Archive location
debug:
msg: "{{ cfme_gather_logs_destination_dir }}.tgz"
run_once: True
delegate_to: "{{ cfme_gather_logs_destination_host }}"

- name: CFME | Gather Logs | Send email with logs attached
mail:
host: "{{ cfme_gather_logs_smtp_host }}"
Expand All @@ -74,6 +86,7 @@
- "cfme_gather_logs_smtp_port is defined"
- "cfme_gather_logs_email_from is defined"
- "cfme_gather_logs_email_to is defined"
ignore_errors: True

- name: CFME | Gather Logs | Delete destination directory
file:
Expand Down

0 comments on commit 50b952a

Please sign in to comment.