mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Some more renames and removing. line with blanks spaces
This commit is contained in:
parent
62c40aafa5
commit
8870ec82fe
6 changed files with 1 additions and 1 deletions
7
roles/internetarchive/defaults/main.yml
Normal file
7
roles/internetarchive/defaults/main.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
internetarchive_port: 4244
|
||||
internetarchive_dir: '{{ iiab_base }}/internetarchive'
|
||||
# for testing purposes, install and enable
|
||||
internetarchive_install: True
|
||||
internetarchive_enabled: True
|
||||
#internetarchive_install: False
|
||||
#internetarchive_enabled: False
|
||||
2
roles/internetarchive/meta/main.yml
Normal file
2
roles/internetarchive/meta/main.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
- { role: nodejs, tags: ['nodejs'], when: internetarchive_install }
|
||||
87
roles/internetarchive/tasks/main.yml
Normal file
87
roles/internetarchive/tasks/main.yml
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
# We need a recent version of node
|
||||
|
||||
- name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x
|
||||
fail:
|
||||
msg: "Internet Archive install cannot proceeed, 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"
|
||||
when: internetarchive_install and (nodejs_version != "10.x")
|
||||
|
||||
- name: Install packages needed by Distributed Web
|
||||
package:
|
||||
name:
|
||||
- libsecret-1-dev
|
||||
- cmake
|
||||
state: present
|
||||
|
||||
- name: Run 'sudo npm install dweb-archive dweb-mirror --allow-root --unsafe-perm=true' to create /opt/iiab/internetarchive/node_modules (CAN TAKE ~5 MINUTES)
|
||||
command: sudo npm install dweb-archive dweb-mirror --allow-root --unsafe-perm=true
|
||||
args:
|
||||
chdir: "{{ internetarchive_dir }}"
|
||||
when: internet_available
|
||||
|
||||
|
||||
# CONFIG FILES
|
||||
|
||||
- name: "Install from templates: internetarchive.service (systemd), internetarchive.conf (Apache)"
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
with_items:
|
||||
- { src: 'internetarchive.service.j2', dest: '/etc/systemd/system/internetarchive.service' }
|
||||
- { src: 'internetarchive.conf', dest: '/etc/apache2/sites-available/internetarchive.conf' }
|
||||
|
||||
|
||||
- name: Create symlink internetarchive.conf from sites-enabled to sites-available, for short URLs http://box/sugar & http://box/internetarchive (if internetarchive_enabled)
|
||||
file:
|
||||
src: /etc/apache2/sites-available/internetarchive.conf
|
||||
path: /etc/apache2/sites-enabled/internetarchive.conf
|
||||
state: link
|
||||
when: internetarchive_enabled and is_debuntu
|
||||
|
||||
- name: Remove symlink /etc/apache2/sites-enabled/internetarchive.conf (if not internetarchive_enabled)
|
||||
file:
|
||||
path: /etc/apache2/sites-enabled/internetarchive.conf
|
||||
state: absent
|
||||
when: not internetarchive_enabled and is_debuntu
|
||||
|
||||
|
||||
# RESTART/STOP SYSTEMD SERVICE
|
||||
|
||||
# with "systemctl daemon-reload" in case mongodb.service changed, etc
|
||||
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
|
||||
systemd:
|
||||
name: internetarchive
|
||||
daemon_reload: yes
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: internetarchive_enabled
|
||||
|
||||
- name: Disable & Stop 'internetarchive' systemd service (if not internetarchive_enabled)
|
||||
systemd:
|
||||
name: internetarchive
|
||||
daemon_reload: yes
|
||||
enabled: no
|
||||
state: stopped
|
||||
when: not internetarchive_enabled
|
||||
|
||||
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/internetarchive (not just http://box:{{ internetarchive_port }})
|
||||
systemd:
|
||||
name: "{{ apache_service }}" # httpd or apache2
|
||||
state: restarted
|
||||
when: internetarchive_enabled
|
||||
|
||||
- name: Add 'internetarchive' variable values to {{ iiab_ini_file }}
|
||||
ini_file:
|
||||
path: "{{ iiab_ini_file }}"
|
||||
section: internetarchive
|
||||
option: "{{ item.option }}"
|
||||
value: "{{ item.value }}"
|
||||
with_items:
|
||||
- option: name
|
||||
value: Archive Org Distributed Web
|
||||
- option: description
|
||||
value: '"Dweb-mirror is intended to make the Internet Archive experience and UI available offline."'
|
||||
- option: internetarchive_enabled
|
||||
value: "{{ internetarchive_enabled }}"
|
||||
8
roles/internetarchive/templates/internetarchive.conf
Normal file
8
roles/internetarchive/templates/internetarchive.conf
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# internetarchive_port is set to 4244 in /roles/archoeg/defaults/main.yml
|
||||
# If you need to change this, edit /etc/iiab/local_vars.yml prior to installing
|
||||
|
||||
RedirectMatch ^/archive.org$ /internetarchive
|
||||
RedirectMatch ^/archive$ /internetarchive
|
||||
|
||||
ProxyPass /internetarchive http://localhost:{{ internetarchive_port }}/internetarchive
|
||||
ProxyPassReverse /internetarchive http://localhost:{{ internetarchive_port }}/internetarchive
|
||||
17
roles/internetarchive/templates/internetarchive.service.j2
Normal file
17
roles/internetarchive/templates/internetarchive.service.j2
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Internet Archive Universal Library service
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory={{ internetarchive_dir }}
|
||||
ExecStart=/usr/bin/node {{ internetarchive_dir }}/internetarchive -s
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=internetarchive
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue