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
#+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
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