From 3eaf918a53f0ac827d919213389d97283b7f3622 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Sat, 2 May 2026 18:23:42 +0200 Subject: [PATCH] fix(lint): convert sshd restart to handler, add pipefail to btrfs subvol set --- roles/environment/handlers/main.yml | 5 +++++ roles/environment/tasks/_detect_live.yml | 9 +++------ roles/partitioning/tasks/btrfs.yml | 9 ++++++--- 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 roles/environment/handlers/main.yml diff --git a/roles/environment/handlers/main.yml b/roles/environment/handlers/main.yml new file mode 100644 index 0000000..6998953 --- /dev/null +++ b/roles/environment/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: Restart sshd + ansible.builtin.service: + name: sshd + state: restarted diff --git a/roles/environment/tasks/_detect_live.yml b/roles/environment/tasks/_detect_live.yml index bea071a..32c0e10 100644 --- a/roles/environment/tasks/_detect_live.yml +++ b/roles/environment/tasks/_detect_live.yml @@ -77,13 +77,10 @@ MaxStartups 50:30:100 ClientAliveInterval 30 ClientAliveCountMax 10 - register: _sshd_config_result + notify: Restart sshd -- name: Restart sshd immediately if config was changed - when: _sshd_config_result is changed - ansible.builtin.service: - name: sshd - state: restarted +- name: Apply pending sshd restart before continuing + ansible.builtin.meta: flush_handlers - name: Abort if the host is not booted from the Arch install media when: diff --git a/roles/partitioning/tasks/btrfs.yml b/roles/partitioning/tasks/btrfs.yml index eda3e93..db7c7b1 100644 --- a/roles/partitioning/tasks/btrfs.yml +++ b/roles/partitioning/tasks/btrfs.yml @@ -59,9 +59,12 @@ label: "{{ item.subvol }}" - name: Set default btrfs subvolume to @ - ansible.builtin.shell: >- - btrfs subvolume list /mnt | awk '/ path @$/ {print $2}' - | xargs -I{} btrfs subvolume set-default {} /mnt + ansible.builtin.shell: + cmd: >- + set -o pipefail && + btrfs subvolume list /mnt | awk '/ path @$/ {print $2}' + | xargs -I{} btrfs subvolume set-default {} /mnt + executable: /bin/bash register: partitioning_btrfs_default_result changed_when: partitioning_btrfs_default_result.rc == 0