Change ansible_fqdn to inventory_hostname. This fixes some few hosts that have incorrect reverse dns

and shouldn't break any others since we always use fully qualified in our inventory.
This commit is contained in:
Kevin Fenzi 2016-05-11 15:08:50 +00:00
parent bc159045c8
commit a32f8b9e4a
19 changed files with 31 additions and 33 deletions

View file

@ -86,8 +86,8 @@
- services
- name: Check for pending updates
# script: {{ scripts }}/needs-updates --host {{ ansible_fqdn }}
script: needs-updates --host {{ ansible_fqdn }}
# script: {{ scripts }}/needs-updates --host {{ inventory_hostname }}
script: needs-updates --host {{ inventory_hostname }}
register: list_update
delegate_to: 127.0.0.1
changed_when: False
@ -215,7 +215,7 @@
- selinux
- name: resolve last persisted dir - if one is present
local_action: shell ls -d -1 {{datadir_prfx_path}}/{{ansible_fqdn}}-* 2>/dev/null | sort -r | head -1
local_action: shell ls -d -1 {{datadir_prfx_path}}/{{inventory_hostname}}-* 2>/dev/null | sort -r | head -1
register: last_dir
changed_when: False
ignore_errors: True
@ -231,17 +231,17 @@
changed_when: False
- name: create persisting-state directory
local_action: file path=/{{datadir_prfx_path}}/{{ansible_fqdn}}-{{timestamp.stdout}} state=directory
local_action: file path=/{{datadir_prfx_path}}/{{inventory_hostname}}-{{timestamp.stdout}} state=directory
changed_when: False
- name: fetch file list
fetch: src={{item}} dest=/{{datadir_prfx_path}}/{{ansible_fqdn}}-{{timestamp.stdout}}/ flat=true
fetch: src={{item}} dest=/{{datadir_prfx_path}}/{{inventory_hostname}}-{{timestamp.stdout}}/ flat=true
with_items: file_list.stdout_lines
changed_when: False
- name: diff the new files with last ones presisted
local_action: shell for file in {{datadir_prfx_path}}/{{ansible_fqdn}}-{{timestamp.stdout}}/*; do filename=$(basename $file); diff {{datadir_prfx_path}}/{{ansible_fqdn}}-{{timestamp.stdout}}/$filename {{last_dir.stdout.strip(':')}}/$filename; done
local_action: shell for file in {{datadir_prfx_path}}/{{inventory_hostname}}-{{timestamp.stdout}}/*; do filename=$(basename $file); diff {{datadir_prfx_path}}/{{inventory_hostname}}-{{timestamp.stdout}}/$filename {{last_dir.stdout.strip(':')}}/$filename; done
ignore_errors: True
changed_when: False
register: file_diff

View file

@ -88,7 +88,7 @@
- name: fedmsg certs
copy: >
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}.crt"
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}.crt"
dest=/etc/pki/fedmsg/
mode=644
owner={{item['owner']}}
@ -102,7 +102,7 @@
- name: fedmsg keys
copy: >
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}.key"
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}.key"
dest=/etc/pki/fedmsg/
mode=0640
owner={{item['owner']}}

View file

@ -10,7 +10,7 @@
copy: src={{ item }} dest=/etc/resolv.conf
with_first_found:
- "{{ resolvconf }}"
- resolv.conf/{{ ansible_fqdn }}
- resolv.conf/{{ inventory_hostname }}
- resolv.conf/{{ host_group }}
- resolv.conf/{{ datacenter }}
- resolv.conf/resolv.conf
@ -98,7 +98,7 @@
copy: src={{ item }} dest=/etc/ssh/sshd_config mode=600
with_first_found:
- "{{ sshd_config }}"
- ssh/sshd_config.{{ ansible_fqdn }}
- ssh/sshd_config.{{ inventory_hostname }}
- ssh/sshd_config.{{ host_group }}
- ssh/sshd_config.{{ dist_tag }}
- ssh/sshd_config.{{ ansible_distribution }}
@ -191,7 +191,7 @@
template: src={{ item }} dest=/etc/sysconfig/iptables mode=600 validate="/sbin/iptables-restore --text %s"
with_first_found:
- iptables/iptables.{{ datacenter }}
- iptables/iptables.{{ ansible_fqdn }}
- iptables/iptables.{{ inventory_hostname }}
- iptables/iptables.{{ host_group }}
- iptables/iptables.{{ env }}
- iptables/iptables
@ -215,7 +215,7 @@
template: src={{ item }} dest=/etc/sysconfig/ip6tables mode=600 backup=yes
with_first_found:
- iptables/ip6tables.{{ datacenter }}
- iptables/ip6tables.{{ ansible_fqdn }}
- iptables/ip6tables.{{ inventory_hostname }}
- iptables/ip6tables.{{ host_group }}
- iptables/ip6tables.{{ env }}
- iptables/ip6tables
@ -249,7 +249,7 @@
- name: rsyslog.conf
copy: src={{ item }} dest=/etc/rsyslog.conf mode=644
with_first_found:
- rsyslog/rsyslog.conf.{{ ansible_fqdn }}
- rsyslog/rsyslog.conf.{{ inventory_hostname }}
- rsyslog/rsyslog.conf.{{ dist_tag }}
- rsyslog/rsyslog.conf.default
notify:

View file

@ -2,7 +2,7 @@
copy: src={{ item }} dest=/etc/postfix/main.cf
with_first_found:
- "{{ postfix_maincf }}"
- "postfix/main.cf/main.cf.{{ ansible_fqdn }}"
- "postfix/main.cf/main.cf.{{ inventory_hostname }}"
- "postfix/main.cf/main.cf.{{ host_group }}"
- "postfix/main.cf/main.cf.{{ postfix_group }}"
- "postfix/main.cf/main.cf.{{ datacenter }}"
@ -18,7 +18,6 @@
copy: src={{ item }} dest=/etc/postfix/master.cf mode=0644
with_first_found:
- "{{ postfix_mastercf }}"
- "postfix/master.cf/master.cf.{{ ansible_fqdn }}"
- "postfix/master.cf/master.cf.{{ inventory_hostname }}"
- "postfix/master.cf/master.cf.{{ host_group }}"
- "postfix/master.cf/master.cf.{{ postfix_group }}"

View file

@ -1,3 +1,3 @@
<Plugin exec>
Exec "nobody" "/usr/local/bin/collectd-postgres.sh" "-h" "{{ ansible_fqdn }}" "-p" "10"
Exec "nobody" "/usr/local/bin/collectd-postgres.sh" "-h" "{{ inventory_hostname }}" "-p" "10"
</Plugin>

View file

@ -23,7 +23,7 @@ http:
# Cert information to place certificate files on system
cert:
dest_dir: "/etc/pki/docker/{{ ansible_fqdn }}{{ http.addr }}"
dest_dir: "/etc/pki/docker/{{ inventory_hostname }}{{ http.addr }}"
cert_src: "ca.crt"
cert_dest: "ca.crt"
key_src: "ca.key"

View file

@ -50,7 +50,7 @@
- name: setup /etc/fas.conf for client use
template: src={{ item }} dest=/etc/fas.conf owner=root mode=600
with_first_found:
- ../templates/{{ ansible_fqdn }}.fas.conf.j2
- ../templates/{{ inventory_hostname }}.fas.conf.j2
- ../templates/{{ ansible_hostname }}.fas.conf.j2
- ../templates/{{ ansible_hostname }}.fas.conf.j2
- ../templates/fas.conf.j2

View file

@ -258,7 +258,7 @@
- name: fedmsg certs
copy: >
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}.crt"
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}.crt"
dest=/etc/pki/fedmsg/
mode=644
owner={{item['owner']}}
@ -272,7 +272,7 @@
- name: fedmsg keys
copy: >
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}.key"
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}.key"
dest=/etc/pki/fedmsg/
mode=0640
owner={{item['owner']}}

View file

@ -15,7 +15,7 @@ config = dict(
# This is the set of certs for this host, dynamically generated from the
# ``fedmsg_certs`` host vars
{% for cert in fedmsg_certs %}
("{{cert.get('alias', cert['service'])}}.{{inventory_hostname_short}}", "{{cert['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}"),
("{{cert.get('alias', cert['service'])}}.{{inventory_hostname_short}}", "{{cert['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}"),
{% endfor %}
] + [
# This is the beginning of the static list. We should eventually remove

View file

@ -14,7 +14,6 @@
with_first_found:
- files:
- "{{ inventory_hostname }}-hosts"
- "{{ ansible_fqdn }}-hosts"
- "{{ ansible_hostname }}-hosts"
- "{{ host_group }}-hosts"
- "{{ ansible_domain }}-hosts"

View file

@ -24,7 +24,7 @@
- name: Install keepalived failover script for host (or default)
copy: src={{ item }} dest=/usr/local/bin/keepalived-notify.sh mode=755
with_first_found:
- keepalived-notify.sh.{{ ansible_fqdn }}
- keepalived-notify.sh.{{ inventory_hostname }}
- keepalived-notify.sh
tags:
- config

View file

@ -1,5 +1,5 @@
<VirtualHost *>
ServerName {{ ansible_fqdn }}
ServerName {{ inventory_hostname }}
WSGIDaemonProcess koschei user=koschei group=koschei threads=5 home=/usr/share/koschei

View file

@ -16,7 +16,7 @@
copy: src={{ item }} dest=/etc/my.cnf owner=root group=root mode=0644
with_first_found:
- "{{ mariadb_config }}"
- my.cnf.{{ ansible_fqdn }}
- my.cnf.{{ inventory_hostname }}
- my.cnf.{{ host_group }}
- my.cnf.{{ dist_tag }}
- my.cnf.{{ ansible_distribution }}

View file

@ -10,7 +10,7 @@
- nfs/server
- name: setup /etc/exports
copy: src={{ ansible_fqdn }}-exports dest=/etc/exports
copy: src={{ inventory_hostname }}-exports dest=/etc/exports
register: exports
tags:
- nfs/server

View file

@ -41,7 +41,7 @@
- name: generate cert for authenticating proxy - self-signed certificate
command: >
openssl req -new -nodes -x509
-subj "/C=CZ/ST=SelfSigned/L=SelfSigned/O=IT/CN={{ ansible_fqdn }}"
-subj "/C=CZ/ST=SelfSigned/L=SelfSigned/O=IT/CN={{ inventory_hostname }}"
-days 3650
-keyout {{ osbs_proxy_key_file }}
-out {{ osbs_proxy_cert_file }}

View file

@ -96,7 +96,7 @@ kubernetesMasterConfig:
servicesNodePortRange: 30000-32767
servicesSubnet: 172.30.0.0/16
staticNodeNames:
- {{ ansible_fqdn }}
- {{ inventory_hostname }}
masterClients:
externalKubernetesKubeConfig: ""
openshiftLoopbackKubeConfig: openshift-master.kubeconfig

View file

@ -96,7 +96,7 @@
- name: fedmsg certs
copy: >
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}.crt"
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}.crt"
dest=/etc/pki/fedmsg/
mode=644
owner={{item['owner']}}
@ -111,7 +111,7 @@
- name: fedmsg keys
copy: >
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(ansible_fqdn)}}.key"
src="{{ private }}/files/fedmsg-certs/keys/{{item['service']}}-{{fedmsg_fqdn | default(inventory_hostname)}}.key"
dest=/etc/pki/fedmsg/
mode=0640
owner={{item['owner']}}

View file

@ -27,7 +27,7 @@
copy: src={{ item }} dest=/etc/rsyncd.conf mode=644
with_first_found:
- "{{ rsyncd_conf }}"
- rsyncd.conf.{{ ansible_fqdn }}
- rsyncd.conf.{{ inventory_hostname }}
- rsyncd.conf.{{ host_group }}
- rsyncd.conf.{{ rsync_group }}
- rsyncd.conf.default
@ -40,7 +40,7 @@
copy: src={{ item }} dest=/etc/xinetd.d/rsync mode=644
with_first_found:
- "{{ rsync }}"
- rsync.{{ ansible_fqdn }}
- rsync.{{ inventory_hostname }}
- rsync.{{ host_group }}
- rsync.{{ rsync_group }}
- rsync.default

View file

@ -41,7 +41,7 @@
with_first_found:
- files:
- "{{ sudoers }}"
- "{{ private }}/files/sudo/{{ ansible_fqdn }}-sudoers"
- "{{ private }}/files/sudo/{{ inventory_hostname }}-sudoers"
- "{{ private }}/files/sudo/{{ ansible_hostname }}-sudoers"
- "{{ private }}/files/sudo/{{ ansible_domain }}-sudoers"
skip: true