2017-09-14 23:27:48 +00:00
|
|
|
- name: Get Calibre setup file
|
2017-05-27 18:09:50 +00:00
|
|
|
# the installer works for intel fedora, and Centos, and deals with dependencies
|
|
|
|
get_url:
|
|
|
|
url="{{ calibre_src_url }}"
|
|
|
|
dest="{{ downloads_dir }}/calibre-installer.py"
|
|
|
|
mode=0755
|
|
|
|
when: ansible_distribution == "CentOS"
|
|
|
|
|
2017-09-14 23:27:48 +00:00
|
|
|
- name: Install Calibre
|
2017-05-27 18:09:50 +00:00
|
|
|
shell: "{{ downloads_dir }}/calibre-installer.py >> /dev/null"
|
|
|
|
args:
|
|
|
|
creates: /usr/bin/calibre-uninstall
|
2017-10-19 06:33:02 +00:00
|
|
|
when: calibre_install and ansible_distribution == 'CentOS'
|
2017-05-27 18:09:50 +00:00
|
|
|
|
2017-09-14 23:27:48 +00:00
|
|
|
- name: Install Calibre rpms
|
2017-05-27 18:09:50 +00:00
|
|
|
# the fedora rpm arm version, though older, takes care of dependencies, and exists
|
|
|
|
package: name={{ item }}
|
|
|
|
state=present
|
|
|
|
with_items:
|
|
|
|
- calibre
|
|
|
|
when: calibre_install and ansible_distribution != 'CentOS'
|
|
|
|
|
2017-09-14 23:27:48 +00:00
|
|
|
- name: Create Calibre service(s) and support scripts
|
2017-05-27 18:09:50 +00:00
|
|
|
template: backup=no
|
|
|
|
src={{ item.src }}
|
|
|
|
dest={{ item.dest }}
|
|
|
|
owner=root
|
|
|
|
group=root
|
|
|
|
mode={{ item.mode }}
|
|
|
|
with_items:
|
|
|
|
- { src: 'calibre-serve.service.j2', dest: '/etc/systemd/system/calibre-serve.service', mode: '0644'}
|
|
|
|
- { src: 'calibre.conf', dest: '/etc/{{ apache_config_dir }}', mode: '0644'}
|
|
|
|
when: calibre_install
|
|
|
|
|
|
|
|
- name: Create the link for sites-enabled
|
|
|
|
file: src=/etc/apache2/sites-available/calibre.conf
|
|
|
|
dest=/etc/apache2/sites-enabled/calibre.conf
|
|
|
|
state=link
|
2017-05-27 23:10:45 +00:00
|
|
|
when: is_debuntu and calibre_enabled
|
2017-05-27 18:09:50 +00:00
|
|
|
|
|
|
|
- name: Enable Calibre server
|
|
|
|
service: name=calibre-serve
|
|
|
|
enabled=yes
|
|
|
|
state=started
|
|
|
|
#async: 900
|
|
|
|
#poll: 5
|
|
|
|
when: calibre_enabled
|
|
|
|
|
|
|
|
- name: Disable Calibre server
|
|
|
|
service: name=calibre-serve
|
|
|
|
enabled=no
|
|
|
|
state=stopped
|
|
|
|
when: not calibre_enabled
|
|
|
|
|
2017-09-14 23:27:48 +00:00
|
|
|
- name: Add Calibre to service list
|
2017-05-27 18:09:50 +00:00
|
|
|
ini_file: dest='{{ service_filelist }}'
|
|
|
|
section=calibre
|
|
|
|
option='{{ item.option }}'
|
|
|
|
value='{{ item.value }}'
|
|
|
|
with_items:
|
|
|
|
- option: description
|
|
|
|
value: '"Calibre epub book server"'
|
|
|
|
- option: url
|
|
|
|
value: "{{ calibre_src_url }}"
|
|
|
|
- option: database
|
|
|
|
value: "{{ calibre_dbpath }}"
|
|
|
|
- option: port
|
|
|
|
value: "{{ calibre_port }}"
|
|
|
|
- option: enabled
|
|
|
|
value: "{{ calibre_enabled }}"
|