From 579fa10b05d6f4fbb62370c5bf7204516e5ce23c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 16 Oct 2019 00:39:27 -0500 Subject: [PATCH] kiwix allow reinstall/updates with runrole --reinstall --- roles/kiwix/tasks/kiwix_install.yml | 11 +++++++++++ roles/kiwix/tasks/main.yml | 16 ++-------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/roles/kiwix/tasks/kiwix_install.yml b/roles/kiwix/tasks/kiwix_install.yml index d030d5442..2e8075404 100644 --- a/roles/kiwix/tasks/kiwix_install.yml +++ b/roles/kiwix/tasks/kiwix_install.yml @@ -1,4 +1,15 @@ # 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE +- name: Download Kiwix software to /opt/iiab/downloads + get_url: + url: "{{ iiab_download_url }}/{{ kiwix_src_file }}" + dest: "{{ downloads_dir }}/{{ kiwix_src_file }}" + timeout: "{{ download_timeout }}" + when: internet_available | bool + +- name: Check for /opt/iiab/downloads/{{ kiwix_src_file }} + stat: + path: "{{ downloads_dir }}/{{ kiwix_src_file }}" + register: kiwix_src - name: Create directory {{ iiab_zim_path }} and subdirs {content, index} for Kiwix ZIM files file: diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index 020399ee3..a1ac24b37 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -23,18 +23,6 @@ msg: "WARNING: kiwix-tools SOFTWARE APPEARS UNAVAILABLE FOR YOUR {{ ansible_machine }} OS/ARCHITECTURE." when: not kiwix_src_file -- name: Download Kiwix software to /opt/iiab/downloads - get_url: - url: "{{ iiab_download_url }}/{{ kiwix_src_file }}" - dest: "{{ downloads_dir }}/{{ kiwix_src_file }}" - timeout: "{{ download_timeout }}" - when: internet_available | bool and kiwix_install | bool and not kiwix_installed is defined - -- name: Check for /opt/iiab/downloads/{{ kiwix_src_file }} - stat: - path: "{{ downloads_dir }}/{{ kiwix_src_file }}" - register: kiwix_src - - name: Check for /opt/iiab/kiwix/bin/kiwix-serve binary stat: path: "{{ kiwix_path }}/bin/kiwix-serve" @@ -43,10 +31,10 @@ - name: Set fact kiwix_force_install if kiwix-serve not found set_fact: kiwix_force_install: True - when: not kiwix_bin.stat.exists + when: not kiwix_bin.stat.exists or reinstall is defined - include_tasks: kiwix_install.yml - when: kiwix_install | bool and (not kiwix_installed is defined or kiwix_force_install | bool) + when: (kiwix_install | bool and not kiwix_installed is defined) or kiwix_force_install | bool tags: - kiwix