Add campus Set Domain Name. Punt Hard-wire Important IP Addresses.
authorMatt Birkholz <matt@birchwood-abbey.net>
Wed, 3 Apr 2024 16:01:22 +0000 (11:01 -0500)
committerMatt Birkholz <matt@birchwood-abbey.net>
Wed, 3 Apr 2024 16:01:22 +0000 (11:01 -0500)
README.org
roles_t/campus/tasks/main.yml

index c690aaaaef61236bceb37379513525f0acb41d74..8e6f867b287d1c2c2bed420f23919d8f33350172 100644 (file)
@@ -5355,29 +5355,24 @@ tasks below.
     state: restarted
 #+END_SRC
 
-** Hard-wire Important IP Addresses
+** Set Domain Name
 
-For the edification of programs consulting the =/etc/hosts= file, the
-institute's domain name and public IP address are added.  The Debian
-custom of translating the host name into ~127.0.1.1~ is also followed.
+The host's fully qualified (private) domain name (FQDN) is set by an
+alias in its =/etc/hosts= file, as is customary on Debian.  (See "The
+"recommended method of setting the FQDN" in the ~hostname(1)~
+manpage.)
 
 #+CAPTION: [[file:roles_t/campus/tasks/main.yml][=roles_t/campus/tasks/main.yml=]]
 #+BEGIN_SRC conf :tangle roles_t/campus/tasks/main.yml
 
-- name: Hard-wire important IP addresses.
+- name: Set domain name.
   become: yes
-  lineinfile:
-    path: /etc/hosts
-    regexp: "{{ item.regexp }}"
-    line: "{{ item.line }}"
-    insertafter: EOF
   vars:
     name: "{{ inventory_hostname }}"
-  loop:
-  - regexp: "^{{ front_addr }}[        ].*"
-    line: "{{ front_addr }}    {{ domain_name }}"
-  - regexp: "^127.0.1.1[       ].*"
-    line: "127.0.1.1   {{ name }}.localdomain {{ name }}"
+  lineinfile:
+    path: /etc/hosts
+    regexp: "^127.0.1.1[       ].*"
+    line: "127.0.1.1   {{ name }}.{{ domain_priv }} {{ name }}"
 #+END_SRC
 
 ** Configure NRPE
index ee7d4885b24e3f9a7671afcfbd83a1bc3395d1ab..b658343e08cb14ac320df68ff26e2f3dcd66f46c 100644 (file)
     enabled: yes
     state: started
 
-- name: Hard-wire important IP addresses.
+- name: Set domain name.
   become: yes
-  lineinfile:
-    path: /etc/hosts
-    regexp: "{{ item.regexp }}"
-    line: "{{ item.line }}"
-    insertafter: EOF
   vars:
     name: "{{ inventory_hostname }}"
-  loop:
-  - regexp: "^{{ front_addr }}[        ].*"
-    line: "{{ front_addr }}    {{ domain_name }}"
-  - regexp: "^127.0.1.1[       ].*"
-    line: "127.0.1.1   {{ name }}.localdomain {{ name }}"
+  lineinfile:
+    path: /etc/hosts
+    regexp: "^127.0.1.1[       ].*"
+    line: "127.0.1.1   {{ name }}.{{ domain_priv }} {{ name }}"
 
 - name: Install NRPE.
   become: yes