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/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/RHEL.yml b/vars/RHEL.yml new file mode 100644 index 0000000..3a3615a --- /dev/null +++ b/vars/RHEL.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - submission diff --git a/vars/RHEL_7.yml b/vars/RHEL_7.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/RHEL_7.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/RHEL_8.yml b/vars/RHEL_8.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/RHEL_8.yml @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-3.0-only +--- +__postfix_smtp_services: + - smtp + - smtps + - smtp-submission diff --git a/vars/RHEL_9.yml b/vars/RHEL_9.yml new file mode 100644 index 0000000..117bbd9 --- /dev/null +++ b/vars/RHEL_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: