2019-03-28 19:51:57 +00:00
# We need a recent version of node
- name : FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x
fail :
2019-07-05 01:39:06 +00:00
msg : "Internet Archive install cannot proceed, as it currently requires Node.js 10.x, and your nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml and possibly also /etc/iiab/local_vars.yml"
2019-04-23 00:59:57 +00:00
when : internetarchive_install and (nodejs_version != "10.x")
2019-03-28 19:51:57 +00:00
2019-03-28 22:22:03 +00:00
- name : Install packages needed by Distributed Web
package :
2019-05-25 04:56:37 +00:00
name :
- libsecret-1-dev
- cmake
state : present
2019-03-28 22:22:03 +00:00
2019-04-23 07:25:49 +00:00
- name : Create directory {{ internetarchive_dir }}
file :
path : "{{ internetarchive_dir }}"
state : directory
owner : "root"
2019-07-01 19:49:55 +00:00
- name : Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
2019-04-23 07:25:49 +00:00
command : sudo yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
args :
chdir : "{{ internetarchive_dir }}"
2019-08-10 06:57:34 +00:00
creates : "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
2019-05-25 04:56:37 +00:00
when : internet_available | bool
2019-08-10 06:57:34 +00:00
register : IA_installing
2019-03-28 19:51:57 +00:00
2019-04-24 08:06:12 +00:00
- name : Create directory /library/archiveorg
file :
path : "/library/archiveorg"
state : directory
owner : "root"
2019-08-10 06:57:34 +00:00
- name : Update pre-existing install
command : sudo yarn upgrade
args :
chdir : "{{ internetarchive_dir }}"
when : not IA_installing.changed and IA_upgrade
2019-05-25 04:56:37 +00:00
2019-03-28 19:51:57 +00:00
# CONFIG FILES
2019-04-23 00:59:57 +00:00
- name : "Install from templates: internetarchive.service (systemd), internetarchive.conf (Apache)"
2019-03-28 19:51:57 +00:00
template :
src : "{{ item.src }}"
dest : "{{ item.dest }}"
mode : 0644
owner : root
group : root
with_items :
2019-04-23 00:59:57 +00:00
- { src: 'internetarchive.service.j2', dest : '/etc/systemd/system/internetarchive.service' }
- { src: 'internetarchive.conf', dest : '/etc/apache2/sites-available/internetarchive.conf' }
2019-03-28 19:51:57 +00:00
2019-05-25 12:58:07 +00:00
- name : Create symlink internetarchive.conf from sites-enabled to sites-available, for short URL http://box/archive (if debuntu and internetarchive_enabled)
2019-03-28 19:51:57 +00:00
file :
2019-04-23 00:59:57 +00:00
src : /etc/apache2/sites-available/internetarchive.conf
path : /etc/apache2/sites-enabled/internetarchive.conf
2019-03-28 19:51:57 +00:00
state : link
2019-05-25 12:58:07 +00:00
when : is_debuntu and internetarchive_enabled
2019-03-28 19:51:57 +00:00
2019-05-25 12:58:07 +00:00
- name : Remove symlink /etc/apache2/sites-enabled/internetarchive.conf (if debuntu and not internetarchive_enabled)
2019-03-28 19:51:57 +00:00
file :
2019-04-23 00:59:57 +00:00
path : /etc/apache2/sites-enabled/internetarchive.conf
2019-03-28 19:51:57 +00:00
state : absent
2019-05-25 12:58:07 +00:00
when : is_debuntu and not internetarchive_enabled
2019-03-28 19:51:57 +00:00
# RESTART/STOP SYSTEMD SERVICE
# with "systemctl daemon-reload" in case mongodb.service changed, etc
2019-04-23 00:59:57 +00:00
- name : Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
2019-03-28 19:51:57 +00:00
systemd :
2019-04-23 00:59:57 +00:00
name : internetarchive
2019-03-28 19:51:57 +00:00
daemon_reload : yes
enabled : yes
state : restarted
2019-05-25 04:56:37 +00:00
when : internetarchive_enabled | bool
2019-04-23 00:59:57 +00:00
- name : Disable & Stop 'internetarchive' systemd service (if not internetarchive_enabled)
2019-03-28 19:51:57 +00:00
systemd :
2019-04-23 00:59:57 +00:00
name : internetarchive
2019-03-28 19:51:57 +00:00
daemon_reload : yes
enabled : no
state : stopped
2019-04-23 00:59:57 +00:00
when : not internetarchive_enabled
2019-03-28 19:51:57 +00:00
2019-05-25 12:58:07 +00:00
- name : Restart Apache service ({{ apache_service }}) to enable/disable http://box/archive (not just http://box:{{ internetarchive_port }})
2019-03-28 19:51:57 +00:00
systemd :
name : "{{ apache_service }}" # httpd or apache2
state : restarted
2019-05-25 04:56:37 +00:00
when : internetarchive_enabled | bool
2019-03-28 19:51:57 +00:00
2019-04-23 00:59:57 +00:00
- name : Add 'internetarchive' variable values to {{ iiab_ini_file }}
2019-03-28 19:51:57 +00:00
ini_file :
path : "{{ iiab_ini_file }}"
2019-04-23 00:59:57 +00:00
section : internetarchive
2019-03-28 19:51:57 +00:00
option : "{{ item.option }}"
value : "{{ item.value }}"
with_items :
- option : name
2019-05-25 05:03:08 +00:00
value : Internet Archive Distributed Web
2019-03-28 19:51:57 +00:00
- option : description
value : '"Dweb-mirror is intended to make the Internet Archive experience and UI available offline."'
2019-04-23 00:59:57 +00:00
- option : internetarchive_enabled
value : "{{ internetarchive_enabled }}"