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

Update and rename kiwix_install.yml to install.yml

This commit is contained in:
A Holt 2020-01-11 12:38:37 -05:00 committed by GitHub
parent 0af892fc69
commit b267439136
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
# 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE # 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE
- name: Download Kiwix software to /opt/iiab/downloads - name: Download Kiwix software to /opt/iiab/downloads
get_url: get_url:
url: "{{ iiab_download_url }}/{{ kiwix_src_file }}" url: "{{ iiab_download_url }}/{{ kiwix_src_file }}"
@ -14,9 +15,9 @@
- name: Create directory {{ iiab_zim_path }} and subdirs {content, index} for Kiwix ZIM files - name: Create directory {{ iiab_zim_path }} and subdirs {content, index} for Kiwix ZIM files
file: file:
path: "{{ item }}" path: "{{ item }}"
owner: root owner: root # Not nec? Remove?
group: root group: root # Not nec? Remove?
mode: 0755 mode: '0755' # Not nec? Remove?
state: directory state: directory
with_items: with_items:
- "{{ iiab_zim_path }}" - "{{ iiab_zim_path }}"
@ -28,47 +29,44 @@
path: "{{ kiwix_library_xml }}" path: "{{ kiwix_library_xml }}"
register: kiwix_xml register: kiwix_xml
- name: Install a stub /library/zims/library.xml if one doesn't exist - name: Install stub /library/zims/library.xml from template, if one doesn't exist
template: template:
src: library.xml src: library.xml
dest: "{{ kiwix_library_xml }}" dest: "{{ kiwix_library_xml }}"
mode: 0644 owner: root # Not nec? Remove?
owner: root group: root # Not nec? Remove?
group: root mode: '0644' # Not nec? Remove?
force: no force: no
when: not kiwix_xml.stat.exists when: not kiwix_xml.stat.exists
- name: Install {{ iiab_zim_path }}/content/test.zim if kiwix_force_install - name: Install {{ iiab_zim_path }}/content/test.zim
copy: copy:
src: test.zim src: test.zim
dest: "{{ iiab_zim_path }}/content/test.zim" dest: "{{ iiab_zim_path }}/content/test.zim"
mode: 0644 owner: root # Not nec? Remove?
owner: root group: root # Not nec? Remove?
group: root mode: '0644' # Not nec? Remove?
force: no force: no
when: kiwix_force_install | bool
- name: Create {{ kiwix_path }}/bin directory # /opt/iiab/kiwix/bin - name: Create {{ kiwix_path }}/bin directory # /opt/iiab/kiwix/bin
file: file:
path: "{{ kiwix_path }}/bin" path: "{{ kiwix_path }}/bin"
owner: root owner: root # Not nec? Remove?
group: root group: root # Not nec? Remove?
mode: 0755 mode: '0755' # Not nec? Remove?
state: directory state: directory
# 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install # 2. INSTALL KIWIX-TOOLS EXECUTABLES
- name: Unarchive {{ kiwix_src_file }} to /tmp # e.g. kiwix-tools_linux-armhf-0.6.1-1.tar.gz - name: Unarchive {{ kiwix_src_file }} to /tmp # e.g. kiwix-tools_linux-armhf-0.6.1-1.tar.gz
unarchive: unarchive:
src: "{{ downloads_dir }}/{{ kiwix_src_file }}" src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
dest: /tmp dest: /tmp
owner: root owner: root # Not nec? Remove?
group: root group: root # Not nec? Remove?
when: kiwix_force_install | bool
- name: Move /tmp/{{ kiwix_src_dir }}/* to permanent location /opt/iiab/kiwix/bin (armhf & linux64 & i686) - name: Move /tmp/{{ kiwix_src_dir }}/* to permanent location /opt/iiab/kiwix/bin (armhf & linux64 & i686)
shell: "mv /tmp/{{ kiwix_src_dir }}/* {{ kiwix_path }}/bin/" shell: "mv /tmp/{{ kiwix_src_dir }}/* {{ kiwix_path }}/bin/"
when: kiwix_force_install | bool
# 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU # 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU
@ -84,15 +82,14 @@
# - rewrite # - rewrite
# when: is_debuntu | bool # when: is_debuntu | bool
# 4. CREATE/ENABLE/RESTART (OR DISABLE) KIWIX SERVICE & ITS CRON JOB # 4. INSTALL iiab-make-kiwix-lib*, kiwix-serve.service, kiwix.conf for Apache
- name: 'Install from templates: kiwix-serve.service, iiab-make-kiwix-lib, iiab-make-kiwix-lib.py, kiwix.conf' - name: 'Install from templates: kiwix-serve.service, iiab-make-kiwix-lib, iiab-make-kiwix-lib.py, kiwix.conf'
template: template:
backup: no
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
owner: root owner: root # Not nec? Remove?
group: root group: root # Not nec? Remove?
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: with_items:
- { src: 'kiwix-serve.service.j2', dest: '/etc/systemd/system/kiwix-serve.service', mode: '0644'} - { src: 'kiwix-serve.service.j2', dest: '/etc/systemd/system/kiwix-serve.service', mode: '0644'}
@ -100,6 +97,8 @@
- { src: 'iiab-make-kiwix-lib3.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'} - { src: 'iiab-make-kiwix-lib3.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'}
- { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_config_dir }}/kiwix.conf', mode: '0644'} - { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_config_dir }}/kiwix.conf', mode: '0644'}
5. RECORD KIWIX AS INSTALLED
- name: Add 'kiwix_installed' variable values to {{ iiab_state_file }} - name: Add 'kiwix_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_state_file }}" dest: "{{ iiab_state_file }}"