- name: Install apache2 package: name: - apache2 - apache2-utils state: present - name: Apache modules apache2_module: state: present name: "{{ a2_mod }}" loop: - rewrite - cgid - ssl loop_control: loop_var: a2_mod notify: mailman restart apache2 - name: Make sure packaged default site disabled command: a2dissite 000-default.conf args: removes: /etc/apache2/sites-enabled/000-default.conf - name: Install mailman package: name: - mailman - python-is-python2 state: present # Install index.html, robots.txt - name: Install mailman index.html copy: src: index.html dest: /var/www/index.html owner: root group: root mode: '0444' - name: Install mailman robots.txt copy: src: robots.txt dest: /var/www/robots.txt owner: root group: root mode: '0444' - name: multihost mailman configs block: - name: Create multihost dir file: path: /srv/mailman state: directory owner: root group: root mode: '0755' - name: Install multihost mailman config copy: src: mm_cfg_multihost.py dest: /etc/mailman/mm_cfg.py owner: root group: root mode: '0444' - name: Create mm sites file template: src: sites.j2 dest: /etc/mailman/sites owner: root group: root mode: '0444' - name: Create mailman sites and lists include_role: name: mailman-site vars: mailman_site: "{{ site }}" loop: "{{ mailman_sites }}" loop_control: loop_var: site - name: Write /etc/aliases.domain template: src: "domain_aliases.j2" dest: "/etc/aliases.domain" mode: 0444 - name: Install mailman mk-archives-index copy: src: mk-archives-index dest: /usr/local/sbin/mk-archives-index owner: root group: root mode: '0744' - name: Set cron PATH for mk-archives-index cron: name: PATH env: yes job: /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin - name: Pre-run mk-archives-index shell: cmd: /usr/local/sbin/mk-archives-index > /var/www/archives.yaml args: creates: /var/www/archives.yaml - name: Enable mk-archives-index cron cron: name: "mk-archives-index cron" state: present job: mk-archives-index > /var/www/archives.yaml minute: "0" hour: "0" when: mailman_multihost - name: normal mailman configs block: - name: Install normal mailman config template: src: mm_cfg.py.j2 dest: /etc/mailman/mm_cfg.py owner: root group: root mode: '0444' - name: Create normal mailman vhost config template: src: mailman.vhost.j2 dest: "/etc/apache2/sites-enabled/50-{{ mailman_listdomain }}.conf" owner: root group: root mode: '0644' notify: mailman reload apache2 - name: Enable mailman site service service: name: "mailman" enabled: yes - name: Create mailman site lists include_role: name: mailman-list vars: mm_site_name: "_default" mm_list_name: "{{ list.name }}" mm_list_description: "{{ list.description }}" mm_list_admin: "{{ list.admin }}" mm_list_password: "{{ list.password }}" loop: "{{ mailman_lists }}" loop_control: loop_var: list when: not mailman_multihost