ansible/roles/mailman/tasks/main.yml
2013-12-06 16:56:46 +00:00

246 lines
6.4 KiB
YAML

---
# Configuration for Mailman 3
# PostgreSQL initialization must have been done already
#
# SELinux
#
- name: install semanage
yum: pkg=policycoreutils-python state=installed
- name: set the SELinux policy for the configuration directory
command: semanage fcontext -a -t etc_t "${mailman_webui_confdir}(/.*)?"
- name: set the SELinux policy for the fulltext index
command: semanage fcontext -a -t httpd_sys_content_t "${mailman_webui_basedir}/kittystore_search_index(/.*)?"
- name: set the SELinux policy for the static files directory
command: semanage fcontext -a -t httpd_sys_content_t "${mailman_webui_basedir}/static(/.*)?"
- name: set the SELinux policy for the log directory
command: semanage fcontext -a -t httpd_log_t "/var/log/hyperkitty(/.*)?"
- name: allow Apache to remotely connect to PostgreSQL
seboolean: name=httpd_can_network_connect_db state=yes persistent=yes
- name: allow Apache to remotely connect to Mailman
seboolean: name=httpd_can_network_connect state=yes persistent=yes
- name: allow Apache to remotely connect to Memcached
seboolean: name=httpd_can_network_memcache state=yes persistent=yes
#
# Packages
#
- name: install needed packages
yum: pkg=$item state=installed
with_items:
- mailman3
- mailman3-selinux
- python-psycopg2
- python-storm-postgresql
- kittystore
- hyperkitty
- hyperkitty-selinux
- postorius
- memcached
- python-pylibmc
- yum-plugin-post-transaction-actions
- mailman3-fedmsg-plugin
tags:
- packages
#
# Initialize mailman (must be done after settings up the DBs)
#
- name: add mailman to the apache group
user: name=mailman groups=apache append=yes
tags:
- config
notify:
- restart mailman3
- name: set the mailman conffile
template: src=mailman.cfg.j2 dest=/etc/mailman.cfg
tags:
- config
notify:
- restart mailman3
#
# Logging
#
- name: hyperkitty logging -- directory
file: path=/var/log/hyperkitty state=directory
owner=root group=apache mode=2775
- name: hyperkitty logging -- file creation
copy: content="" dest=/var/log/hyperkitty/hyperkitty.log
force=no
- name: hyperkitty logging -- file permissions
file: path=/var/log/hyperkitty/hyperkitty.log state=file
owner=root group=apache mode=664
- name: hyperkitty logging -- rotation
copy: src=hyperkitty.logrotate.conf
dest=/etc/logrotate.d/hyperkitty
#
# HyperKitty + Postorius setup
#
- name: create the configuration directory
file: path=${mailman_webui_confdir} state=directory
- name: install the hyperkitty settings file
template: src=settings.py.j2
dest=${mailman_webui_confdir}/settings.py
owner=root group=apache mode=0640
tags:
- config
notify:
- reload apache
- restart mailman3
- name: install the hyperkitty settings admin file
template: src=settings_admin.py.j2
dest=${mailman_webui_confdir}/settings_admin.py
owner=root group=root mode=0600
tags:
- config
- name: install the hyperkitty urls file
copy: src=urls.py
dest=${mailman_webui_confdir}/urls.py
owner=root group=root mode=0644
tags:
- config
notify:
- reload apache
- restart mailman3
- name: install the hyperkitty wsgi file
copy: src=webui.wsgi
dest=${mailman_webui_confdir}/webui.wsgi
owner=root group=root mode=0644
tags:
- config
notify:
- reload apache
- name: install the hyperkitty/postorius dummy httpd conf file
template: src=apache-dummy.conf.j2
dest=/etc/httpd/conf.d/$item.conf
with_items:
- hyperkitty
- postorius
tags:
- config
notify:
- reload apache
- name: install the hyperkitty httpd conf file
template: src=apache.conf.j2
dest=/etc/httpd/conf.d/mailman-webui.conf
tags:
- config
notify:
- reload apache
- name: copy the manage.py script
command: /bin/cp /etc/hyperkitty/sites/default/manage.py ${mailman_webui_confdir}/manage.py
creates=${mailman_webui_confdir}/manage.py
- name: create the kittystore plain text index dir
file: path=${mailman_webui_basedir}/kittystore_search_index
state=directory owner=mailman group=mailman mode=0755
- name: create the hyperkitty static files dir
file: path=${mailman_webui_basedir}/static
state=directory owner=root group=root mode=0755
- name: install the kittystore cache cronjob
template: src=hyperkitty.cronjob.sh.j2
dest=/etc/cron.daily/hyperkitty
owner=root group=root mode=0755
#
# Plug HyperKitty into Mailman
#
- name: copy the mailman-hyperkitty conffile
template: src=mailman-hyperkitty.cfg.j2
dest=${mailman_webui_confdir}/mailman-hyperkitty.cfg
tags:
- config
notify:
- restart mailman3
- name: symlink the hyperkitty conffile in mailman directory
file: src=${mailman_webui_confdir}/mailman-hyperkitty.cfg
dest=/etc/mailman3.d/hyperkitty.cfg state=link
tags:
- config
notify:
- restart mailman3
#
# Scripts
#
- name: install the migration conffile
template: src=mailman-migration.conf.j2
dest=/etc/mailman-migration.conf
owner=root group=root mode=0644
- name: create the scripts dir
file: path=${mailman_webui_basedir}/bin
state=directory owner=root group=root mode=0755
- name: install the migration environment
template: src=mailman-migration-path.sh.j2
dest=/etc/profile.d/mailman-migration-path.sh
owner=root group=root mode=0644
- name: install the scripts
copy: src=${item} dest=${mailman_webui_basedir}/bin/${item}
owner=root group=root mode=0755
with_items:
- yamlget
- pg-give-rights.py
- post-update.sh
- import-mm2.py
- name: copy the initial user fixture
copy: src=postorius.initial-user.json
dest=/etc/postorius/sites/default/initial-user.json
owner=root group=apache mode=0640
# Sync databases
- name: install the post-transaction trigger
template: src=post-transaction.action.j2
dest=/etc/yum/post-actions/hyperkitty.action
- name: run the post-update script
command: ${mailman_webui_basedir}/bin/post-update.sh
# Postfix
- name: set the postfix conffile
copy: src=postfix-main.cf dest=/etc/postfix/main.cf
notify:
- restart postfix
- name: create the postfix aliases
command: mailman3 aliases
# Memcached
- name: set the memcached sysconfig file
copy: src=memcached.sysconfig dest=/etc/sysconfig/memcached
notify:
- restart memcached
- name: start memcached
service: state=started enabled=yes name=memcached