Don't post reports if there are no reports to post

If we don't produce any reports, don't post them.

Change-Id: I06f0bf47a1761f90118ad45a99e33f112699a4c7
This commit is contained in:
Monty Taylor 2016-03-09 10:23:45 -06:00
parent 403053534b
commit 3408a8f0f5
1 changed files with 4 additions and 0 deletions

View File

@ -70,16 +70,19 @@
- name: set log filename
set_fact: puppet_logfile="{{ files.stdout_lines|sort|last }}"
when: "{{ files.stdout_lines|length > 0 }}"
- name: create reports directory
file: path=/var/lib/puppet/reports/{{ ansible_fqdn }} owner=root group=root mode=0755 state=directory
delegate_to: localhost
when: "{{ files.stdout_lines|length > 0 }}"
- name: fetch file
synchronize:
mode: pull
src: "{{ puppet_logfile }}"
dest: /var/lib/puppet/reports/{{ ansible_fqdn }}
when: "{{ files.stdout_lines|length > 0 }}"
- name: post facts
puppet_post_puppetdb:
@ -89,5 +92,6 @@
whoami: "{{ puppet_report_as }}"
delegate_to: localhost
connection: local
when: "{{ files.stdout_lines|length > 0 }}"
when: puppetdb is defined and puppet_report_as is defined