1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/calibre/tasks/py-installer.yml
2017-11-20 04:23:29 -05:00

51 lines
2.1 KiB
YAML

# Seems to work with just about any Linux (Fedora 18 on OLPC XO Laptops??) and deals with dependencies.
# But is arch dependent: requires x86_64 or i686 for now.
- name: Download latest linux-installer.py from GitHub to calibre-installer.py
get_url:
url: "{{ calibre_src_url }}"
dest: "{{ downloads_dir }}/calibre-installer.py"
mode: 0755
force: yes
backup: yes
register: calibre_download_output
when: internet_available
# ALWAYS DEFINED, DESPITE get_url DOCUMENTATION CLAIM...
# - debug:
# msg: "{{ calibre_download_output.src }}"
#
# DEFINED ONLY WHEN /opt/iiab/downloads/calibre-installer.py CHANGES
# - debug:
# msg: "{{ calibre_download_output.backup_file }}"
# OOPS BAD IDEA: changes in https://github.com/kovidgoyal/calibre/commits/master/setup/linux-installer.py are not sync'd with Calibre releases!
# - name: FORCE AN UPGRADE IF calibre-installer.py HAS CHANGED, IF SO ORIGINAL IS SAVED TO {{ calibre_download_output.backup_file }}
# file:
# path: /usr/bin/calibre-uninstall
# state: absent
# when: calibre_download_output.backup_file is defined
- name: Check if calibre-installer.py exists in /opt/iiab/downloads
stat:
path: "{{ downloads_dir }}/calibre-installer.py"
register: calib_inst
- name: Check if calibre-uninstall exists in /usr/bin
stat:
path: "/usr/bin/calibre-uninstall"
register: calib_uninst
- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/calibre-installer.py doesn't exist OR needed Internet connection is missing
# meta: end_play
fail:
msg: "{{ downloads_dir }}/calibre-installer.py and an Internet connection are REQUIRED in order to install Calibre!"
when: (not calib_inst.stat.exists) or (not internet_available and not calib_uninst.stat.exists)
# INSTALL THE LATEST CALIBRE (calibre-server etc) - RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST
- name: Run calibre-installer.py to install Calibre programs into /usr/bin - MANUALLY REMOVE /usr/bin/calibre-uninstall TO FORCE calibre-installer.py TO REINSTALL/UPGRADE HERE!
shell: "{{ downloads_dir }}/calibre-installer.py >> /dev/null"
args:
creates: /usr/bin/calibre-uninstall
when: internet_available