mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
a6f1747b56
8 changed files with 107 additions and 56 deletions
|
@ -7,7 +7,7 @@ kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("ex
|
||||||
|
|
||||||
kiwix_port: 3000
|
kiwix_port: 3000
|
||||||
# Expected to be used soon for Kiwix proxy:
|
# Expected to be used soon for Kiwix proxy:
|
||||||
kiwix_url: /kiwix
|
kiwix_url: /kiwix/
|
||||||
# Unused in Nov 2017, but should be:
|
# Unused in Nov 2017, but should be:
|
||||||
kiwix_path: "{{ iiab_base }}/kiwix"
|
kiwix_path: "{{ iiab_base }}/kiwix"
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
# 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB
|
# 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB
|
||||||
|
|
||||||
- name: Create 'kiwix-serve' service
|
- name: Create 'kiwix-serve' service and related files
|
||||||
template:
|
template:
|
||||||
backup: no
|
backup: no
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
|
@ -108,7 +108,14 @@
|
||||||
# - { src: 'kiwix-serve-init.j2', dest: '/usr/libexec/kiwix-serve-init', mode: '0755'}
|
# - { src: 'kiwix-serve-init.j2', dest: '/usr/libexec/kiwix-serve-init', mode: '0755'}
|
||||||
- { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755'}
|
- { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755'}
|
||||||
- { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'}
|
- { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'}
|
||||||
- { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'}
|
# - { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'}
|
||||||
|
- { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_config_dir }}/kiwix.conf', mode: '0644'}
|
||||||
|
|
||||||
|
- name: Enable Kiwix Proxy in Apache - is disabled by turning off kiwix service
|
||||||
|
file: path=/etc/apache2/sites-enabled/kiwix.conf
|
||||||
|
src=/etc/apache2/sites-available/kiwix.conf
|
||||||
|
state=link
|
||||||
|
when: is_debuntu
|
||||||
|
|
||||||
- name: Enable 'kiwix-serve' service
|
- name: Enable 'kiwix-serve' service
|
||||||
service:
|
service:
|
||||||
|
@ -144,6 +151,9 @@
|
||||||
dest: /etc/crontab
|
dest: /etc/crontab
|
||||||
when: kiwix_enabled and is_redhat
|
when: kiwix_enabled and is_redhat
|
||||||
|
|
||||||
|
- name: Restart apache, so it picks up kiwix.conf
|
||||||
|
service: name={{ apache_service }} state=restarted
|
||||||
|
|
||||||
# 5. FINALIZE
|
# 5. FINALIZE
|
||||||
|
|
||||||
- name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini
|
- name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{{ systemctl_program }} stop kiwix-serve
|
{{ systemctl_program }} stop kiwix-serve
|
||||||
/usr/bin/iiab-make-kiwix-lib.py
|
/usr/bin/iiab-make-kiwix-lib.py
|
||||||
/usr/bin/iiab-make-apache-config.py
|
#/usr/bin/iiab-make-apache-config.py
|
||||||
{{ systemctl_program }} start kiwix-serve
|
{{ systemctl_program }} start kiwix-serve
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -4,7 +4,7 @@ After=syslog.target network.target local-fs.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }}
|
ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} --urlRootLocation={{ kiwix_url }}
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
1
roles/kiwix/templates/kiwix.conf.j2
Normal file
1
roles/kiwix/templates/kiwix.conf.j2
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ProxyPass {{ kiwix_url }} http://127.0.0.1:{{ kiwix_port }}{{ kiwix_url }}
|
|
@ -90,3 +90,6 @@
|
||||||
file: path=/etc/{{ apache_config_dir }}/dns-jail.conf
|
file: path=/etc/{{ apache_config_dir }}/dns-jail.conf
|
||||||
state=absent
|
state=absent
|
||||||
when: not is_debuntu and not dns_jail_enabled
|
when: not is_debuntu and not dns_jail_enabled
|
||||||
|
|
||||||
|
- name: Start named after copying files
|
||||||
|
service: name={{ dns_service }} state=started
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
nextcloud_install: True
|
nextcloud_install: True
|
||||||
nextcloud_enabled: False
|
nextcloud_enabled: False
|
||||||
|
|
||||||
|
# REMOVE /opt/nextcloud/version.php TO FORCE AN INSTALL OR REINSTALL OR UPGRADE
|
||||||
|
nextcloud_force_install: False
|
||||||
|
|
||||||
nextcloud_url: /nextcloud
|
nextcloud_url: /nextcloud
|
||||||
nextcloud_prefix: /opt
|
nextcloud_prefix: /opt
|
||||||
nextcloud_data_dir: "{{ content_base }}/nextcloud/data"
|
nextcloud_data_dir: "{{ content_base }}/nextcloud/data"
|
||||||
nextcloud_dl_url: https://download.nextcloud.com/server/releases/
|
nextcloud_dl_url: https://download.nextcloud.com/server/releases/
|
||||||
nextcloud_src_file: latest-12.tar.bz2
|
nextcloud_orig_src_file: latest-12.tar.bz2
|
||||||
|
nextcloud_src_file: nextcloud_{{ nextcloud_orig_src_file }}
|
||||||
|
|
||||||
# we install on mysql with these setting or those from default_vars, etc.
|
# we install on mysql with these setting or those from default_vars, etc.
|
||||||
nextcloud_dbname: nextcloud
|
nextcloud_dbname: nextcloud
|
||||||
|
|
|
@ -1,31 +1,43 @@
|
||||||
# we need to install the rpm in order to get the dependencies
|
- name: See if Nextcloud version page exists
|
||||||
# but we only need to do this the first time
|
stat:
|
||||||
|
path: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
||||||
- name: See if the Nextcloud startup page exists
|
# path: "{{ nextcloud_prefix }}/nextcloud/index.php"
|
||||||
stat: path={{ nextcloud_prefix }}/nextcloud/index.php
|
|
||||||
register: nextcloud_page
|
register: nextcloud_page
|
||||||
|
|
||||||
|
- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF /opt/nextcloud/version.php DOESN'T EXIST
|
||||||
|
set_fact:
|
||||||
|
nextcloud_force_install: True
|
||||||
|
when: not nextcloud_page.stat.exists
|
||||||
|
|
||||||
# but we use the tar file to get the latest version
|
# - debug:
|
||||||
|
# msg: "nextcloud_force_install: {{ nextcloud_force_install }}"
|
||||||
|
|
||||||
- name: Get the Nextcloud software
|
|
||||||
get_url: url={{ nextcloud_dl_url }}/{{ nextcloud_src_file }} dest={{ downloads_dir }}/{{ nextcloud_src_file }}
|
- name: Download latest Nextcloud software to /opt/iiab/download/{{ nextcloud_src_file }}
|
||||||
when: internet_available
|
get_url:
|
||||||
|
url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }}"
|
||||||
|
dest: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
||||||
|
force: yes
|
||||||
|
when: internet_available and nextcloud_force_install
|
||||||
async: 900
|
async: 900
|
||||||
poll: 15
|
poll: 15
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
||||||
- name: Ubuntu and Debian treat names differently (Debian)
|
- name: Ubuntu and Debian treat names differently (Debian)
|
||||||
package: name={{ item }} state=present
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- libapache2-mod-php{{ php_version }}
|
- "libapache2-mod-php{{ php_version }}"
|
||||||
- php{{ php_version }}-mbstring
|
- "php{{ php_version }}-mbstring"
|
||||||
- php{{ php_version }}-zip
|
- "php{{ php_version }}-zip"
|
||||||
when: is_debian
|
when: is_debian
|
||||||
|
|
||||||
- name: Ubuntu and Debian treat names differently (Ubuntu)
|
- name: Ubuntu and Debian treat names differently (Ubuntu)
|
||||||
package: name={{ item }} state=present
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- libapache2-mod-php
|
- libapache2-mod-php
|
||||||
- php-imagick
|
- php-imagick
|
||||||
|
@ -34,18 +46,25 @@
|
||||||
when: is_ubuntu
|
when: is_ubuntu
|
||||||
|
|
||||||
- name: Install list of packages (debuntu)
|
- name: Install list of packages (debuntu)
|
||||||
package: name={{ item }} state=present
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- php{{ php_version }}-gd
|
- "php{{ php_version }}-gd"
|
||||||
- php{{ php_version }}-json
|
- "php{{ php_version }}-json"
|
||||||
- php{{ php_version }}-mysql
|
- "php{{ php_version }}-mysql"
|
||||||
- php{{ php_version }}-curl
|
- "php{{ php_version }}-curl"
|
||||||
- php{{ php_version }}-intl
|
- "php{{ php_version }}-intl"
|
||||||
- php{{ php_version }}-mcrypt
|
- "php{{ php_version }}-mcrypt"
|
||||||
when: is_debuntu
|
when: is_debuntu
|
||||||
|
|
||||||
|
# we need to install the rpm in order to get the dependencies
|
||||||
|
# but we only need to do this the first time
|
||||||
|
|
||||||
- name: Install list of packages (redhat)
|
- name: Install list of packages (redhat)
|
||||||
package: name={{ item }} state=present
|
package:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- php
|
- php
|
||||||
- php-gd
|
- php-gd
|
||||||
|
@ -59,52 +78,63 @@
|
||||||
when: is_redhat
|
when: is_redhat
|
||||||
|
|
||||||
- name: Copy it to permanent location /opt (OS's other than Fedora 18)
|
- name: Copy it to permanent location /opt (OS's other than Fedora 18)
|
||||||
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }}
|
unarchive:
|
||||||
dest={{ nextcloud_prefix }}
|
src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
||||||
creates={{ nextcloud_prefix }}/nextcloud/version.php
|
dest: "{{ nextcloud_prefix }}"
|
||||||
when: not is_F18
|
# creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
|
||||||
|
when: not is_F18 and nextcloud_force_install
|
||||||
|
|
||||||
# ansible 1.4.1 does not have "creates"
|
# Ansible 1.4.1 does not have "creates" (but hopefully has "when")
|
||||||
- name: Copy it to permanent location /opt (Fedora 18)
|
- name: Copy it to permanent location /opt (Fedora 18)
|
||||||
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }}
|
unarchive:
|
||||||
dest={{ nextcloud_prefix }}
|
src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
|
||||||
when: is_F18
|
dest: "{{ nextcloud_prefix }}"
|
||||||
|
when: is_F18 and nextcloud_force_install
|
||||||
|
|
||||||
- name: In CentOS, the following config dir is symlink to /etc/nextcloud
|
- name: In CentOS, the following config dir is symlink to /etc/nextcloud
|
||||||
file: path=/etc/nextcloud
|
file:
|
||||||
state=directory
|
path: /etc/nextcloud
|
||||||
|
state: directory
|
||||||
when: is_centos
|
when: is_centos
|
||||||
|
|
||||||
- name: Add autoconfig file (CentOS)
|
- name: Add autoconfig file (CentOS)
|
||||||
template: src=autoconfig.php.j2
|
template:
|
||||||
dest={{ nextcloud_prefix }}/nextcloud/config/autoconfig.php
|
src: autoconfig.php.j2
|
||||||
owner={{ apache_user }}
|
dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
|
||||||
group={{ apache_user }}
|
owner: "{{ apache_user }}"
|
||||||
mode=0640
|
group: "{{ apache_user }}"
|
||||||
|
mode: 0640
|
||||||
when: is_centos
|
when: is_centos
|
||||||
|
|
||||||
- name: Make Apache owner
|
- name: Make Apache owner
|
||||||
file: path={{ nextcloud_prefix }}/nextcloud
|
file:
|
||||||
owner={{ apache_user }}
|
path: "{{ nextcloud_prefix }}/nextcloud"
|
||||||
group={{ apache_user }}
|
owner: "{{ apache_user }}"
|
||||||
recurse=yes
|
group: "{{ apache_user }}"
|
||||||
state=directory
|
recurse: yes
|
||||||
|
state: directory
|
||||||
|
|
||||||
- name: Create data directory library
|
- name: Create data directory library
|
||||||
file: path={{ item }}
|
file:
|
||||||
mode=0750
|
path: "{{ item }}"
|
||||||
owner={{ apache_user }}
|
owner: "{{ apache_user }}"
|
||||||
group={{ apache_user }}
|
group: "{{ apache_user }}"
|
||||||
state=directory
|
mode: 0750
|
||||||
|
state: directory
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ nextcloud_data_dir }}"
|
- "{{ nextcloud_data_dir }}"
|
||||||
|
|
||||||
- name: Create a MySQL database for Nextcloud
|
- name: Create a MySQL database for Nextcloud
|
||||||
mysql_db: name={{ nextcloud_dbname }}
|
mysql_db:
|
||||||
|
name: "{{ nextcloud_dbname }}"
|
||||||
when: mysql_enabled and nextcloud_enabled
|
when: mysql_enabled and nextcloud_enabled
|
||||||
|
|
||||||
- name: Create a user to access the Nextcloud database
|
- name: Create a user to access the Nextcloud database
|
||||||
mysql_user: name={{ nextcloud_dbuser }} host={{ item }} password={{ nextcloud_dbpassword }} priv={{ nextcloud_dbname }}.*:ALL,GRANT
|
mysql_user:
|
||||||
|
name: "{{ nextcloud_dbuser }}"
|
||||||
|
host: "{{ item }}"
|
||||||
|
password: "{{ nextcloud_dbpassword }}"
|
||||||
|
priv: "{{ nextcloud_dbname }}.*:ALL,GRANT"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ nextcloud_dbhost }}"
|
- "{{ nextcloud_dbhost }}"
|
||||||
- 127.0.0.1
|
- 127.0.0.1
|
||||||
|
@ -114,7 +144,10 @@
|
||||||
|
|
||||||
|
|
||||||
- name: Restart Apache, so it picks up the new aliases
|
- name: Restart Apache, so it picks up the new aliases
|
||||||
service: name={{ apache_service }} state=restarted
|
service:
|
||||||
|
name: "{{ apache_service }}"
|
||||||
|
state: restarted
|
||||||
|
# when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below
|
||||||
when: not nextcloud_enabled
|
when: not nextcloud_enabled
|
||||||
|
|
||||||
# Enable nextcloud by copying template to httpd config
|
# Enable nextcloud by copying template to httpd config
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue