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

This commit is contained in:
Jenkins 2016-03-09 16:42:03 +00:00 committed by Gerrit Code Review
commit f20c52a44b
1 changed files with 4 additions and 0 deletions

View File

@ -71,16 +71,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:
@ -90,5 +93,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