Changed "ansible_fqdn" to "inventory_hostname"

Due to some hosts misconfigure fqdn themselves
dehydrated
Felix Stupp 5 years ago
parent 574b07f2f4
commit fb0c1f0901
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -27,7 +27,7 @@
ssh_key_type: ed25519 ssh_key_type: ed25519
ssh_key_file: .ssh/id_ed25519 ssh_key_file: .ssh/id_ed25519
ssh_key_passphrase: "{{ password }}" ssh_key_passphrase: "{{ password }}"
ssh_key_comment: "{{ username }}@{{ ansible_fqdn }} {{ ansible_date_time.date }}" ssh_key_comment: "{{ username }}@{{ inventory_hostname }} {{ ansible_date_time.date }}"
- name: Configure home directory - name: Configure home directory
file: file:

@ -24,13 +24,13 @@
state: present state: present
generate_ssh_key: yes generate_ssh_key: yes
ssh_key_type: ed25519 ssh_key_type: ed25519
ssh_key_comment: "root@{{ ansible_fqdn }}" ssh_key_comment: "root@{{ inventory_hostname }}"
register: root_user register: root_user
- name: Store ssh public key local - name: Store ssh public key local
copy: copy:
content: "{{ root_user.ssh_public_key }}\n" content: "{{ root_user.ssh_public_key }}\n"
dest: "public_keys/ssh/root@{{ ansible_fqdn }}" dest: "public_keys/ssh/root@{{ inventory_hostname }}"
delegate_to: localhost delegate_to: localhost
vars: vars:
ansible_become: no ansible_become: no

@ -46,7 +46,7 @@
- name: Create directory for host keys locally - name: Create directory for host keys locally
file: file:
path: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}" path: "{{ global_ssh_host_key_directory }}/{{ inventory_hostname }}"
state: directory state: directory
owner: "{{ global_local_user }}" owner: "{{ global_local_user }}"
group: "{{ global_local_user }}" group: "{{ global_local_user }}"
@ -56,7 +56,7 @@
- name: Store ssh host keys locally - name: Store ssh host keys locally
copy: copy:
content: "{{ item.stdout }}\n" content: "{{ item.stdout }}\n"
dest: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}/{{ item.item }}" dest: "{{ global_ssh_host_key_directory }}/{{ inventory_hostname }}/{{ item.item }}"
owner: "{{ global_local_user }}" owner: "{{ global_local_user }}"
group: "{{ global_local_user }}" group: "{{ global_local_user }}"
mode: "u=rw,g=r,o=r" mode: "u=rw,g=r,o=r"
@ -67,7 +67,7 @@
- name: Generate ssh host key dns fingerprints locally - name: Generate ssh host key dns fingerprints locally
make: make:
chdir: "{{ global_ssh_host_key_directory }}/{{ ansible_fqdn }}" chdir: "{{ global_ssh_host_key_directory }}/{{ inventory_hostname }}"
file: "{{ playbook_dir }}/helpers/ssh_dns_fingerprints.makefile" file: "{{ playbook_dir }}/helpers/ssh_dns_fingerprints.makefile"
target: dns target: dns
delegate_to: localhost delegate_to: localhost

@ -47,7 +47,7 @@
- name: Disable public root user access - name: Disable public root user access
mysql_user: mysql_user:
user: "root" user: "root"
host: "{{ ansible_fqdn }}" host: "{{ inventory_hostname }}"
state: absent state: absent
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock

@ -57,7 +57,7 @@
- name: Configure test file for validation directory - name: Configure test file for validation directory
copy: copy:
content: "{{ ansible_fqdn }}" content: "{{ inventory_hostname }}"
dest: "{{ nginx_validation_test_file }}" dest: "{{ nginx_validation_test_file }}"
owner: root owner: root
group: root group: root

Loading…
Cancel
Save