mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
lokole - iiab_installed
This commit is contained in:
parent
544293113f
commit
e8683079b0
3 changed files with 76 additions and 57 deletions
65
roles/lokole/tasks/enable.yml
Normal file
65
roles/lokole/tasks/enable.yml
Normal file
|
@ -0,0 +1,65 @@
|
|||
- 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 }}"
|
||||
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 }}"
|
|
@ -98,59 +98,9 @@
|
|||
state: restarted
|
||||
when: lokole_enabled | bool
|
||||
|
||||
- name: Disable 'lokole' service, if not lokole_enabled
|
||||
systemd:
|
||||
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 }}"
|
||||
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 }}"
|
||||
- name: Add 'lokole_installed' variable values to {{ iiab_installed }}
|
||||
lineinfile:
|
||||
dest: "{{ iiab_installed }}"
|
||||
regexp: '^lokole_installed'
|
||||
line: 'lokole_installed'
|
||||
state: present
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
- name: Install Lokole {{ lokole_version }} if lokole_install
|
||||
include_tasks: install.yml
|
||||
when: lokole_install | bool
|
||||
when: lokole_install | bool and not lokole_installed is defined
|
||||
|
||||
- name: Enable Lokole
|
||||
include_tasks: enable.yml
|
||||
when: lokole_install | bool or lokole_installed is defined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue