1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/lokole/tasks/enable.yml

66 lines
2 KiB
YAML
Raw Normal View History

2019-09-14 22:52:02 +00:00
- name: Enable & Restart 'lokole' systemd service, with daemon_reload, if lokole_enabled
systemd:
daemon_reload: yes
name: lokole
enabled: yes
state: restarted
when: lokole_enabled | bool
- name: Disable 'lokole' service, if not lokole_enabled
systemd:
daemon_reload: yes
name: lokole
enabled: no
state: stopped
when: not lokole_enabled
- name: Install /etc/{{ apache_config_dir }}/lokole.conf from template, for http://box/lokole
template:
src: lokole.conf.j2
dest: "/etc/{{ apache_config_dir }}/lokole.conf"
- name: Symlink /etc/apache2/sites-enabled/lokole.conf to /etc/{{ apache_config_dir }}/lokole.conf, if lokole_enabled (debuntu)
file:
src: "/etc/{{ apache_config_dir }}/lokole.conf"
path: /etc/apache2/sites-enabled/lokole.conf
state: link
when: lokole_enabled and is_debuntu
- name: Remove /etc/apache2/sites-enabled/lokole.conf, if not lokole_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/lokole.conf
state: absent
when: not lokole_enabled and is_debuntu
- name: Remove /etc/{{ apache_config_dir }}/lokole.conf, if not lokole_enabled (OS's other than debuntu)
file:
path: "/etc/{{ apache_config_dir }}/lokole.conf"
state: absent
when: (not lokole_enabled) and (not is_debuntu)
- name: Restart Apache ({{ apache_service }}) to enable/disable http://box/lokole
systemd:
daemon_reload: yes
name: "{{ apache_service }}"
state: restarted
- name: Add 'lokole' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"
section: lokole
option: "{{ item.option }}"
value: "{{ item.value | string }}"
2019-09-14 22:52:02 +00:00
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 }}"