
There are absolutely no substantive changes in this patch. Change-Id: Ia1f3cf005f272b269093348507db4e38735e20d3
88 lines
2.4 KiB
YAML
88 lines
2.4 KiB
YAML
---
|
|
- name: ensure hiera datadir
|
|
file:
|
|
state: directory
|
|
path: "{{ hieradata }}/{{ hieraenvironment }}"
|
|
owner: root
|
|
group: root
|
|
mode: 0700
|
|
when: copy_hieradata is defined and copy_hieradata
|
|
|
|
- name: ensure hiera datadir - fqdn
|
|
file:
|
|
state: directory
|
|
path: "{{ hieradata }}/{{ hieraenvironment }}/fqdn"
|
|
owner: root
|
|
group: root
|
|
mode: 0700
|
|
when: copy_hieradata is defined and copy_hieradata
|
|
|
|
- name: ensure hiera datadir - group
|
|
file:
|
|
state: directory
|
|
path: "{{ hieradata }}/{{ hieraenvironment }}/group"
|
|
owner: root
|
|
group: root
|
|
mode: 0700
|
|
when: copy_hieradata is defined and copy_hieradata
|
|
|
|
- name: make file list
|
|
puppet_get_hiera_file_list:
|
|
fqdn: "{{ ansible_fqdn }}"
|
|
groups: "{{ hostvars[inventory_hostname].group_names }}"
|
|
when: copy_hieradata is defined and copy_hieradata
|
|
delegate_to: localhost
|
|
register: hiera_file_paths
|
|
|
|
- name: find which files exist
|
|
stat:
|
|
path: "{{ hieradata }}/{{ hieraenvironment }}/{{ item }}"
|
|
register: st
|
|
with_items: hiera_file_paths.paths_dict.paths
|
|
delegate_to: localhost
|
|
when: copy_hieradata is defined and copy_hieradata
|
|
|
|
- name: copy hiera files
|
|
when: copy_hieradata is defined and copy_hieradata and item.1.stat.exists
|
|
copy:
|
|
src: "{{ hieradata }}/{{ hieraenvironment }}/{{ item.1.item }}"
|
|
dest: "{{ hieradata }}/{{ hieraenvironment }}/{{ item.1.item }}"
|
|
mode: 0600
|
|
with_together:
|
|
- hiera_file_paths.paths_dict.paths
|
|
- st.results
|
|
|
|
- name: run puppet
|
|
puppet:
|
|
puppetmaster: "{{ puppetmaster|default(omit) }}"
|
|
manifest: "{{ manifest|default(omit) }}"
|
|
show_diff: "{{ show_diff|default(false) }}"
|
|
facts: "{{ facts|default(omit) }}"
|
|
facter_basename: "{{ facter_basename|default(omit) }}"
|
|
|
|
- name: find logs
|
|
shell: "ls -tr /var/lib/puppet/reports/{{ ansible_fqdn }}/*_puppetdb.json"
|
|
register: files
|
|
when: puppetdb is defined
|
|
|
|
- name: set log filename
|
|
set_fact: puppet_logfile="{{ files.stdout_lines|sort|last }}"
|
|
when: puppetdb is defined
|
|
|
|
- name: fetch file
|
|
synchronize:
|
|
mode: pull
|
|
src: "{{ puppet_logfile }}"
|
|
dest: /var/lib/puppet/reports/{{ ansible_fqdn }}
|
|
when: puppetdb is defined
|
|
|
|
- name: post facts
|
|
puppet_post_puppetdb:
|
|
puppetdb: "{{ puppetdb }}"
|
|
hostvars: "{{ hostvars[inventory_hostname] }}"
|
|
logfile: "{{ puppet_logfile }}"
|
|
whoami: "{{ ansible_fqdn }}"
|
|
delegate_to: localhost
|
|
connection: local
|
|
when: puppetdb is defined
|