2013-08-12 21:17:21 +00:00
|
|
|
# create a new mailman server
|
|
|
|
# NOTE: make sure there is room/space for this server on the vmhost
|
2014-01-06 17:49:22 +00:00
|
|
|
# NOTE: most of these vars_path come from group_vars/mirrorlist or from hostvars
|
2013-08-12 21:17:21 +00:00
|
|
|
|
2017-10-15 19:54:19 +00:00
|
|
|
- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=mailman:mailman-stg"
|
2013-08-12 21:17:21 +00:00
|
|
|
|
|
|
|
- name: make the box be real
|
2014-01-20 19:01:12 +00:00
|
|
|
hosts: mailman-stg:mailman
|
2013-08-12 21:17:21 +00:00
|
|
|
user: root
|
|
|
|
gather_facts: True
|
|
|
|
|
2013-09-03 17:44:29 +02:00
|
|
|
vars_files:
|
2014-01-17 11:10:52 +00:00
|
|
|
- /srv/web/infra/ansible/vars/global.yml
|
2015-01-09 22:59:18 +00:00
|
|
|
- "/srv/private/ansible/vars.yml"
|
2014-01-17 11:10:52 +00:00
|
|
|
- "/srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml"
|
2013-08-12 21:17:21 +00:00
|
|
|
|
2013-08-19 20:12:26 +00:00
|
|
|
roles:
|
2014-01-23 17:12:40 +00:00
|
|
|
- base
|
|
|
|
- rkhunter
|
2017-05-05 22:12:33 +00:00
|
|
|
- nagios_client
|
2014-06-23 00:49:31 +00:00
|
|
|
- hosts
|
2014-01-23 17:12:40 +00:00
|
|
|
- fas_client
|
2014-03-21 13:41:06 +00:00
|
|
|
- collectd/base
|
2014-06-14 20:58:52 +00:00
|
|
|
- sudo
|
2014-08-01 18:23:40 +02:00
|
|
|
- { role: openvpn/client,
|
|
|
|
when: env != "staging" }
|
2016-05-12 08:39:57 +00:00
|
|
|
- spamassassin
|
2016-08-08 13:51:44 +02:00
|
|
|
- mod_wsgi
|
2013-08-19 20:12:26 +00:00
|
|
|
|
2013-08-12 21:17:21 +00:00
|
|
|
tasks:
|
|
|
|
# this is how you include other task lists
|
2017-10-17 17:37:03 +00:00
|
|
|
- import_tasks: "{{ tasks_path }}/yumrepos.yml"
|
|
|
|
- import_tasks: "{{ tasks_path }}/2fa_client.yml"
|
|
|
|
- import_tasks: "{{ tasks_path }}/motd.yml"
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
handlers:
|
2017-10-15 20:33:11 +00:00
|
|
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
|
2014-02-03 11:31:37 +00:00
|
|
|
#
|
2013-09-03 17:44:29 +02:00
|
|
|
# Database setup
|
2014-02-03 11:31:37 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
- name: prepare setting up the database
|
2015-04-12 22:08:43 +00:00
|
|
|
hosts: db01.stg.phx2.fedoraproject.org:db01.phx2.fedoraproject.org
|
2014-02-03 11:31:37 +00:00
|
|
|
gather_facts: no
|
|
|
|
user: root
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: install psycopg2 for the postgresql ansible modules
|
2017-10-09 00:38:19 +02:00
|
|
|
package: name=python-psycopg2 state=present
|
2014-02-03 11:31:37 +00:00
|
|
|
tags:
|
|
|
|
- packages
|
|
|
|
|
2013-09-03 17:44:29 +02:00
|
|
|
- name: setup the database
|
2015-04-12 22:08:43 +00:00
|
|
|
hosts: db01.stg.phx2.fedoraproject.org:db01.phx2.fedoraproject.org
|
2013-09-03 17:44:29 +02:00
|
|
|
gather_facts: no
|
2016-02-02 21:24:45 +00:00
|
|
|
become: yes
|
|
|
|
become_user: postgres
|
2013-09-03 17:44:29 +02:00
|
|
|
vars_files:
|
2014-01-17 11:10:52 +00:00
|
|
|
- /srv/web/infra/ansible/vars/global.yml
|
2015-01-09 22:59:18 +00:00
|
|
|
- "/srv/private/ansible/vars.yml"
|
2014-01-17 11:10:52 +00:00
|
|
|
- "/srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml"
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
tasks:
|
2014-01-17 11:10:52 +00:00
|
|
|
# mailman auto-updates its schema, there can only be one admin user
|
|
|
|
- name: mailman DB user
|
|
|
|
postgresql_user: name=mailmanadmin password={{ mailman_mm_db_pass }}
|
|
|
|
- name: hyperkitty DB admin user
|
|
|
|
postgresql_user: name=hyperkittyadmin password={{ mailman_hk_admin_db_pass }}
|
|
|
|
- name: hyperkitty DB user
|
|
|
|
postgresql_user: name=hyperkittyapp password={{ mailman_hk_db_pass }}
|
|
|
|
- name: databases creation
|
|
|
|
postgresql_db: name={{ item }} owner="{{ item }}admin" encoding=UTF-8
|
|
|
|
with_items:
|
|
|
|
- mailman
|
|
|
|
- hyperkitty
|
2014-05-30 08:12:52 +00:00
|
|
|
- name: test database creation
|
|
|
|
postgresql_db: name=test_hyperkitty owner=hyperkittyadmin encoding=UTF-8
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Real MM/HK-specific work
|
|
|
|
- name: setup mailman and hyperkitty
|
2014-01-20 19:01:12 +00:00
|
|
|
hosts: mailman-stg:mailman
|
2013-09-03 17:44:29 +02:00
|
|
|
user: root
|
|
|
|
gather_facts: True
|
|
|
|
|
|
|
|
vars_files:
|
2014-01-17 11:10:52 +00:00
|
|
|
- /srv/web/infra/ansible/vars/global.yml
|
2015-01-09 22:59:18 +00:00
|
|
|
- "/srv/private/ansible/vars.yml"
|
2014-01-17 11:10:52 +00:00
|
|
|
- "/srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml"
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
roles:
|
2014-01-23 17:12:40 +00:00
|
|
|
- role: mailman
|
2014-09-18 08:46:01 +00:00
|
|
|
mailman_mailman_db_pass: "{{ mailman_mm_db_pass }}"
|
|
|
|
mailman_hyperkitty_admin_db_pass: "{{ mailman_hk_admin_db_pass }}"
|
|
|
|
mailman_hyperkitty_db_pass: "{{ mailman_hk_db_pass }}"
|
|
|
|
mailman_hyperkitty_cookie_key: "{{ mailman_hk_cookie_key }}"
|
2014-03-14 15:47:11 +00:00
|
|
|
- fedmsg/base
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
tasks:
|
2013-10-01 13:03:30 +00:00
|
|
|
- name: install more needed packages
|
2017-10-09 00:38:19 +02:00
|
|
|
package: name={{ item }} state=present
|
2013-10-01 13:03:30 +00:00
|
|
|
with_items:
|
|
|
|
- tar
|
|
|
|
tags:
|
|
|
|
- packages
|
2013-09-03 17:44:29 +02:00
|
|
|
|
|
|
|
#- name: easy access to the postgresql databases
|
|
|
|
# template: src=$files/mailman/pgpass.j2 dest=/root/.pgpass
|
|
|
|
# owner=root group=root mode=0600
|
|
|
|
|
|
|
|
- name: start services
|
2014-01-01 19:15:11 +00:00
|
|
|
service: state=started enabled=yes name={{ item }}
|
2013-09-03 17:44:29 +02:00
|
|
|
with_items:
|
2013-10-01 14:02:01 +00:00
|
|
|
- httpd
|
|
|
|
- mailman3
|
|
|
|
- postfix
|
2015-12-15 18:49:44 +00:00
|
|
|
when: inventory_hostname.startswith('mailman01.phx2') or inventory_hostname.startswith('lists-dev')
|
2013-09-03 17:44:29 +02:00
|
|
|
|
2013-08-12 21:17:21 +00:00
|
|
|
handlers:
|
2017-10-15 20:33:11 +00:00
|
|
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|