From ddd75bc3d9979cf3f40224f5e6b0becb66f3006d Mon Sep 17 00:00:00 2001 From: Sergei Petrosian Date: Mon, 10 Jun 2024 16:48:53 +0200 Subject: [PATCH] fix: Reflect smtp-submission service rename in EL 10 and Fedora 40 - In EL 10 and Fedora 40, smtp-submission service has been renamed to submission https://github.com/firewalld/firewalld/commit/d6a9561260c0ff81fb2e0a105768749c5c819561 - Add setting vars for platforms - Fix egrep warning "egrep: warning: egrep is obsolescent; using grep -E --- tasks/selinux.yml | 7 ++----- tasks/set_facts.yml | 11 +++++++++++ vars/CentOS_7.yml | 6 ++++++ vars/CentOS_8.yml | 6 ++++++ vars/CentOS_9.yml | 6 ++++++ vars/Fedora.yml | 6 ++++++ vars/Fedora_39.yml | 6 ++++++ vars/RedHat.yml | 6 ++++++ vars/RedHat_7.yml | 6 ++++++ vars/RedHat_8.yml | 6 ++++++ vars/RedHat_9.yml | 6 ++++++ vars/main.yml | 8 +++++++- 12 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 vars/CentOS_7.yml create mode 100644 vars/CentOS_8.yml create mode 100644 vars/CentOS_9.yml create mode 100644 vars/Fedora.yml create mode 100644 vars/Fedora_39.yml create mode 100644 vars/RedHat.yml create mode 100644 vars/RedHat_7.yml create mode 100644 vars/RedHat_8.yml create mode 100644 vars/RedHat_9.yml diff --git a/tasks/selinux.yml b/tasks/selinux.yml index bcf12ad..1543d23 100644 --- a/tasks/selinux.yml +++ b/tasks/selinux.yml @@ -13,13 +13,10 @@ shell: |- set -euo pipefail firewall-cmd --info-service="{{ item }}" | \ - egrep " +ports: +" | sed -e "s/ *ports: //" + grep -E " +ports: +" | sed -e "s/ *ports: //" register: __ports changed_when: false - loop: - - "smtp" - - "smtps" - - "smtp-submission" + loop: "{{ __postfix_smtp_services }}" - name: Initialize _postfix_selinux set_fact: diff --git a/tasks/set_facts.yml b/tasks/set_facts.yml index d941791..20b18f2 100644 --- a/tasks/set_facts.yml +++ b/tasks/set_facts.yml @@ -17,3 +17,14 @@ - name: Set flag to indicate system is ostree set_fact: __postfix_is_ostree: "{{ __ostree_booted_stat.stat.exists }}" + +- name: Set platform/version specific variables + include_vars: "{{ __postfix_vars_file }}" + loop: + - "{{ ansible_os_family }}.yml" + - "{{ ansible_distribution }}.yml" + - "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml" + vars: + __postfix_vars_file: "{{ role_path }}/vars/{{ item }}" + when: __postfix_vars_file is file diff --git a/vars/CentOS_7.yml b/vars/CentOS_7.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/CentOS_7.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/CentOS_8.yml b/vars/CentOS_8.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/CentOS_8.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/CentOS_9.yml b/vars/CentOS_9.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/CentOS_9.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/Fedora.yml b/vars/Fedora.yml new file mode 100644 index 0000000..3a3615a --- /dev/null +++ b/vars/Fedora.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - submission diff --git a/vars/Fedora_39.yml b/vars/Fedora_39.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/Fedora_39.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/RedHat.yml b/vars/RedHat.yml new file mode 100644 index 0000000..3a3615a --- /dev/null +++ b/vars/RedHat.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - submission diff --git a/vars/RedHat_7.yml b/vars/RedHat_7.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/RedHat_7.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/RedHat_8.yml b/vars/RedHat_8.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/RedHat_8.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/RedHat_9.yml b/vars/RedHat_9.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/RedHat_9.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/main.yml b/vars/main.yml index 849f15e..f387b00 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,7 +1,13 @@ # SPDX-License-Identifier: GPL-3.0-only --- # List of default rpm packages to install. -__postfix_packages: ['postfix'] +__postfix_packages: + - postfix + +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission # ansible_facts required by the role __postfix_required_facts: