Erster Wurf für einen Mailinglisten-Configurator
This commit is contained in:
parent
77e4071fb4
commit
808f8afdb1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
# ---> Ansible
|
||||
*.retry
|
||||
*~
|
||||
|
||||
|
8
inventory.standard
Normal file
8
inventory.standard
Normal file
@ -0,0 +1,8 @@
|
||||
leineserver ansible_user=root ansible_host=5.189.167.164 ansible_port=30419
|
||||
|
||||
[mailserver]
|
||||
leineserver
|
||||
|
||||
[social]
|
||||
leineserver
|
||||
|
7
make-newlist.yml
Normal file
7
make-newlist.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
# Playbook to customize a mlmmj mailing list setup
|
||||
- hosts: leineserver
|
||||
|
||||
roles:
|
||||
- role: mlmmj-newlist
|
||||
|
29
roles/mlmmj-newlist/.travis.yml
Normal file
29
roles/mlmmj-newlist/.travis.yml
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
language: python
|
||||
python: "2.7"
|
||||
|
||||
# Use the new container infrastructure
|
||||
sudo: false
|
||||
|
||||
# Install ansible
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-pip
|
||||
|
||||
install:
|
||||
# Install ansible
|
||||
- pip install ansible
|
||||
|
||||
# Check ansible version
|
||||
- ansible --version
|
||||
|
||||
# Create ansible.cfg with correct roles_path
|
||||
- printf '[defaults]\nroles_path=../' >ansible.cfg
|
||||
|
||||
script:
|
||||
# Basic role syntax check
|
||||
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
38
roles/mlmmj-newlist/README.md
Normal file
38
roles/mlmmj-newlist/README.md
Normal file
@ -0,0 +1,38 @@
|
||||
Role Name
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
38
roles/mlmmj-newlist/defaults/main.yml
Normal file
38
roles/mlmmj-newlist/defaults/main.yml
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
# defaults file for mlmmj-newlist
|
||||
|
||||
spool_dir: '/var/spool/mlmmj'
|
||||
user: 'mlmmj'
|
||||
multidomain: True
|
||||
# may be commit via cmdline or from playbook
|
||||
mailinglist: 'testing@lists.leinelab.de'
|
||||
|
||||
|
||||
# for details see http://mlmmj.org/docs/tunables/
|
||||
|
||||
# boolean config files
|
||||
mlmmj_config:
|
||||
language: 'de'
|
||||
boolean:
|
||||
- name: 'moderated'
|
||||
value: False
|
||||
- name: 'modonlypost'
|
||||
value: False
|
||||
- name: 'subonlypost'
|
||||
value: True
|
||||
- name: 'subonlyget'
|
||||
value: True
|
||||
- name: 'notmetoo'
|
||||
value: False
|
||||
|
||||
templates:
|
||||
- name: 'customheaders'
|
||||
value: True
|
||||
- name: 'footer'
|
||||
value: True
|
||||
- name: 'prefix'
|
||||
value: True
|
||||
- name: 'maxmailsize'
|
||||
value: False
|
||||
|
||||
|
2
roles/mlmmj-newlist/defaults/main.yml~
Normal file
2
roles/mlmmj-newlist/defaults/main.yml~
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# defaults file for mlmmj-newlist
|
2
roles/mlmmj-newlist/handlers/main.yml
Normal file
2
roles/mlmmj-newlist/handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# handlers file for mlmmj-newlist
|
53
roles/mlmmj-newlist/meta/main.yml
Normal file
53
roles/mlmmj-newlist/meta/main.yml
Normal file
@ -0,0 +1,53 @@
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
|
||||
min_ansible_version: 2.9
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
51
roles/mlmmj-newlist/tasks/main.yml
Normal file
51
roles/mlmmj-newlist/tasks/main.yml
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
# tasks file for mlmmj-newlist
|
||||
- name: register a list_domain variable/fact
|
||||
set_fact:
|
||||
list_domain: "{{ mailinglist.split('@') }}"
|
||||
|
||||
- name: find mailinglist folder according to ansible config
|
||||
stat:
|
||||
path: '{{ spool_dir }}/{{ list_domain[1] }}/{{ list_domain[0] }}'
|
||||
register: listpath
|
||||
|
||||
- name: fail if listpath does not exists
|
||||
fail:
|
||||
msg: 'It seems the mailinglist folder does not exists'
|
||||
when: not listpath.stat.exists
|
||||
|
||||
- name: setting boolean config vars for list
|
||||
file:
|
||||
path: '{{ listpath.stat.path }}/control/{{ item.name }}'
|
||||
owner: '{{ user|default("mlmmj") }}'
|
||||
group: '{{ group|default("root") }}'
|
||||
mode: '0640'
|
||||
state: 'touch'
|
||||
loop: '{{ mlmmj_config.boolean }}'
|
||||
when: item.value
|
||||
|
||||
- name: make sure boolean config vars for list removed
|
||||
file:
|
||||
path: '{{ listpath.stat.path }}/control/{{ item.name }}'
|
||||
state: 'absent'
|
||||
loop: '{{ mlmmj_config.boolean }}'
|
||||
when: not item.value
|
||||
|
||||
- name: setting complex config vars for list via templates
|
||||
template:
|
||||
src: 'templates/control/{{ item.name }}.j2'
|
||||
dest: '{{ listpath.stat.path }}/control/{{ item.name }}'
|
||||
owner: '{{ user|default("mlmmj") }}'
|
||||
group: '{{ group|default("root") }}'
|
||||
mode: '0640'
|
||||
loop: '{{ mlmmj_config.templates }}'
|
||||
when: item.value
|
||||
|
||||
- name: make sure complex config vars for list are removed
|
||||
file:
|
||||
path: '{{ listpath.stat.path }}/control/{{ item.name }}'
|
||||
state: 'absent'
|
||||
loop: '{{ mlmmj_config.templates }}'
|
||||
when: not item.value
|
||||
|
||||
|
2
roles/mlmmj-newlist/tasks/main.yml~
Normal file
2
roles/mlmmj-newlist/tasks/main.yml~
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# tasks file for mlmmj-newlist
|
5
roles/mlmmj-newlist/templates/control/customheaders.j2
Normal file
5
roles/mlmmj-newlist/templates/control/customheaders.j2
Normal file
@ -0,0 +1,5 @@
|
||||
Mailing-List: contact {{ list_domain[0] }}+help@{{ list_domain[1] }} run by mlmmj
|
||||
List-Post: <mailto:{{ mailinglist }}>
|
||||
List-Help: <mailto:{{ list_domain[0] }}+help@{{ list_domain[1] }}>
|
||||
List-Unsubscribe: <mailto:{{ list_domain[0] }}+unsubscribe@{{ list_domain[1] }}>
|
||||
List-Subscribe: <mailto:{{ list_domain[0] }}+subscribe@{{ list_domain[1] }}>
|
10
roles/mlmmj-newlist/templates/control/footer.j2
Normal file
10
roles/mlmmj-newlist/templates/control/footer.j2
Normal file
@ -0,0 +1,10 @@
|
||||
--
|
||||
Mailingliste: {{ list_domain[0] }} on {{ list_domain[1] }}
|
||||
|
||||
Für folgende Aktionen einfach eine (leere) Mail an
|
||||
die nachstehenden Adressen schicken:
|
||||
Abmelden: {{ list_domain[0] }}-unsubscribe@{{ list_domain[1] }}
|
||||
Hilfe: {{ list_domain[0] }}-help@{{ list_domain[1] }}
|
||||
FAQ: {{ list_domain[0] }}-faq@{{ list_domain[1] }}
|
||||
List-Owner: {{ list_domain[0] }}-owner@{{ list_domain[1] }}
|
||||
|
0
roles/mlmmj-newlist/templates/control/footer.j2~
Normal file
0
roles/mlmmj-newlist/templates/control/footer.j2~
Normal file
1
roles/mlmmj-newlist/templates/control/prefix.j2
Normal file
1
roles/mlmmj-newlist/templates/control/prefix.j2
Normal file
@ -0,0 +1 @@
|
||||
[{{ mailinglist_prefix | default(list_domain[0]) }}]
|
0
roles/mlmmj-newlist/templates/control/prefix.j2~
Normal file
0
roles/mlmmj-newlist/templates/control/prefix.j2~
Normal file
2
roles/mlmmj-newlist/tests/inventory
Normal file
2
roles/mlmmj-newlist/tests/inventory
Normal file
@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
5
roles/mlmmj-newlist/tests/test.yml
Normal file
5
roles/mlmmj-newlist/tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- mlmmj-newlist
|
2
roles/mlmmj-newlist/vars/main.yml
Normal file
2
roles/mlmmj-newlist/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for mlmmj-newlist
|
Loading…
Reference in New Issue
Block a user