Files
autoreply-editor/ansible/playbook.yml
2021-12-19 22:45:07 +01:00

61 lines
1.7 KiB
YAML

- hosts: autoreply_editor
gather_facts: true
tasks:
- name: Get newest version of autoreply-editor
git:
repo: https://src.mehl.mx/mxmehl/autoreply-editor.git
dest: autoreply-editor
- name: Deploy config file
template:
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
chdir: autoreply-editor
extra_args: --user
- name: Register domain for service
command: "uberspace web domain add {{ domain }}"
register: cmdrtrn
failed_when:
# Adding an already registered domain fails, but we ignore this specific error
- cmdrtrn.rc != 0
- "'It is already configured for your Uberspace account' not in cmdrtrn.stderr"
- name: Create web backend for service
command: "uberspace web backend set {{ domain }} --http --port {{ port }}"
- name: Deploy supervisord service
template:
src: autoreply-editor.ini.j2
dest: etc/services.d/autoreply-editor.ini
notify: reload supervisord
- name: Create autoresponders directory
file:
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
listen: reload supervisord
- name: update supervisord
command: supervisorctl update
listen: reload supervisord