Fix "Update hostname." task.
authorMatt Birkholz <matt@birchwood-abbey.net>
Mon, 1 Jan 2024 17:47:43 +0000 (10:47 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Mon, 1 Jan 2024 17:47:43 +0000 (10:47 -0700)
README.org
roles_t/campus/handlers/main.yml
roles_t/campus/tasks/main.yml

index 2d0dcfb18e9bc85ba1241b38feff0aea098f3e60..256dee224c1a51d480ca8fa93dcbb383240e2548 100644 (file)
@@ -5188,20 +5188,14 @@ Clients should be using the expected host name.
     dest: "{{ item.file }}"
   loop:
   - { file: /etc/hostname,
-      content: "{{ inventory_hostname }}" }
+      content: "{{ inventory_hostname }}\n" }
   - { file: /etc/mailname,
-      content: "{{ inventory_hostname }}.{{ domain_priv }}" }
-  when: inventory_hostname != ansible_hostname
-  notify: Update hostname.
-
-#+END_SRC
+      content: "{{ inventory_hostname }}.{{ domain_priv }}\n" }
 
-#+CAPTION: [[file:roles_t/campus/handlers/main.yml][=roles_t/campus/handlers/main.yml=]]
-#+BEGIN_SRC conf :tangle roles_t/campus/handlers/main.yml :mkdirp yes
----
 - name: Update hostname.
   become: yes
   command: hostname -F /etc/hostname
+  when: inventory_hostname != ansible_hostname
 #+END_SRC
 
 ** Enable Systemd Resolved
@@ -5238,8 +5232,8 @@ and include the institute's private domain in their search lists.
 #+END_SRC
 
 #+CAPTION: [[file:roles_t/campus/handlers/main.yml][=roles_t/campus/handlers/main.yml=]]
-#+BEGIN_SRC conf :tangle roles_t/campus/handlers/main.yml
-
+#+BEGIN_SRC conf :tangle roles_t/campus/handlers/main.yml :mkdirp yes
+---
 - name: Reload Systemd.
   become: yes
   command: systemctl daemon-reload
index adb4f4edb112abee405a88ea920c3dc93e6c7485..c929d42ee14ac16869b0c35041991e74c5210f1c 100644 (file)
@@ -1,8 +1,4 @@
 ---
-- name: Update hostname.
-  become: yes
-  command: hostname -F /etc/hostname
-
 - name: Reload Systemd.
   become: yes
   command: systemctl daemon-reload
index 9773336ed43ed57e94c489aa7268f41938dc1726..e185415225049a7b7074f99e7c725263b494ee84 100644 (file)
     dest: "{{ item.file }}"
   loop:
   - { file: /etc/hostname,
-      content: "{{ inventory_hostname }}" }
+      content: "{{ inventory_hostname }}\n" }
   - { file: /etc/mailname,
-      content: "{{ inventory_hostname }}.{{ domain_priv }}" }
+      content: "{{ inventory_hostname }}.{{ domain_priv }}\n" }
+
+- name: Update hostname.
+  become: yes
+  command: hostname -F /etc/hostname
   when: inventory_hostname != ansible_hostname
-  notify: Update hostname.
 
 - name: Install systemd-resolved.
   become: yes