From a32f8b9e4a061ec1422f9714ee4479dda1b7e186 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Wed, 11 May 2016 15:08:50 +0000 Subject: [PATCH] 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. --- playbooks/check-host.yml | 12 ++++++------ roles/anitya/fedmsg/tasks/main.yml | 4 ++-- roles/base/tasks/main.yml | 10 +++++----- roles/base/tasks/postfix.yml | 3 +-- roles/collectd/postgres/templates/postgres.conf | 2 +- roles/docker-distribution/defaults/main.yml | 2 +- roles/fas_client/tasks/main.yml | 2 +- roles/fedmsg/base/tasks/main.yml | 4 ++-- roles/fedmsg/base/templates/ssl.py.j2 | 2 +- roles/hosts/tasks/main.yml | 1 - roles/keepalived/tasks/main.yml | 2 +- roles/koschei/frontend/templates/httpd.conf.j2 | 2 +- roles/mariadb_server/tasks/main.yml | 2 +- roles/nfs/server/tasks/main.yml | 2 +- roles/osbs-master/tasks/main.yml | 2 +- roles/osbs-master/templates/master-config.yaml.j2 | 2 +- roles/pagure/fedmsg/tasks/main.yml | 4 ++-- roles/rsyncd/tasks/main.yml | 4 ++-- roles/sudo/tasks/main.yml | 2 +- 19 files changed, 31 insertions(+), 33 deletions(-) diff --git a/playbooks/check-host.yml b/playbooks/check-host.yml index fdd67f8661..7379e189e9 100644 --- a/playbooks/check-host.yml +++ b/playbooks/check-host.yml @@ -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 diff --git a/roles/anitya/fedmsg/tasks/main.yml b/roles/anitya/fedmsg/tasks/main.yml index af3f4ef64c..e22cf15dbd 100644 --- a/roles/anitya/fedmsg/tasks/main.yml +++ b/roles/anitya/fedmsg/tasks/main.yml @@ -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']}} diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index fcc7c7b252..b8b267ef46 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -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: diff --git a/roles/base/tasks/postfix.yml b/roles/base/tasks/postfix.yml index f65ba44df6..d82a4649a7 100644 --- a/roles/base/tasks/postfix.yml +++ b/roles/base/tasks/postfix.yml @@ -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 }}" diff --git a/roles/collectd/postgres/templates/postgres.conf b/roles/collectd/postgres/templates/postgres.conf index be57b93926..d829e003be 100644 --- a/roles/collectd/postgres/templates/postgres.conf +++ b/roles/collectd/postgres/templates/postgres.conf @@ -1,3 +1,3 @@ - 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" diff --git a/roles/docker-distribution/defaults/main.yml b/roles/docker-distribution/defaults/main.yml index 610aa6608b..db9b6fc09b 100644 --- a/roles/docker-distribution/defaults/main.yml +++ b/roles/docker-distribution/defaults/main.yml @@ -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" diff --git a/roles/fas_client/tasks/main.yml b/roles/fas_client/tasks/main.yml index b22c0094c8..2e54b8ccf5 100644 --- a/roles/fas_client/tasks/main.yml +++ b/roles/fas_client/tasks/main.yml @@ -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 diff --git a/roles/fedmsg/base/tasks/main.yml b/roles/fedmsg/base/tasks/main.yml index 16d751df01..001f3d8c75 100644 --- a/roles/fedmsg/base/tasks/main.yml +++ b/roles/fedmsg/base/tasks/main.yml @@ -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']}} diff --git a/roles/fedmsg/base/templates/ssl.py.j2 b/roles/fedmsg/base/templates/ssl.py.j2 index 42bd30ad76..8c3ea9aade 100644 --- a/roles/fedmsg/base/templates/ssl.py.j2 +++ b/roles/fedmsg/base/templates/ssl.py.j2 @@ -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 diff --git a/roles/hosts/tasks/main.yml b/roles/hosts/tasks/main.yml index 55c75371d0..9e4ff15da3 100644 --- a/roles/hosts/tasks/main.yml +++ b/roles/hosts/tasks/main.yml @@ -14,7 +14,6 @@ with_first_found: - files: - "{{ inventory_hostname }}-hosts" - - "{{ ansible_fqdn }}-hosts" - "{{ ansible_hostname }}-hosts" - "{{ host_group }}-hosts" - "{{ ansible_domain }}-hosts" diff --git a/roles/keepalived/tasks/main.yml b/roles/keepalived/tasks/main.yml index be57c5db29..16c39097b3 100644 --- a/roles/keepalived/tasks/main.yml +++ b/roles/keepalived/tasks/main.yml @@ -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 diff --git a/roles/koschei/frontend/templates/httpd.conf.j2 b/roles/koschei/frontend/templates/httpd.conf.j2 index e2b94d55d9..207b897584 100644 --- a/roles/koschei/frontend/templates/httpd.conf.j2 +++ b/roles/koschei/frontend/templates/httpd.conf.j2 @@ -1,5 +1,5 @@ - ServerName {{ ansible_fqdn }} + ServerName {{ inventory_hostname }} WSGIDaemonProcess koschei user=koschei group=koschei threads=5 home=/usr/share/koschei diff --git a/roles/mariadb_server/tasks/main.yml b/roles/mariadb_server/tasks/main.yml index 3b2be271ec..6eb3bb72dd 100644 --- a/roles/mariadb_server/tasks/main.yml +++ b/roles/mariadb_server/tasks/main.yml @@ -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 }} diff --git a/roles/nfs/server/tasks/main.yml b/roles/nfs/server/tasks/main.yml index c8440e8bae..ee73d5ecce 100644 --- a/roles/nfs/server/tasks/main.yml +++ b/roles/nfs/server/tasks/main.yml @@ -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 diff --git a/roles/osbs-master/tasks/main.yml b/roles/osbs-master/tasks/main.yml index 512c225ab7..107bccff9c 100644 --- a/roles/osbs-master/tasks/main.yml +++ b/roles/osbs-master/tasks/main.yml @@ -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 }} diff --git a/roles/osbs-master/templates/master-config.yaml.j2 b/roles/osbs-master/templates/master-config.yaml.j2 index da3786b45a..db1f5e3a26 100644 --- a/roles/osbs-master/templates/master-config.yaml.j2 +++ b/roles/osbs-master/templates/master-config.yaml.j2 @@ -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 diff --git a/roles/pagure/fedmsg/tasks/main.yml b/roles/pagure/fedmsg/tasks/main.yml index 017aae3a85..419e74c0dc 100644 --- a/roles/pagure/fedmsg/tasks/main.yml +++ b/roles/pagure/fedmsg/tasks/main.yml @@ -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']}} diff --git a/roles/rsyncd/tasks/main.yml b/roles/rsyncd/tasks/main.yml index 7d1a83b5bd..4c6fd40645 100644 --- a/roles/rsyncd/tasks/main.yml +++ b/roles/rsyncd/tasks/main.yml @@ -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 diff --git a/roles/sudo/tasks/main.yml b/roles/sudo/tasks/main.yml index c3b419d5b6..3b9ffc66f1 100644 --- a/roles/sudo/tasks/main.yml +++ b/roles/sudo/tasks/main.yml @@ -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