From 9afc923bc587595ac14a17e43706045af2470d6a Mon Sep 17 00:00:00 2001 From: duynguyen Date: Sun, 14 Jun 2026 17:35:44 +0700 Subject: [PATCH] check firewalld exists before stopping to avoid error on minimal installs --- ansible/playbooks/01-common.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/01-common.yml b/ansible/playbooks/01-common.yml index 473b81e..233a24a 100644 --- a/ansible/playbooks/01-common.yml +++ b/ansible/playbooks/01-common.yml @@ -35,12 +35,18 @@ replace: 'SELINUX=permissive' # ── Firewalld ───────────────────────────────────────────────────── + - name: Check if firewalld is installed + command: systemctl list-unit-files firewalld.service + register: firewalld_check + changed_when: false + failed_when: false + - name: Disable and stop firewalld systemd: name: firewalld enabled: false state: stopped - ignore_errors: true # may not be installed + when: "'firewalld.service' in firewalld_check.stdout" # ── Swap ────────────────────────────────────────────────────────── - name: Disable swap now