mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	
						commit
						0b94b29180
					
				
					 2 changed files with 20 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -1,18 +1,20 @@
 | 
			
		|||
- name: Enable & Restart 'kiwix-serve' systemd service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: kiwix-serve
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
    enabled: yes
 | 
			
		||||
    state: restarted
 | 
			
		||||
  when: kiwix_enabled
 | 
			
		||||
 | 
			
		||||
- name: Disable & Stop 'kiwix-serve' systemd service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: kiwix-serve
 | 
			
		||||
    enabled: no
 | 
			
		||||
    state: stopped
 | 
			
		||||
  when: not kiwix_enabled
 | 
			
		||||
 | 
			
		||||
- name: Update {{ kiwix_library_xml }}
 | 
			
		||||
  command: /usr/bin/iiab-make-kiwix-lib
 | 
			
		||||
  when: kiwix_enabled
 | 
			
		||||
# the above starts the service
 | 
			
		||||
 | 
			
		||||
- name: Enable & Ensure 'kiwix-serve' systemd service is started
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: kiwix-serve
 | 
			
		||||
    enabled: yes
 | 
			
		||||
    state: started
 | 
			
		||||
  when: kiwix_enabled
 | 
			
		||||
 | 
			
		||||
# TO DO: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,32 +44,22 @@
 | 
			
		|||
    path: "{{ item }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
  with_items:
 | 
			
		||||
    - "{{ kiwix_path }}/bin"    # /opt/iiab/kiwix
 | 
			
		||||
    - "{{ iiab_zim_path }}"    # /library/zims
 | 
			
		||||
    - "{{ iiab_zim_path }}/content"
 | 
			
		||||
    - "{{ iiab_zim_path }}/index"
 | 
			
		||||
 | 
			
		||||
- name: Check for {{ kiwix_library_xml }}
 | 
			
		||||
- name: Check for {{ iiab_zim_path }}/content/*.zim
 | 
			
		||||
  stat:
 | 
			
		||||
    path: "{{ kiwix_library_xml }}"    # /library/zims/library.xml
 | 
			
		||||
  register: kiwix_xml
 | 
			
		||||
 | 
			
		||||
- name: Install stub /library/zims/library.xml from template, if one doesn't exist
 | 
			
		||||
  template:
 | 
			
		||||
    src: library.xml
 | 
			
		||||
    dest: "{{ kiwix_library_xml }}"
 | 
			
		||||
    force: no
 | 
			
		||||
  when: not kiwix_xml.stat.exists
 | 
			
		||||
    path: "{{ iiab_zim_path }}/content/*.zim"
 | 
			
		||||
  register: kiwix_zims
 | 
			
		||||
 | 
			
		||||
- name: Install {{ iiab_zim_path }}/content/test.zim
 | 
			
		||||
  copy:
 | 
			
		||||
    src: test.zim
 | 
			
		||||
    dest: "{{ iiab_zim_path }}/content/test.zim"
 | 
			
		||||
    force: no
 | 
			
		||||
 | 
			
		||||
- name: Create {{ kiwix_path }}/bin directory
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ kiwix_path }}/bin"    # /opt/iiab/kiwix
 | 
			
		||||
    state: directory
 | 
			
		||||
  when: not kiwix_zims.stat.exists
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# 2. INSTALL KIWIX-TOOLS EXECUTABLES
 | 
			
		||||
| 
						 | 
				
			
			@ -110,6 +100,10 @@
 | 
			
		|||
    - { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755' }
 | 
			
		||||
    - { src: 'iiab-make-kiwix-lib3.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755' }
 | 
			
		||||
 | 
			
		||||
- name: Reload systemd for new kiwix-serve.service file
 | 
			
		||||
  systemd:
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
 | 
			
		||||
- name: "Install from template: Apache's kiwix.conf"
 | 
			
		||||
  template:
 | 
			
		||||
    src: kiwix.conf.j2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue