diff --git a/defaults/main.yml b/defaults/main.yml index 69ec146..d9d0ff7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -7,12 +7,10 @@ postfix_relay_rh_pkgs: - cyrus-sasl-lib - cyrus-sasl-plain - cyrus-sasl-md5 - - postfix-perl-scripts postfix_relay_deb_pkgs: - postfix - libsasl2-2 - - pflogsumm ############################################################################# # Set them to true when you want configure your machine to send email to a relay diff --git a/tasks/postfix_pflogsumm.yml b/tasks/postfix_pflogsumm.yml index 3d0cd56..8e7cea2 100644 --- a/tasks/postfix_pflogsumm.yml +++ b/tasks/postfix_pflogsumm.yml @@ -1,16 +1,35 @@ --- -- name: Configure pflogsumm +- name: Set the environment for pflogsumm and install the package block: - name: Set the postfix logfile path in EL distributions set_fact: postfix_logfile: /var/log/maillog when: ansible_distribution_file_variety == "RedHat" + - name: Install the postfix-perl-scripts package on EL + ansible.builtin.yum: + pkg: postfix-perl-scripts + state: present + when: ansible_distribution_file_variety == "RedHat" + - name: Set the postfix logfile path in deb distributions set_fact: postfix_logfile: /var/log/mail.log when: ansible_distribution_file_variety == "Debian" + - name: Install the pflogsumm package on deb + ansible.builtin.apt: + pkg: pflogsumm + state: present + cache_valid_time: 1800 + when: ansible_distribution_file_variety == "Debian" + + + when: postfix_pflogsumm_reports + tags: [ 'postfix', 'postfix_pflogsumm' ] + +- name: Configure pflogsumm + block: - name: Install the pflogsumm script ansible.builtin.template: src: pflogsumm_report.sh.j2