calendar-social/ansible/roles/gunicorn/tasks/main.yml

57 lines
1.1 KiB
YAML

---
- name: Install Supervisor
dnf:
name: "{{ item }}"
state: present
with_items:
- supervisor
- name: Start supervisord
service:
name: supervisord
state: restarted
- name: Create the Gunicorn config directory
file:
path: /etc/gunicorn
state: directory
owner: "{{ user_name }}"
group: "{{ group_name }}"
mode: 0700
- name: Create the Gunicorn config file in /etc/gunicorn
template:
src: gunicorn.conf.j2
dest: /etc/gunicorn/gunicorn.conf
- name: Create the Gunicorn log directory
file:
path: /var/log/gunicorn
state: directory
owner: "{{ user_name }}"
group: "{{ group_name }}"
mode: 0700
- name: Create the Supervisor config file for Gunicorn
template:
src: supervisor.conf.j2
dest: /etc/supervisord.d/gunicorn.ini
- name: Re-read the Supervisor config files
supervisorctl:
name: gunicorn
state: present
- name: Start Gunicorn with supervisord
supervisorctl:
name: gunicorn
state: restarted
when: enabled
- name: Stop Gunicorn for local dev
supervisorctl:
name: gunicorn
state: stopped
when: not enabled