diff --git a/roles/mlmmj/tasks/main.yml b/roles/mlmmj/tasks/main.yml index 1718cbd..4c3c3b3 100644 --- a/roles/mlmmj/tasks/main.yml +++ b/roles/mlmmj/tasks/main.yml @@ -266,7 +266,7 @@ label: '{{ item.name }}@{{ item.domain }}' with_items: '{{ mlmmj_lists }}' -- name: Moderate subscription +- name: Set moderate subscription copy: dest: '/var/vmail/mlmmj/{{ item.name }}/control/submod' content: '' @@ -278,3 +278,67 @@ loop_control: label: '{{ item.name }}@{{ item.domain }}' with_items: '{{ mlmmj_lists }}' + +- name: Unset moderate subscription + file: + path: '/var/vmail/mlmmj/{{ item.name }}/control/submod' + state: absent + when: not (item.subscription_moderated | default(false)) + loop_control: + label: '{{ item.name }}@{{ item.domain }}' + with_items: '{{ mlmmj_lists }}' + +- name: Limit posts to subscribers + copy: + dest: '/var/vmail/mlmmj/{{ item.name }}/control/subonlypost' + content: '' + force: no + owner: mlmmj + group: mlmmj + mode: 0444 + when: item.subscribers_only | default(false) + loop_control: + label: '{{ item.name }}@{{ item.domain }}' + with_items: '{{ mlmmj_lists }}' + +- name: Allow off list posts + file: + path: '/var/vmail/mlmmj/{{ item.name }}/control/subonlypost' + state: absent + when: not (item.subscribers_only | default(false)) + loop_control: + label: '{{ item.name }}@{{ item.domain }}' + with_items: '{{ mlmmj_lists }}' + +- name: Moderate posts from non subscribers + copy: + dest: '/var/vmail/mlmmj/{{ item.name }}/control/modnonsubposts' + content: '' + force: no + owner: mlmmj + group: mlmmj + mode: 0444 + when: item.moderate_nonsubscribers | default(false) + loop_control: + label: '{{ item.name }}@{{ item.domain }}' + with_items: '{{ mlmmj_lists }}' + +- name: Deny posts from non subscribers + file: + path: '/var/vmail/mlmmj/{{ item.name }}/control/modnonsubposts' + state: absent + when: not (item.moderate_nonsubscribers | default(false)) + loop_control: + label: '{{ item.name }}@{{ item.domain }}' + with_items: '{{ mlmmj_lists }}' + +- name: Generate list of moderators + template: + dest: '/var/vmail/mlmmj/{{ item.name }}/control/moderators' + src: moderators.j2 + owner: mlmmj + group: mlmmj + mode: 0444 + loop_control: + label: '{{ item.name }}@{{ item.domain }}' + with_items: '{{ mlmmj_lists }}' diff --git a/roles/mlmmj/templates/moderators.j2 b/roles/mlmmj/templates/moderators.j2 new file mode 100644 index 0000000..055014a --- /dev/null +++ b/roles/mlmmj/templates/moderators.j2 @@ -0,0 +1,3 @@ +{% for moderator in item.moderators | default([]) %} +{{ moderator }} +{% endfor %}