mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
Update and rename kiwix_enable.yml to enable.yml
This commit is contained in:
parent
ccc34891a5
commit
b678a07208
1 changed files with 31 additions and 37 deletions
|
@ -1,35 +1,4 @@
|
||||||
- name: Create softlink kiwix.conf from sites-enabled to sites-available - for Kiwix Proxy in Apache - is disabled by turning off service kiwix-serve (debuntu)
|
- name: Enable & Restart 'kiwix-serve' systemd service
|
||||||
file:
|
|
||||||
src: /etc/apache2/sites-available/kiwix.conf
|
|
||||||
path: /etc/apache2/sites-enabled/kiwix.conf
|
|
||||||
state: link
|
|
||||||
when: kiwix_enabled and not nginx_enabled
|
|
||||||
|
|
||||||
- name: Install nginx support
|
|
||||||
template:
|
|
||||||
backup: no
|
|
||||||
src: "{{ item.src }}"
|
|
||||||
dest: "{{ item.dest }}"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: "{{ item.mode }}"
|
|
||||||
with_items:
|
|
||||||
- { src: 'kiwix-nginx.conf', dest: '{{ nginx_config_dir }}/kiwix-nginx.conf', mode: '0644' }
|
|
||||||
when: kiwix_enabled and nginx_enabled
|
|
||||||
|
|
||||||
- name: Remove symlink /etc/apache2/sites-enabled/kiwix.conf
|
|
||||||
file:
|
|
||||||
path: /etc/apache2/sites-enabled/kiwix.conf
|
|
||||||
state: absent
|
|
||||||
when: not kiwix_enabled or nginx_enabled
|
|
||||||
|
|
||||||
- name: Remove {{ nginx_config_dir }}/kiwix-nginx.conf
|
|
||||||
file:
|
|
||||||
path: "{{ nginx_config_dir }}/kiwix-nginx.conf"
|
|
||||||
state: absent
|
|
||||||
when: not kiwix_enabled and nginx_enabled
|
|
||||||
|
|
||||||
- name: Enable & Restart 'kiwix-serve' service
|
|
||||||
systemd:
|
systemd:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
name: kiwix-serve
|
name: kiwix-serve
|
||||||
|
@ -37,13 +6,14 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: kiwix_enabled | bool
|
when: kiwix_enabled | bool
|
||||||
|
|
||||||
- name: Disable 'kiwix-serve' service
|
- name: Disable 'kiwix-serve' systemd service
|
||||||
systemd:
|
systemd:
|
||||||
name: kiwix-serve
|
name: kiwix-serve
|
||||||
enabled: no
|
enabled: no
|
||||||
state: stopped
|
state: stopped
|
||||||
when: not kiwix_enabled
|
when: not kiwix_enabled
|
||||||
# IN THEORY: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled"
|
|
||||||
|
# TO DO: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled"
|
||||||
|
|
||||||
# In the past kiwix-serve did not stay running, so we'd been doing this hourly.
|
# In the past kiwix-serve did not stay running, so we'd been doing this hourly.
|
||||||
# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in
|
# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in
|
||||||
|
@ -64,6 +34,16 @@
|
||||||
dest: /etc/crontab
|
dest: /etc/crontab
|
||||||
when: kiwix_enabled and is_redhat
|
when: kiwix_enabled and is_redhat
|
||||||
|
|
||||||
|
# Apache
|
||||||
|
|
||||||
|
- name: Enable http://box/kiwix with Apache proxy
|
||||||
|
command: a2ensite kiwix.conf
|
||||||
|
when: kiwix_enabled and not nginx_enabled
|
||||||
|
|
||||||
|
- name: Disable http://box/kiwix with Apache
|
||||||
|
command: a2dissite calibre-web.conf
|
||||||
|
when: not kiwix_enabled or nginx_enabled
|
||||||
|
|
||||||
- name: Restart Apache systemd service ({{ apache_service }})
|
- name: Restart Apache systemd service ({{ apache_service }})
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ apache_service }}"
|
name: "{{ apache_service }}"
|
||||||
|
@ -71,6 +51,23 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: not nginx_enabled
|
when: not nginx_enabled
|
||||||
|
|
||||||
|
# NGINX
|
||||||
|
|
||||||
|
- name: 'Install from template: {{ nginx_config_dir }}/kiwix-nginx.conf'
|
||||||
|
template:
|
||||||
|
src: kiwix-nginx.conf
|
||||||
|
dest: "{{ nginx_config_dir }}/kiwix-nginx.conf"
|
||||||
|
owner: root # Not nec? Remove?
|
||||||
|
group: root # Not nec? Remove?
|
||||||
|
mode: '0644' # Not nec? Remove?
|
||||||
|
when: kiwix_enabled and nginx_enabled
|
||||||
|
|
||||||
|
- name: Remove {{ nginx_config_dir }}/kiwix-nginx.conf
|
||||||
|
file:
|
||||||
|
path: "{{ nginx_config_dir }}/kiwix-nginx.conf"
|
||||||
|
state: absent
|
||||||
|
when: not kiwix_enabled or not nginx_enabled
|
||||||
|
|
||||||
- name: Restart nginx systemd service
|
- name: Restart nginx systemd service
|
||||||
systemd:
|
systemd:
|
||||||
name: nginx
|
name: nginx
|
||||||
|
@ -78,9 +75,6 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: nginx_enabled | bool
|
when: nginx_enabled | bool
|
||||||
|
|
||||||
|
|
||||||
# 5. FINALIZE
|
|
||||||
|
|
||||||
- name: Add 'kiwix' variable values to {{ iiab_ini_file }}
|
- name: Add 'kiwix' variable values to {{ iiab_ini_file }}
|
||||||
ini_file:
|
ini_file:
|
||||||
path: "{{ iiab_ini_file }}"
|
path: "{{ iiab_ini_file }}"
|
Loading…
Reference in a new issue