Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

opendmarc.yml 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. - name: Install OpenDMARC milter and related packages
  2. apt: pkg={{ item }} state=installed update_cache=yes
  3. with_items:
  4. - mysql-server
  5. - python-mysqldb
  6. - opendmarc
  7. - name: Patch opendmarc scripts (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742447)
  8. lineinfile: dest=/usr/sbin/{{ item }} regexp='^require DBD::' line='require DBD::mysql;'
  9. with_items:
  10. - opendmarc-import
  11. - opendmarc-reports
  12. - opendmarc-params
  13. - name: Patch opendmarc scripts part deux (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742447)
  14. lineinfile: dest=/usr/sbin/{{ item }} regexp='^my \$dbscheme' line='my $dbscheme = "mysql";'
  15. with_items:
  16. - opendmarc-reports
  17. - opendmarc-import
  18. - name: Copy OpenDMARC configuration file into place
  19. template: src=etc_opendmarc.conf.j2 dest=/etc/opendmarc.conf owner=root group=root
  20. notify: restart opendmarc
  21. - name: Create OpenDMARC configuration directory
  22. file: state=directory path=/etc/opendmarc
  23. - name: Copy OpenDMARC ignore hosts file into place
  24. template: src=etc_opendmarc_ignore.hosts.j2 dest=/etc/opendmarc/ignore.hosts owner=root group=root
  25. - name: Copy OpenDMARC defaults file into place
  26. copy: src=etc_default_opendmarc dest=/etc/default/opendmarc owner=root group=root
  27. notify:
  28. - restart opendmarc
  29. - restart postfix
  30. - name: Create database user for OpenDMARC reports
  31. mysql_user: user={{ mail_db_opendmarc_username }} password={{ mail_db_opendmarc_password }} state=present priv="opendmarc.*:ALL"
  32. - name: Create database for OpenDMARC reports
  33. mysql_db: name={{ mail_db_opendmarc_database }} state=present
  34. register: db_created
  35. - name: Import opendmarc schema
  36. mysql_db: name={{ mail_db_opendmarc_database }} state=import target=/usr/share/doc/opendmarc/schema.mysql
  37. when: db_created.changed
  38. - name: Copy nightly OpenDMARC report generation script into place
  39. template: src=etc_opendmarc_report.sh.j2 dest=/etc/opendmarc/report.sh owner=root group=root mode="0755"
  40. - name: Ensure initial report dat file exists with correct permissions
  41. copy: content="" dest=/var/run/opendmarc/opendmarc.dat owner=opendmarc group=opendmarc
  42. - name: Activate OpenDMARC report cronjob
  43. 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"