further ansible tasks

This commit is contained in:
2021-12-19 20:51:04 +01:00
parent 979039094e
commit d06c80e218
5 changed files with 38 additions and 2 deletions

3
ansible/ansible.cfg Normal file
View File

@@ -0,0 +1,3 @@
[defaults]
interpreter_python = python3
inventory = inventory.txt

View File

@@ -1,2 +1,3 @@
--- ---
message_file: message.txt message_file: message.txt
port: 5000

View File

@@ -1,5 +1,5 @@
- hosts: autoreply_editor - hosts: autoreply_editor
gather_facts: false gather_facts: true
tasks: tasks:
- name: Get newest version of autoreply-editor - name: Get newest version of autoreply-editor
git: git:
@@ -10,3 +10,31 @@
template: template:
src: config.py.j2 src: config.py.j2
dest: autoreply-editor/config.py dest: autoreply-editor/config.py
- 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: "'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
handlers:
- name: reread supervisord
command: supervisorctl reread
listen: reload supervisord
- name: update supervisord
command: supervisorctl update
listen: reload supervisord

View File

@@ -0,0 +1,4 @@
[program:autoreply-editor]
directory=/home/{{ ansible_user_id }}/autoreply-editor
command=gunicorn --bind 0.0.0.0:{{ port }} wsgi:app
startsecs=60

View File

@@ -1,3 +1,3 @@
MESSAGE_FILE = "{{ message_file }}" MESSAGE_FILE = "{{ message_file }}"
BASIC_AUTH_USERNAME = "{{ auth_user }} BASIC_AUTH_USERNAME = "{{ auth_user }}"
BASIC_AUTH_PASSWORD = "{{ auth_pass }}" BASIC_AUTH_PASSWORD = "{{ auth_pass }}"