Browse Source

Properly setup hostname

Thomas Buck 5 years ago
parent
commit
8b83bd66b1

+ 7
- 1
group_vars/sovereign View File

3
 # Set your variables here.
3
 # Set your variables here.
4
 ################################################################################
4
 ################################################################################
5
 
5
 
6
+secret_root: '{{ inventory_dir | realpath }}'
7
+secret_name: 'secret'
8
+secret: '{{ secret_root + "/" + secret_name }}'
9
+
6
 domain: (required)
10
 domain: (required)
7
-server_fqdn: (required)
11
+server_name: (required)
12
+server_fqdn: "{{ server_name }}.{{ domain }}"
13
+
8
 main_user_name: (required)
14
 main_user_name: (required)
9
 main_user_shell: "/usr/bin/zsh"
15
 main_user_shell: "/usr/bin/zsh"
10
 admin_email: "{{ main_user_name }}@{{ domain }}"
16
 admin_email: "{{ main_user_name }}@{{ domain }}"

+ 7
- 0
roles/common/tasks/main.yml View File

1
 ---
1
 ---
2
+
3
+- name: Set hostname
4
+  hostname: name="{{ server_fqdn }}"
5
+
6
+- name: Replace /etc/hosts
7
+  template: src=etc_hosts.j2 dest=/etc/hosts
8
+
2
 - name: Update apt cache
9
 - name: Update apt cache
3
   apt: update_cache=yes
10
   apt: update_cache=yes
4
   tags:
11
   tags:

+ 9
- 0
roles/common/templates/etc_hosts.j2 View File

1
+127.0.1.1 {{ server_name }} {{ server_fqdn }}
2
+127.0.0.1 localhost
3
+
4
+::1 ip6-localhost ip6-loopback
5
+fe00::0 ip6-localnet
6
+ff00::0 ip6-mcastprefix
7
+ff02::1 ip6-allnodes
8
+ff02::2 ip6-allrouters
9
+ff02::3 ip6-allhosts

+ 1
- 1
roles/common/templates/fqdn.j2 View File

1
-ServerName {{ domain }}
1
+ServerName {{ server_fqdn }}

Loading…
Cancel
Save