--- - name: Set the spf policy's environment and install the packages on EL block: - name: Set the spf policy conf file path in EL distributions set_fact: postfix_spf_policy_conf_dir: '/etc/python-policyd-spf' postfix_spf_policy_conf_file: '/etc/python-policyd-spf/policyd-spf.conf' postfix_spf_policy_exec: '/usr/libexec/postfix/policyd-spf' - name: The EL package does not provide a user. Create one ansible.builtin.user: name: policyd-spf home: '{{ postfix_spf_policy_conf_dir }}' create_home: no system: yes shell: /sbin/nologin - name: Install the postfix-perl-scripts package on EL ansible.builtin.yum: pkg: '{{ postfix_spy_el_pkg }}' state: present when: ansible_distribution_file_variety == "RedHat" tags: [ 'postfix', 'postfix_spf_policy', 'postfix_conf' ] - name: Set the spf policy's environment and install the packages on deb block: - name: Set the spf policy conf file path in deb distributions set_fact: postfix_spf_policy_conf_dir: '/etc/policyd-spf' postfix_spf_policy_conf_file: '/etc/policyd-spf/policyd-spf.conf' postfix_spf_policy_exec: '/usr/bin/policyd-spf' - name: Install the policyd-spf package on deb ansible.builtin.apt: pkg: '{{ postfix_spy_deb_pkg }}' state: present cache_valid_time: 1800 when: ansible_distribution_file_variety == "Debian" tags: [ 'postfix', 'postfix_spf_policy', 'postfix_conf' ] - name: Configure policyd-spf block: - name: Install the policyd configuration ansible.builtin.template: src: policyd-spf.conf.j2 dest: '{{ postfix_spf_policy_conf_file }}' owner: root group: root mode: 0644 tags: [ 'postfix', 'postfix_spf_policy' ]