From 9d89a874ec04601d1ddce207b506fcc925619dac Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 22 Jul 2024 10:39:21 +0200 Subject: [PATCH] fix(firewalld): adjust firewall only when it's set up Signed-off-by: Matej Focko --- roles/cups/tasks/main.yml | 1 + roles/nginx/tasks/main.yml | 1 + roles/sshd/tasks/main.yml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/roles/cups/tasks/main.yml b/roles/cups/tasks/main.yml index a66a298..e650b39 100644 --- a/roles/cups/tasks/main.yml +++ b/roles/cups/tasks/main.yml @@ -15,6 +15,7 @@ immediate: true permanent: true state: enabled + when: ansible_facts.services['firewalld'] is defined tags: firewall - name: Enable cups diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index 540fcac..e3af105 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -80,6 +80,7 @@ loop: - http - https + when: ansible_facts.services['firewalld'] is defined tags: firewall - name: Enable nginx diff --git a/roles/sshd/tasks/main.yml b/roles/sshd/tasks/main.yml index 073d3eb..7a94b9c 100644 --- a/roles/sshd/tasks/main.yml +++ b/roles/sshd/tasks/main.yml @@ -41,6 +41,7 @@ immediate: true permanent: true state: enabled + when: ansible_facts.services['firewalld'] is defined notify: "Restart SSH server" tags: firewall @@ -49,6 +50,7 @@ service: ssh permanent: true state: disabled + when: ansible_facts.services['firewalld'] is defined tags: firewall - name: Set trusted CA