1234567891011121314151617181920212223242526272829303132333435363738 |
- - name: Install OpenDMARC milter and related packages
- apt: pkg={{ item }} state=installed update_cache=yes
- with_items:
- - mysql-server
- - python-mysqldb
- - opendmarc
-
- - name: Copy OpenDMARC configuration file into place
- template: src=etc_opendmarc.conf.j2 dest=/etc/opendmarc.conf owner=root group=root
- notify: restart opendmarc
-
- - name: Create OpenDMARC configuration directory
- file: state=directory path=/etc/opendmarc
-
- - name: Copy OpenDMARC ignore hosts file into place
- template: src=etc_opendmarc_ignore.hosts.j2 dest=/etc/opendmarc/ignore.hosts owner=root group=root
-
- - name: Copy OpenDMARC defaults file into place
- copy: src=etc_default_opendmarc dest=/etc/default/opendmarc owner=root group=root
- notify:
- - restart opendmarc
- - restart postfix
-
- - name: Create database user for OpenDMARC reports
- mysql_user: user={{ mail_db_opendmarc_username }} password={{ mail_db_opendmarc_password }} state=present priv="opendmarc.*:ALL"
-
- - name: Create database for OpenDMARC reports
- mysql_db: name={{ mail_db_opendmarc_database }} state=present
- notify: import opendmarc schema
-
- - name: Copy nightly OpenDMARC report generation script into place
- template: src=etc_opendmarc_report.sh.j2 dest=/etc/opendmarc/report.sh owner=root group=root mode="755"
-
- - name: Ensure initial report dat file exists with correct permissions
- copy: content="" dest=/var/run/opendmarc/opendmarc.dat owner=opendmarc group=opendmarc
-
- - name: Activate OpenDMARC report cronjob
- cron: name="OpenDMARC report" hour="2" minute="0" job="/bin/bash /etc/opendmarc/report.sh >> /var/log/opendmarc_report.log 2>&1 || tail /var/log/opendmarc_report.log"
|