From 4e94a0d6a796b89bd3e76fa836480374b8804da0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 10 May 2018 16:13:58 -0400 Subject: [PATCH] Update main.yml --- roles/calibre/tasks/main.yml | 42 +++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index c09aa03ba..74c10c428 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -1,18 +1,36 @@ -# 1. INSTALL THE LATEST CALIBRE 3.X+ (calibre-server etc) ON ALL OS'S +# 1. INSTALL THE LATEST CALIBRE 3.X+ (calibre, calibredb, calibre-server etc) ON ALL OS'S -# RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST -- name: Install Calibre via calibre-installer.py (redhat, ubuntu, debian if NOT calibre_debs_on_debian) - include_tasks: py-installer.yml - when: is_redhat or is_ubuntu or (is_debian and not calibre_debs_on_debian) - #when: not is_rpi +- name: Check if /usr/bin/calibre exists + stat: + path: "/usr/bin/calibre" + register: calib_executable -- name: Install Calibre via .debs (Raspbian, Debian if calibre_debs_on_debian) +- name: Install Calibre via OS's package installer (IF /usr/bin/calibre MISSING) + package: + name: "{{ item }}" + state: latest + with_items: + - calibre + - calibre-bin + when: internet_available and (not calib_executable.stat.exists) + +- name: Install Calibre experimental .debs IF calibre_via_debs (AND /usr/bin/calibre WAS MISSING) include_tasks: debs.yml - when: is_rpi or (is_debian and calibre_debs_on_debian) + when: calibre_via_debs and (not calib_executable.stat.exists) -#- name: Install Calibre via .debs (Ubuntu 18.xx) -# include_tasks: debs.yml -# when: is_ubuntu_18 +- name: Install Calibre via calibre-installer.py IF calibre_via_python (AND /usr/bin/calibre WAS MISSING) + include_tasks: py-installer.yml + when: calibre_via_python and (not calib_executable.stat.exists) + +# SEE calibre_via_python's value vars/default_vars.yml, vars/ubuntu-18.yml & +# vars/raspbian-9.yml: try to AVOID Python installer on Raspbian since its +# .deb's (http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/) +# are updated within about 10 days of Calibre's quasi-monthly releases! +# +# BUT IF ABSOLUTELY NEC: (SEE roles/calibre/tasks/debs.yml) +# - run testing branch for RPi: scripts/calibre-install-latest-rpi.sh +# - run testing branch for Ubuntu 16.04: scripts/calibre-install-latest.sh +# - run unstable branch for Debian etc: scripts/calibre-install-unstable.sh - name: Create calibre-serve.service and calibre.conf template: @@ -27,7 +45,7 @@ - { src: 'calibre-serve.service.j2', dest: '/etc/systemd/system/calibre-serve.service', mode: '0644'} - { src: 'calibre.conf', dest: '/etc/{{ apache_config_dir }}', mode: '0644'} -- name: Forcing systemd to reread configs +- name: Force systemd to reread configs systemd: daemon_reload: yes when: calibre_config.changed