add support to create mailing lists
This commit is contained in:
parent
b761932225
commit
8130b257fb
4 changed files with 23 additions and 1 deletions
|
|
@ -17,3 +17,6 @@ mailman:
|
||||||
session_timeout: 3600
|
session_timeout: 3600
|
||||||
archiver:
|
archiver:
|
||||||
key: "{{ lookup('password', '/dev/null length=128') }}"
|
key: "{{ lookup('password', '/dev/null length=128') }}"
|
||||||
|
list_defaults:
|
||||||
|
settings: {}
|
||||||
|
lists: {}
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,9 @@ def run_module():
|
||||||
ml = domain.create_list(addr_local)
|
ml = domain.create_list(addr_local)
|
||||||
|
|
||||||
ml_settings = ml.settings
|
ml_settings = ml.settings
|
||||||
|
if result['changed']:
|
||||||
|
result['diff']['before'] = None
|
||||||
|
else:
|
||||||
result['diff']['before'] = dict(ml_settings)
|
result['diff']['before'] = dict(ml_settings)
|
||||||
|
|
||||||
for i in module.params['settings']:
|
for i in module.params['settings']:
|
||||||
|
|
|
||||||
10
tasks/list.yml
Normal file
10
tasks/list.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
- set_fact:
|
||||||
|
current_list: "{{ {}|combine(mailman.list_defaults, {'name': listname}, mailman.lists[listname], recursive=True) }}"
|
||||||
|
|
||||||
|
- name: "setup mailing list ( {{ current_list.name }} )"
|
||||||
|
mailman_list:
|
||||||
|
api_url: "http://{{ mailman.api.hostname }}:{{ mailman.api.port }}/{{ mailman.api.version }}"
|
||||||
|
api_user: "{{ mailman.api.admin.name }}"
|
||||||
|
api_password: "{{ mailman.api.admin.pw }}"
|
||||||
|
name: "{{ current_list.name }}"
|
||||||
|
settings: "{{ current_list.settings }}"
|
||||||
|
|
@ -53,3 +53,9 @@
|
||||||
|
|
||||||
- name: flush handlers to get mailman ready
|
- name: flush handlers to get mailman ready
|
||||||
meta: flush_handlers
|
meta: flush_handlers
|
||||||
|
|
||||||
|
- name: setup mailing lists
|
||||||
|
include_tasks: list.yml
|
||||||
|
loop: "{{ mailman.lists.keys()|list }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: listname
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue