diff --git a/.gitignore b/.gitignore index 5796b11..1fb7bca 100644 --- a/.gitignore +++ b/.gitignore @@ -146,5 +146,6 @@ message*.txt config.py inventory.txt ansible/host_vars/* +!ansible/host_vars/example.tld.yml !.keep TODO.md diff --git a/ansible/host_vars/example.tld.yml b/ansible/host_vars/example.tld.yml new file mode 100644 index 0000000..77a1009 --- /dev/null +++ b/ansible/host_vars/example.tld.yml @@ -0,0 +1,10 @@ +--- +auth_user: exampleuser +auth_pass: changemenow +domain: autoreply.example.tld + +users: + - name: Foobar + email: foobar@example.com + - name: Barbaz + email: barbaz@example.net diff --git a/ansible/inventory.sample.txt b/ansible/inventory.sample.txt new file mode 100644 index 0000000..9a660c3 --- /dev/null +++ b/ansible/inventory.sample.txt @@ -0,0 +1,2 @@ +[autoreply_editor] +example.tld diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 0d8e762..cc7fc66 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -11,12 +11,6 @@ src: config.py.j2 dest: autoreply-editor/config.py - - name: Create empty message file if it does not exist - copy: - content: "" - dest: "autoreply-editor/{{ message_file }}" - force: no - - name: Install specified python requirements pip: requirements: requirements.txt @@ -45,12 +39,6 @@ path: autoresponders state: directory - - name: Create autoreply mailbot filter - template: - src: filter-autoreply.j2 - dest: .filter-autoreply - mode: 0600 - handlers: - name: reread supervisord command: supervisorctl reread diff --git a/ansible/templates/config.py.j2 b/ansible/templates/config.py.j2 index 7c4f1e2..c67c559 100644 --- a/ansible/templates/config.py.j2 +++ b/ansible/templates/config.py.j2 @@ -1,3 +1,7 @@ -MESSAGE_FILE = "{{ message_file }}" +"""Configuration file""" +# Username and password for logging in to the site BASIC_AUTH_USERNAME = "{{ auth_user }}" BASIC_AUTH_PASSWORD = "{{ auth_pass }}" + +# List of users. First value is the full name, second the email address +USERS = [{% for user in users %}("{{ user.name }}", "{{ user.email }}"),{% endfor %}] diff --git a/ansible/templates/filter-autoreply.j2 b/ansible/templates/filter-autoreply.j2 deleted file mode 100644 index a827e15..0000000 --- a/ansible/templates/filter-autoreply.j2 +++ /dev/null @@ -1,5 +0,0 @@ -logfile "$HOME/mailfilter-autoreply.log" - -FROM="{{ mail_from }}" - -to "| mailbot -T reply -t $HOME/autoreply-editor/{{ message_file }} -d $HOME/autoresponders/autoresponsedb -N -A 'From: $FROM' /var/qmail/bin/qmail-inject -f ''"