From caca86ba22693d572269d0c5a1c9b4ee5681bcf3 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 3 Apr 2024 11:01:22 -0500 Subject: [PATCH] Add campus Set Domain Name. Punt Hard-wire Important IP Addresses. --- README.org | 25 ++++++++++--------------- roles_t/campus/tasks/main.yml | 16 +++++----------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/README.org b/README.org index c690aaa..8e6f867 100644 --- a/README.org +++ b/README.org @@ -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 diff --git a/roles_t/campus/tasks/main.yml b/roles_t/campus/tasks/main.yml index ee7d488..b658343 100644 --- a/roles_t/campus/tasks/main.yml +++ b/roles_t/campus/tasks/main.yml @@ -85,20 +85,14 @@ 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 -- 2.25.1