Clear up some issues with fqdm vs. hostname

When we're using openstack inventory, inventory_hostname is the uuid of
the openstack server, whereas ansible_fqdn is the actual fqdn of the
host. So for things where it's important that the variable resolve to
the hostname (like looking up puppet reports on disk, we need to use
nsible_fqdn). For things like looking up hostvars in the hostvars dict,
we nede to continue using inventory_hostname.

Further, when we _delegate_to_ like we do for the post-to-puppetdb step,
ansible_fqdn is the name of the host delegated to - so it's not needed
to pass in the whoami value.

Change-Id: I420112668a016988ddb397e798f6ba983291d2f8
This commit is contained in:
Monty Taylor 2015-12-01 10:15:20 -06:00
parent f8c70cb1f2
commit f23f6d6d98

View File

@ -25,7 +25,7 @@
when: copy_hieradata is defined and copy_hieradata
- name: make file list
puppet_get_hiera_file_list:
fqdn: "{{ inventory_hostname }}"
fqdn: "{{ ansible_fqdn }}"
groups: "{{ hostvars[inventory_hostname].group_names }}"
when: copy_hieradata is defined and copy_hieradata
delegate_to: localhost
@ -54,7 +54,7 @@
facts: "{{ facts|default(omit) }}"
facter_basename: "{{ facter_basename|default(omit) }}"
- name: find logs
shell: "ls -tr /var/lib/puppet/reports/{{ inventory_hostname }}/*_puppetdb.json"
shell: "ls -tr /var/lib/puppet/reports/{{ ansible_fqdn }}/*_puppetdb.json"
register: files
when: puppetdb is defined
- name: set log filename
@ -64,14 +64,14 @@
synchronize:
mode: pull
src: "{{ puppet_logfile }}"
dest: /var/lib/puppet/reports/{{ inventory_hostname }}
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: "{{ whoami }}"
whoami: "{{ ansible_fqdn }}"
delegate_to: localhost
connection: local
when: puppetdb is defined