From a0ef97a3169e9da8b4618116075d54c49b4292b4 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 20 May 2018 10:57:35 +0200 Subject: [PATCH] reorganize postfix/email role; drop meta/main.yml dependencies as they interact badly with tags --- email.yml | 8 ------ roles/apache/meta/main.yml | 2 -- .../files/check-for-local-mail | 0 roles/{postfix => email}/files/mailman-check | 0 .../{postfix => email}/files/newmail/newmail | 0 .../files/newmail/templates.py | 0 .../files/unbound/dhclient.conf | 0 .../files/unbound/listen.conf | 0 .../files/unbound/unbound.service.override | 0 roles/{postfix => email}/handlers/main.yml | 0 roles/{postfix => email}/tasks/main.yml | 3 +++ roles/{postfix => email}/tasks/opendkim.yml | 0 roles/{postfix => email}/tasks/postfix.yml | 0 roles/{postfix => email}/tasks/unbound.yml | 0 roles/{postfix => email}/templates/KeyTable | 0 .../{postfix => email}/templates/SigningTable | 0 roles/{postfix => email}/templates/main.cf | 0 roles/{postfix => email}/templates/master.cf | 0 .../templates/mysql_vmail_aliases.cf | 0 .../templates/mysql_vmail_senders.cf | 0 .../templates/mysql_vmail_users.cf | 0 .../templates/opendkim.conf | 0 .../{postfix => email}/templates/opendkim.env | 0 roles/{postfix => email}/vmail.sql | 0 roles/journalwatch/meta/main.yml | 2 -- roles/journalwatch/tasks/journalwatch.yml | 23 ----------------- roles/journalwatch/tasks/main.yml | 25 +++++++++++++++++-- roles/postfix/meta/main.yml | 2 -- roles/prosody/meta/main.yml | 2 -- site.yml | 13 ++++++++-- 30 files changed, 37 insertions(+), 43 deletions(-) delete mode 100644 email.yml delete mode 100644 roles/apache/meta/main.yml rename roles/{postfix => email}/files/check-for-local-mail (100%) rename roles/{postfix => email}/files/mailman-check (100%) rename roles/{postfix => email}/files/newmail/newmail (100%) rename roles/{postfix => email}/files/newmail/templates.py (100%) rename roles/{postfix => email}/files/unbound/dhclient.conf (100%) rename roles/{postfix => email}/files/unbound/listen.conf (100%) rename roles/{postfix => email}/files/unbound/unbound.service.override (100%) rename roles/{postfix => email}/handlers/main.yml (100%) rename roles/{postfix => email}/tasks/main.yml (60%) rename roles/{postfix => email}/tasks/opendkim.yml (100%) rename roles/{postfix => email}/tasks/postfix.yml (100%) rename roles/{postfix => email}/tasks/unbound.yml (100%) rename roles/{postfix => email}/templates/KeyTable (100%) rename roles/{postfix => email}/templates/SigningTable (100%) rename roles/{postfix => email}/templates/main.cf (100%) rename roles/{postfix => email}/templates/master.cf (100%) rename roles/{postfix => email}/templates/mysql_vmail_aliases.cf (100%) rename roles/{postfix => email}/templates/mysql_vmail_senders.cf (100%) rename roles/{postfix => email}/templates/mysql_vmail_users.cf (100%) rename roles/{postfix => email}/templates/opendkim.conf (100%) rename roles/{postfix => email}/templates/opendkim.env (100%) rename roles/{postfix => email}/vmail.sql (100%) delete mode 100644 roles/journalwatch/meta/main.yml delete mode 100644 roles/journalwatch/tasks/journalwatch.yml delete mode 100644 roles/postfix/meta/main.yml delete mode 100644 roles/prosody/meta/main.yml diff --git a/email.yml b/email.yml deleted file mode 100644 index 42fb0a5..0000000 --- a/email.yml +++ /dev/null @@ -1,8 +0,0 @@ -- hosts: email - roles: - - postfix - - journalwatch - tasks: - # some basic security stuff that relies on working email - - name: install apticron - apt: name=apticron state=latest diff --git a/roles/apache/meta/main.yml b/roles/apache/meta/main.yml deleted file mode 100644 index 3de0130..0000000 --- a/roles/apache/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- { role: letsencrypt } diff --git a/roles/postfix/files/check-for-local-mail b/roles/email/files/check-for-local-mail similarity index 100% rename from roles/postfix/files/check-for-local-mail rename to roles/email/files/check-for-local-mail diff --git a/roles/postfix/files/mailman-check b/roles/email/files/mailman-check similarity index 100% rename from roles/postfix/files/mailman-check rename to roles/email/files/mailman-check diff --git a/roles/postfix/files/newmail/newmail b/roles/email/files/newmail/newmail similarity index 100% rename from roles/postfix/files/newmail/newmail rename to roles/email/files/newmail/newmail diff --git a/roles/postfix/files/newmail/templates.py b/roles/email/files/newmail/templates.py similarity index 100% rename from roles/postfix/files/newmail/templates.py rename to roles/email/files/newmail/templates.py diff --git a/roles/postfix/files/unbound/dhclient.conf b/roles/email/files/unbound/dhclient.conf similarity index 100% rename from roles/postfix/files/unbound/dhclient.conf rename to roles/email/files/unbound/dhclient.conf diff --git a/roles/postfix/files/unbound/listen.conf b/roles/email/files/unbound/listen.conf similarity index 100% rename from roles/postfix/files/unbound/listen.conf rename to roles/email/files/unbound/listen.conf diff --git a/roles/postfix/files/unbound/unbound.service.override b/roles/email/files/unbound/unbound.service.override similarity index 100% rename from roles/postfix/files/unbound/unbound.service.override rename to roles/email/files/unbound/unbound.service.override diff --git a/roles/postfix/handlers/main.yml b/roles/email/handlers/main.yml similarity index 100% rename from roles/postfix/handlers/main.yml rename to roles/email/handlers/main.yml diff --git a/roles/postfix/tasks/main.yml b/roles/email/tasks/main.yml similarity index 60% rename from roles/postfix/tasks/main.yml rename to roles/email/tasks/main.yml index af796d3..176ac20 100644 --- a/roles/postfix/tasks/main.yml +++ b/roles/email/tasks/main.yml @@ -6,3 +6,6 @@ when: postfix.opendkim is defined - import_tasks: postfix.yml tags: postfix +# some basic security stuff that relies on working email +- name: install apticron + apt: name=apticron state=latest diff --git a/roles/postfix/tasks/opendkim.yml b/roles/email/tasks/opendkim.yml similarity index 100% rename from roles/postfix/tasks/opendkim.yml rename to roles/email/tasks/opendkim.yml diff --git a/roles/postfix/tasks/postfix.yml b/roles/email/tasks/postfix.yml similarity index 100% rename from roles/postfix/tasks/postfix.yml rename to roles/email/tasks/postfix.yml diff --git a/roles/postfix/tasks/unbound.yml b/roles/email/tasks/unbound.yml similarity index 100% rename from roles/postfix/tasks/unbound.yml rename to roles/email/tasks/unbound.yml diff --git a/roles/postfix/templates/KeyTable b/roles/email/templates/KeyTable similarity index 100% rename from roles/postfix/templates/KeyTable rename to roles/email/templates/KeyTable diff --git a/roles/postfix/templates/SigningTable b/roles/email/templates/SigningTable similarity index 100% rename from roles/postfix/templates/SigningTable rename to roles/email/templates/SigningTable diff --git a/roles/postfix/templates/main.cf b/roles/email/templates/main.cf similarity index 100% rename from roles/postfix/templates/main.cf rename to roles/email/templates/main.cf diff --git a/roles/postfix/templates/master.cf b/roles/email/templates/master.cf similarity index 100% rename from roles/postfix/templates/master.cf rename to roles/email/templates/master.cf diff --git a/roles/postfix/templates/mysql_vmail_aliases.cf b/roles/email/templates/mysql_vmail_aliases.cf similarity index 100% rename from roles/postfix/templates/mysql_vmail_aliases.cf rename to roles/email/templates/mysql_vmail_aliases.cf diff --git a/roles/postfix/templates/mysql_vmail_senders.cf b/roles/email/templates/mysql_vmail_senders.cf similarity index 100% rename from roles/postfix/templates/mysql_vmail_senders.cf rename to roles/email/templates/mysql_vmail_senders.cf diff --git a/roles/postfix/templates/mysql_vmail_users.cf b/roles/email/templates/mysql_vmail_users.cf similarity index 100% rename from roles/postfix/templates/mysql_vmail_users.cf rename to roles/email/templates/mysql_vmail_users.cf diff --git a/roles/postfix/templates/opendkim.conf b/roles/email/templates/opendkim.conf similarity index 100% rename from roles/postfix/templates/opendkim.conf rename to roles/email/templates/opendkim.conf diff --git a/roles/postfix/templates/opendkim.env b/roles/email/templates/opendkim.env similarity index 100% rename from roles/postfix/templates/opendkim.env rename to roles/email/templates/opendkim.env diff --git a/roles/postfix/vmail.sql b/roles/email/vmail.sql similarity index 100% rename from roles/postfix/vmail.sql rename to roles/email/vmail.sql diff --git a/roles/journalwatch/meta/main.yml b/roles/journalwatch/meta/main.yml deleted file mode 100644 index c2c4e37..0000000 --- a/roles/journalwatch/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- { role: postfix } diff --git a/roles/journalwatch/tasks/journalwatch.yml b/roles/journalwatch/tasks/journalwatch.yml deleted file mode 100644 index 74e8f68..0000000 --- a/roles/journalwatch/tasks/journalwatch.yml +++ /dev/null @@ -1,23 +0,0 @@ -- name: install journalwatch dependencies - apt: name=python3-systemd state=latest -- name: install journalwatch - git: - dest: /root/journalwatch - repo: 'https://github.com/The-Compiler/journalwatch.git' - version: b62f223bc36eabc193cfcf0d309d284da4f66463 -- name: create journalwatch config dir - file: path=/root/.config/journalwatch state=directory -- name: install journalwatch config files - copy: - src: files/{{item}} - dest: /root/.config/journalwatch/{{item}} - loop: - - config - - patterns -- name: delete old journalwatch crontab entry - file: path=/etc/cron.d/journalwatch state=absent -- name: create journalwatch crontab entry - cron: - name: "journalwatch" - minute: "*/10" - job: "/root/journalwatch/journalwatch.py mail" diff --git a/roles/journalwatch/tasks/main.yml b/roles/journalwatch/tasks/main.yml index 5621a8f..74e8f68 100644 --- a/roles/journalwatch/tasks/main.yml +++ b/roles/journalwatch/tasks/main.yml @@ -1,2 +1,23 @@ -- import_tasks: journalwatch.yml - tags: journalwatch +- name: install journalwatch dependencies + apt: name=python3-systemd state=latest +- name: install journalwatch + git: + dest: /root/journalwatch + repo: 'https://github.com/The-Compiler/journalwatch.git' + version: b62f223bc36eabc193cfcf0d309d284da4f66463 +- name: create journalwatch config dir + file: path=/root/.config/journalwatch state=directory +- name: install journalwatch config files + copy: + src: files/{{item}} + dest: /root/.config/journalwatch/{{item}} + loop: + - config + - patterns +- name: delete old journalwatch crontab entry + file: path=/etc/cron.d/journalwatch state=absent +- name: create journalwatch crontab entry + cron: + name: "journalwatch" + minute: "*/10" + job: "/root/journalwatch/journalwatch.py mail" diff --git a/roles/postfix/meta/main.yml b/roles/postfix/meta/main.yml deleted file mode 100644 index 3de0130..0000000 --- a/roles/postfix/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- { role: letsencrypt } diff --git a/roles/prosody/meta/main.yml b/roles/prosody/meta/main.yml deleted file mode 100644 index 3de0130..0000000 --- a/roles/prosody/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: -- { role: letsencrypt } diff --git a/site.yml b/site.yml index 3c5fe4e..32c2a20 100644 --- a/site.yml +++ b/site.yml @@ -12,8 +12,17 @@ - letsencrypt tags: letsencrypt -# FIXME make this a role, or several -- import_playbook: email.yml +- hosts: email + gather_facts: no + roles: + - email + tags: email + +- hosts: journalwatch + gather_facts: no + roles: + - journalwatch + tags: journalwatch - hosts: bind gather_facts: no -- 2.30.2