mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
71 lines
2 KiB
YAML
71 lines
2 KiB
YAML
- name: Enable & Restart 'lokole' systemd service
|
|
systemd:
|
|
name: lokole
|
|
daemon_reload: yes
|
|
enabled: yes
|
|
state: restarted
|
|
when: lokole_enabled | bool
|
|
|
|
- name: Disable & Stop 'lokole' systemd service
|
|
systemd:
|
|
name: lokole
|
|
enabled: no
|
|
state: stopped
|
|
when: not lokole_enabled
|
|
|
|
# Apache
|
|
|
|
- name: Enable http://box{{ lokole_url }} via Apache # http://box/lokole
|
|
command: a2ensite lokole.conf
|
|
when: apache_install and lokole_enabled
|
|
|
|
- name: Disable http://box{{ lokole_url }} via Apache # http://box/lokole
|
|
command: a2dissite lokole.conf
|
|
when: apache_install and not lokole_enabled
|
|
|
|
- name: Restart Apache systemd service ({{ apache_service }})
|
|
systemd:
|
|
name: "{{ apache_service }}"
|
|
state: restarted
|
|
when: apache_enabled | bool
|
|
|
|
# NGINX
|
|
|
|
- name: "SHIM: Enable http://box{{ lokole_url }} via NGINX, by installing {{ nginx_config_dir }}/lokole-nginx.conf from template" # http://box/lokole
|
|
template:
|
|
src: lokole-nginx.conf.j2
|
|
dest: "{{ nginx_config_dir }}/lokole-nginx.conf"
|
|
when: nginx_install and lokole_enabled
|
|
|
|
- name: "SHIM: Disable http://box{{ lokole_url }} via NGINX, by removing {{ nginx_config_dir }}/lokole-nginx.conf" # http://box/lokole
|
|
file:
|
|
path: "{{ nginx_config_dir }}/lokole-nginx.conf"
|
|
state: absent
|
|
when: nginx_install and not lokole_enabled
|
|
|
|
- name: Restart 'nginx' systemd service
|
|
systemd:
|
|
name: nginx
|
|
state: restarted
|
|
when: nginx_enabled | bool
|
|
|
|
|
|
- name: Add 'lokole' variable values to {{ iiab_ini_file }}
|
|
ini_file:
|
|
path: "{{ iiab_ini_file }}"
|
|
section: lokole
|
|
option: "{{ item.option }}"
|
|
value: "{{ item.value | string }}"
|
|
with_items:
|
|
- option: name
|
|
value: lokole
|
|
- option: description
|
|
value: '"Lokole is an email service that works offline, for rural communities."'
|
|
- option: lokole_run_directory
|
|
value: "{{ lokole_run_directory }}"
|
|
- option: lokole_url
|
|
value: "{{ lokole_url }}"
|
|
- option: lokole_full_url
|
|
value: "{{ lokole_full_url }}"
|
|
- option: lokole_enabled
|
|
value: "{{ lokole_enabled }}"
|