From a3ea3389b42e8d39a1932d97098ccaeba5825dbf Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 20 May 2023 10:01:57 +0300
Subject: [PATCH] Router: Enable soft updates.

---
 Ansible/roles/router/handlers/main.yaml | 10 +++++-----
 Ansible/roles/router/tasks/main.yaml    | 17 +++++++++++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/Ansible/roles/router/handlers/main.yaml b/Ansible/roles/router/handlers/main.yaml
index 1c4e07e..24920ae 100644
--- a/Ansible/roles/router/handlers/main.yaml
+++ b/Ansible/roles/router/handlers/main.yaml
@@ -61,11 +61,6 @@
     name: httpd
     state: restarted
 
-- name: Message about restarting the machine
-  ansible.builtin.debug:
-    msg: The {{ ansible_facts.hostname }} needs to be restarted
-    verbosity: 0
-
 - name: Stop the audio server
   ansible.builtin.service:
     name: sndiod
@@ -90,3 +85,8 @@
   ansible.builtin.service:
     name: packetbeat
     state: restarted
+
+- name: Message about restarting the machine
+  ansible.builtin.debug:
+    msg: The {{ ansible_facts.hostname }} needs to be restarted
+    verbosity: 0
diff --git a/Ansible/roles/router/tasks/main.yaml b/Ansible/roles/router/tasks/main.yaml
index bbd10fd..e1fc047 100644
--- a/Ansible/roles/router/tasks/main.yaml
+++ b/Ansible/roles/router/tasks/main.yaml
@@ -1,4 +1,21 @@
 ---
+- name: Set soft updates on all mounts
+  with_items: |-
+    {{ ansible_mounts | selectattr("fstype", "equalto", "ffs") }}
+  ansible.posix.mount:
+    backup: true
+    boot: true
+    fstype: "{{ item.fstype }}"
+    opts: |-
+      {{ (item.options.split(",") + ["softdep"]) | unique | join(",") }}
+    path: "{{ item.mount }}"
+    src: "{{ item.device }}"
+    state: present
+  notify:
+    - Message about restarting the machine
+  tags:
+    - mounts
+
 - name: Configure sysctl
   with_dict:
     net.inet.ip.forwarding: "1"
-- 
GitLab