mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Cleaner internetarchive & assoc deps
This commit is contained in:
parent
027832889b
commit
e54b6225c9
14 changed files with 258 additions and 147 deletions
|
@ -1,14 +1,14 @@
|
||||||
# Assume (enforce) we only get here if elgg_install: True
|
# Assume (enforce!) we only get here if elgg_install: True
|
||||||
# Assume (enforce) MySQL is running
|
# Assume (enforce?) MySQL is running
|
||||||
|
|
||||||
- name: "Set 'mysql_install: True' and 'mysql_enabled: True'"
|
# - name: "Set 'mysql_install: True' and 'mysql_enabled: True'"
|
||||||
set_fact:
|
# set_fact:
|
||||||
mysql_install: True
|
# mysql_install: True
|
||||||
mysql_enabled: True
|
# mysql_enabled: True
|
||||||
|
#
|
||||||
- name: MYSQL - run 'mysql' role (attempt to install & enable MySQL)
|
# - name: MYSQL - run 'mysql' role (attempt to install & enable MySQL)
|
||||||
include_role:
|
# include_role:
|
||||||
name: mysql
|
# name: mysql
|
||||||
|
|
||||||
|
|
||||||
- name: Download {{ iiab_download_url }}/elgg-{{ elgg_version }}.zip to {{ downloads_dir }}
|
- name: Download {{ iiab_download_url }}/elgg-{{ elgg_version }}.zip to {{ downloads_dir }}
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
|
||||||
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
|
||||||
|
|
||||||
internetarchive_dir: '{{ iiab_base }}/internetarchive'
|
internetarchive_dir: "{{ iiab_base }}/internetarchive" # /opt/iiab
|
||||||
internetarchive_upgrade: False
|
|
||||||
|
# internetarchive_upgrade: False # 2020-02-04: No longer needed!?
|
||||||
|
|
12
roles/internetarchive/tasks/apache.yml
Normal file
12
roles/internetarchive/tasks/apache.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
- name: Enable internetarchive.conf via Apache (for short URL http://box/archive eventually?) if internetarchive_enabled
|
||||||
|
command: a2ensite internetarchive.conf
|
||||||
|
when: internetarchive_enabled | bool
|
||||||
|
|
||||||
|
- name: Disable internetarchive.conf via Apache, if not internetarchive_enabled
|
||||||
|
command: a2dissite internetarchive.conf
|
||||||
|
when: not internetarchive_enabled
|
||||||
|
|
||||||
|
- name: (Re)Start '{{ apache_service }}' systemd service
|
||||||
|
systemd:
|
||||||
|
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
|
||||||
|
state: restarted
|
|
@ -1,47 +0,0 @@
|
||||||
- name: Create symlink internetarchive.conf from sites-enabled to sites-available, for short URL http://box/archive (if debuntu and internetarchive_enabled)
|
|
||||||
file:
|
|
||||||
src: /etc/apache2/sites-available/internetarchive.conf
|
|
||||||
path: /etc/apache2/sites-enabled/internetarchive.conf
|
|
||||||
state: link
|
|
||||||
when: is_debuntu and internetarchive_enabled
|
|
||||||
|
|
||||||
- name: Remove symlink /etc/apache2/sites-enabled/internetarchive.conf (if debuntu and not internetarchive_enabled)
|
|
||||||
file:
|
|
||||||
path: /etc/apache2/sites-enabled/internetarchive.conf
|
|
||||||
state: absent
|
|
||||||
when: is_debuntu and not internetarchive_enabled
|
|
||||||
|
|
||||||
# RESTART/ENABLE SYSTEMD SERVICE
|
|
||||||
- name: Disable 'internetarchive' systemd service (if not internetarchive_enabled)
|
|
||||||
systemd:
|
|
||||||
name: internetarchive
|
|
||||||
enabled: no
|
|
||||||
when: not internetarchive_enabled
|
|
||||||
|
|
||||||
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
|
|
||||||
systemd:
|
|
||||||
name: internetarchive
|
|
||||||
daemon_reload: yes
|
|
||||||
enabled: yes
|
|
||||||
state: restarted
|
|
||||||
when: internetarchive_enabled | bool
|
|
||||||
|
|
||||||
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/archive (not just http://box:{{ internetarchive_port }})
|
|
||||||
systemd:
|
|
||||||
name: "{{ apache_service }}" # httpd or apache2
|
|
||||||
state: restarted
|
|
||||||
when: internetarchive_enabled | bool
|
|
||||||
|
|
||||||
- name: Add 'internetarchive' variable values to {{ iiab_ini_file }}
|
|
||||||
ini_file:
|
|
||||||
path: "{{ iiab_ini_file }}"
|
|
||||||
section: internetarchive
|
|
||||||
option: "{{ item.option }}"
|
|
||||||
value: "{{ item.value | string }}"
|
|
||||||
with_items:
|
|
||||||
- option: name
|
|
||||||
value: Internet Archive
|
|
||||||
- option: description
|
|
||||||
value: '"Take the Internet Archive experience and materials offline, in a decentralized way!"'
|
|
||||||
- option: internetarchive_enabled
|
|
||||||
value: "{{ internetarchive_enabled }}"
|
|
|
@ -5,16 +5,21 @@
|
||||||
nodejs_install: True
|
nodejs_install: True
|
||||||
nodejs_enabled: True
|
nodejs_enabled: True
|
||||||
|
|
||||||
- name: Install Node.JS
|
- name: NODEJS - run 'nodejs' role (attempt to install & enable Node.js)
|
||||||
include_role:
|
include_role:
|
||||||
name: nodejs
|
name: nodejs
|
||||||
|
|
||||||
|
- name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x or 12.x
|
||||||
|
fail:
|
||||||
|
msg: "Internet Archive install cannot proceed, as it currently requires Node.js 10.x or 12.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: (nodejs_version != "10.x") and (nodejs_version != "12.x")
|
||||||
|
|
||||||
- name: "Set 'yarn_install: True' and 'yarn_enabled: True'"
|
- name: "Set 'yarn_install: True' and 'yarn_enabled: True'"
|
||||||
set_fact:
|
set_fact:
|
||||||
yarn_install: True
|
yarn_install: True
|
||||||
yarn_enabled: True
|
yarn_enabled: True
|
||||||
|
|
||||||
- name: Install Yarn
|
- name: YARN - run 'yarn' role (attempt to install & enable Yarn package manager)
|
||||||
include_role:
|
include_role:
|
||||||
name: yarn
|
name: yarn
|
||||||
|
|
||||||
|
@ -23,40 +28,42 @@
|
||||||
name: libsecret-1-dev
|
name: libsecret-1-dev
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|
||||||
# CREATE 2 DIRS & RUN YARN
|
# CREATE 2 DIRS & RUN YARN
|
||||||
|
|
||||||
- name: mkdir {{ internetarchive_dir }}
|
- name: mkdir {{ internetarchive_dir }}
|
||||||
file:
|
file:
|
||||||
path: "{{ internetarchive_dir }}" # /opt/iiab/internetarchive
|
|
||||||
state: directory
|
state: directory
|
||||||
owner: "root"
|
path: "{{ internetarchive_dir }}" # /opt/iiab/internetarchive
|
||||||
|
# owner: root
|
||||||
|
|
||||||
- name: Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
|
- name: Run yarn install to populate {{ internetarchive_dir }}/node_modules (CAN TAKE ~15 MINUTES)
|
||||||
shell: yarn config set child-concurrency 1 && yarn add @internetarchive/dweb-mirror
|
shell: yarn config set child-concurrency 1 && yarn add @internetarchive/dweb-mirror
|
||||||
args:
|
args:
|
||||||
chdir: "{{ internetarchive_dir }}"
|
chdir: "{{ internetarchive_dir }}"
|
||||||
creates: "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
|
creates: "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
|
||||||
when: internet_available | bool
|
when: internet_available | bool
|
||||||
register: internetarchive_installing
|
# register: internetarchive_installing
|
||||||
|
|
||||||
- name: mkdir /library/archiveorg
|
- name: mkdir {{ content_base }}/archiveorg
|
||||||
file:
|
file:
|
||||||
path: "/library/archiveorg"
|
|
||||||
state: directory
|
state: directory
|
||||||
owner: "root"
|
path: "{{ content_base }}/archiveorg" # /library
|
||||||
|
# owner: root
|
||||||
|
|
||||||
|
|
||||||
# CONFIG FILES
|
# CONFIG FILES
|
||||||
|
|
||||||
- name: "Install from templates: internetarchive.service (systemd), internetarchive.conf (Apache)"
|
- name: "Install from templates: /etc/systemd/system/internetarchive.service, /etc/{{ apache_conf_dir }}/internetarchive.conf"
|
||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
dest: "{{ item.dest }}"
|
dest: "{{ item.dest }}"
|
||||||
mode: '0644'
|
# owner: root
|
||||||
owner: root
|
# group: root
|
||||||
group: root
|
# mode: '0644'
|
||||||
with_items:
|
with_items:
|
||||||
- { src: 'internetarchive.service.j2', dest: '/etc/systemd/system/internetarchive.service' }
|
- { src: 'internetarchive.service.j2', dest: '/etc/systemd/system/internetarchive.service' }
|
||||||
- { src: 'internetarchive.conf', dest: '/etc/apache2/sites-available/internetarchive.conf' }
|
- { src: 'internetarchive.conf', dest: '/etc/{{ apache_conf_dir }}/internetarchive.conf' } # apache2/sites-available
|
||||||
|
|
||||||
|
|
||||||
# RECORD Internet Archive AS INSTALLED
|
# RECORD Internet Archive AS INSTALLED
|
||||||
|
|
|
@ -1,32 +1,93 @@
|
||||||
# We need a recent version of node
|
# "How do i fail a task in Ansible if the variable contains a boolean value?
|
||||||
- name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 10.x or 12.x
|
# I want to perform input validation for Ansible playbooks"
|
||||||
fail:
|
# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499
|
||||||
msg: "Internet Archive install cannot proceed, as it currently requires Node.js 10.x or 12.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") and (nodejs_version != "12.x")
|
|
||||||
|
|
||||||
- name: Install Yarn and Internet Archive
|
# We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need
|
||||||
|
# to re-check whether vars are defined here. As Ansible vars cannot be unset:
|
||||||
|
# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible
|
||||||
|
|
||||||
|
- name: Assert that "internetarchive_install is sameas true" (boolean not string etc)
|
||||||
|
assert:
|
||||||
|
that: internetarchive_install is sameas true
|
||||||
|
fail_msg: "PLEASE SET 'internetarchive_install: True' e.g. IN: /etc/iiab/local_vars.yml"
|
||||||
|
quiet: yes
|
||||||
|
|
||||||
|
- name: Assert that "internetarchive_enabled | type_debug == 'bool'" (boolean not string etc)
|
||||||
|
assert:
|
||||||
|
that: internetarchive_enabled | type_debug == 'bool'
|
||||||
|
fail_msg: "PLEASE GIVE VARIABLE 'internetarchive_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml"
|
||||||
|
quiet: yes
|
||||||
|
|
||||||
|
|
||||||
|
#- name: Set --reinstall fact
|
||||||
|
# set_fact:
|
||||||
|
# internetarchive_upgrade: True
|
||||||
|
# when: reinstall is defined
|
||||||
|
|
||||||
|
- block: # UPDATE IF... internetarchive_installed is defined and internet_available
|
||||||
|
|
||||||
|
- name: Stop 'internetarchive' systemd service, if internetarchive_upgrade
|
||||||
|
systemd:
|
||||||
|
name: internetarchive
|
||||||
|
daemon_reload: yes
|
||||||
|
state: stopped
|
||||||
|
#when: internetarchive_enabled and internetarchive_upgrade
|
||||||
|
|
||||||
|
- name: Update pre-existing install (yarn upgrade) if internetarchive_upgrade
|
||||||
|
shell: yarn config set child-concurrency 1 && yarn install && yarn upgrade
|
||||||
|
args:
|
||||||
|
chdir: "{{ internetarchive_dir }}"
|
||||||
|
#when: internetarchive_enabled and internetarchive_upgrade
|
||||||
|
|
||||||
|
when: internetarchive_installed is defined and internet_available # END BLOCK
|
||||||
|
|
||||||
|
# "ELSE" INSTALL...
|
||||||
|
|
||||||
|
- name: Install Internet Archive if 'internetarchive_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
|
||||||
include_tasks: install.yml
|
include_tasks: install.yml
|
||||||
when: internetarchive_install and not internetarchive_installed is defined
|
when: internetarchive_installed is undefined and internet_available
|
||||||
|
|
||||||
- name: Set --reinstall fact
|
|
||||||
set_fact:
|
|
||||||
internetarchive_upgrade: True
|
|
||||||
when: reinstall is defined
|
|
||||||
|
|
||||||
# STOP SYSTEMD SERVICE
|
|
||||||
- name: Stop 'internetarchive' systemd service
|
# ENABLE/DISABLE/RESTART SYSTEMD SERVICE & WEB SERVERS AS NEC ?
|
||||||
|
|
||||||
|
- name: Enable & Restart 'internetarchive' systemd service, if internetarchive_enabled
|
||||||
systemd:
|
systemd:
|
||||||
name: internetarchive
|
name: internetarchive
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
|
when: internetarchive_enabled | bool
|
||||||
|
|
||||||
|
- name: Disable & Stop 'internetarchive' systemd service, if not internetarchive_enabled
|
||||||
|
systemd:
|
||||||
|
name: internetarchive
|
||||||
|
enabled: no
|
||||||
state: stopped
|
state: stopped
|
||||||
when: internetarchive_enabled and internetarchive_upgrade
|
when: not internetarchive_enabled
|
||||||
|
|
||||||
- name: 'Update pre-existing install: yarn upgrade'
|
#- name: Enable/Disable/Restart Apache if primary
|
||||||
shell: yarn config set child-concurrency 1 && yarn install && yarn upgrade
|
- name: SHIM FOR NOW SO ALWAYS DO THE...Enable/Disable/Restart Apache
|
||||||
args:
|
include_tasks: apache.yml
|
||||||
chdir: "{{ internetarchive_dir }}"
|
#when: not nginx_enabled
|
||||||
when: internetarchive_enabled and internetarchive_upgrade
|
|
||||||
|
|
||||||
- name: Enable Internet Archive
|
- name: Enable/Disable/Restart NGINX if primary
|
||||||
include_tasks: enable.yml
|
include_tasks: nginx.yml
|
||||||
when: internetarchive_install or internetarchive_installed is defined
|
when: nginx_enabled | bool
|
||||||
|
|
||||||
|
|
||||||
|
- name: Add 'internetarchive' variable values to {{ iiab_ini_file }}
|
||||||
|
ini_file:
|
||||||
|
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
|
||||||
|
section: internetarchive
|
||||||
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value | string }}"
|
||||||
|
with_items:
|
||||||
|
- option: name
|
||||||
|
value: Internet Archive
|
||||||
|
- option: description
|
||||||
|
value: '"Take the Internet Archive experience and materials offline, in a decentralized way!"'
|
||||||
|
- option: internetarchive_install
|
||||||
|
value: "{{ internetarchive_install }}"
|
||||||
|
- option: internetarchive_enabled
|
||||||
|
value: "{{ internetarchive_enabled }}"
|
||||||
|
|
16
roles/internetarchive/tasks/nginx.yml
Normal file
16
roles/internetarchive/tasks/nginx.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
- name: Enable http://box/archive via NGINX, by installing {{ nginx_conf_dir }}/internetarchive-nginx.conf from template
|
||||||
|
template:
|
||||||
|
src: internetarchive-nginx.conf.j2 # TO DO: roles/internetarchive/templates/internetarchive-nginx.conf.j2
|
||||||
|
dest: "{{ nginx_conf_dir }}/internetarchive-nginx.conf" # /etc/nginx/conf.d
|
||||||
|
when: internetarchive_enabled | bool
|
||||||
|
|
||||||
|
- name: Disable http://box/archive via NGINX, by removing {{ nginx_conf_dir }}/internetarchive-nginx.conf
|
||||||
|
file:
|
||||||
|
path: "{{ nginx_conf_dir }}/internetarchive-nginx.conf" # /etc/nginx/conf.d
|
||||||
|
state: absent
|
||||||
|
when: not internetarchive_enabled
|
||||||
|
|
||||||
|
- name: Restart 'nginx' systemd service
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
state: restarted
|
|
@ -0,0 +1,2 @@
|
||||||
|
# 2020-02-04: Let's try to get http://box/archive working with NGINX, using
|
||||||
|
# this file. BACKGROUND: https://github.com/iiab/iiab/pull/2120
|
|
@ -40,12 +40,12 @@
|
||||||
# enabled: no
|
# enabled: no
|
||||||
# when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
|
# when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
|
||||||
|
|
||||||
- name: "Set 'postgresql_enabled: True'" if moodle_enabled
|
- name: "Set 'postgresql_enabled: True' if moodle_enabled"
|
||||||
set_fact:
|
set_fact:
|
||||||
postgresql_enabled: True
|
postgresql_enabled: True
|
||||||
when: moodle_enabled | bool
|
when: moodle_enabled | bool
|
||||||
|
|
||||||
- name: "Set 'postgresql_enabled: False'" if 'not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)'
|
- name: "Set 'postgresql_enabled: False' if 'not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)'"
|
||||||
set_fact:
|
set_fact:
|
||||||
postgresql_enabled: False
|
postgresql_enabled: False
|
||||||
when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
|
when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
value: "{{ item.value | string }}"
|
value: "{{ item.value | string }}"
|
||||||
with_items:
|
with_items:
|
||||||
- option: name
|
- option: name
|
||||||
value: Nodejs
|
value: Node.js
|
||||||
- option: description
|
- option: description
|
||||||
value: '"Node.js is a JavaScript runtime environment built on Chrome''s V8 JavaScript engine, that executes JavaScript code outside of a browser."'
|
value: '"Node.js is a JavaScript runtime environment built on Chrome''s V8 JavaScript engine, that executes JavaScript code outside of a browser."'
|
||||||
- option: install
|
- option: install
|
||||||
|
|
41
roles/yarn/tasks/install.yml
Normal file
41
roles/yarn/tasks/install.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
- name: "Yarn | GPG"
|
||||||
|
apt_key:
|
||||||
|
url: https://dl.yarnpkg.com/debian/pubkey.gpg
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: "Yarn | Ensure Debian sources list file exists"
|
||||||
|
file:
|
||||||
|
path: /etc/apt/sources.list.d/yarn.list
|
||||||
|
owner: root
|
||||||
|
mode: '0644'
|
||||||
|
state: touch
|
||||||
|
|
||||||
|
- name: "Yarn | Ensure Debian package is in sources list"
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/apt/sources.list.d/yarn.list
|
||||||
|
regexp: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
||||||
|
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: "Yarn | Update APT cache"
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: "Yarn | Install"
|
||||||
|
package:
|
||||||
|
name: yarn
|
||||||
|
state: latest
|
||||||
|
when: internet_available and is_debuntu
|
||||||
|
|
||||||
|
|
||||||
|
# RECORD Yarn AS INSTALLED
|
||||||
|
|
||||||
|
- name: "Set 'yarn_installed: True'"
|
||||||
|
set_fact:
|
||||||
|
yarn_installed: True
|
||||||
|
|
||||||
|
- name: "Add 'yarn_installed: True' to {{ iiab_state_file }}"
|
||||||
|
lineinfile:
|
||||||
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||||
|
regexp: '^yarn_installed'
|
||||||
|
line: 'yarn_installed: True'
|
|
@ -1,41 +1,48 @@
|
||||||
- name: "Yarn | GPG"
|
# "How do i fail a task in Ansible if the variable contains a boolean value?
|
||||||
apt_key:
|
# I want to perform input validation for Ansible playbooks"
|
||||||
url: https://dl.yarnpkg.com/debian/pubkey.gpg
|
# https://stackoverflow.com/questions/46664127/how-do-i-fail-a-task-in-ansible-if-the-variable-contains-a-boolean-value-i-want/46667499#46667499
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: "Yarn | Ensure Debian sources list file exists"
|
# We assume 0-init/tasks/validate_vars.yml has DEFINITELY been run, so no need
|
||||||
file:
|
# to re-check whether vars are defined here. As Ansible vars cannot be unset:
|
||||||
path: /etc/apt/sources.list.d/yarn.list
|
# https://serverfault.com/questions/856729/how-to-destroy-delete-unset-a-variable-value-in-ansible
|
||||||
owner: root
|
|
||||||
mode: '0644'
|
|
||||||
state: touch
|
|
||||||
|
|
||||||
- name: "Yarn | Ensure Debian package is in sources list"
|
- name: Assert that "yarn_install is sameas true" (boolean not string etc)
|
||||||
lineinfile:
|
assert:
|
||||||
dest: /etc/apt/sources.list.d/yarn.list
|
that: yarn_install is sameas true
|
||||||
regexp: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
fail_msg: "PLEASE SET 'yarn_install: True' e.g. IN: /etc/iiab/local_vars.yml"
|
||||||
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
quiet: yes
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: "Yarn | Update APT cache"
|
- name: Assert that "yarn_enabled | type_debug == 'bool'" (boolean not string etc)
|
||||||
apt:
|
assert:
|
||||||
update_cache: yes
|
that: yarn_enabled | type_debug == 'bool'
|
||||||
|
fail_msg: "PLEASE GIVE VARIABLE 'yarn_enabled' A PROPER (UNQUOTED) ANSIBLE BOOLEAN VALUE e.g. IN: /etc/iiab/local_vars.yml"
|
||||||
|
quiet: yes
|
||||||
|
|
||||||
- name: "Yarn | Install"
|
- debug:
|
||||||
package:
|
var: yarn_install
|
||||||
name: yarn
|
- debug:
|
||||||
state: latest
|
var: yarn_enabled
|
||||||
when: internet_available and is_debuntu
|
- debug:
|
||||||
|
var: yarn_installed
|
||||||
|
|
||||||
|
|
||||||
# RECORD Yarn AS INSTALLED
|
- name: Install Yarn if 'yarn_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
|
||||||
|
include_tasks: install.yml
|
||||||
|
when: yarn_installed is undefined
|
||||||
|
|
||||||
- name: "Set 'yarn_installed: True'"
|
|
||||||
set_fact:
|
|
||||||
yarn_installed: True
|
|
||||||
|
|
||||||
- name: "Add 'yarn_installed: True' to {{ iiab_state_file }}"
|
- name: Add 'yarn' variable values to {{ iiab_ini_file }}
|
||||||
lineinfile:
|
ini_file:
|
||||||
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab_state.yml
|
||||||
regexp: '^yarn_installed'
|
section: yarn
|
||||||
line: 'yarn_installed: True'
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value | string }}"
|
||||||
|
with_items:
|
||||||
|
- option: name
|
||||||
|
value: Yarn
|
||||||
|
- option: description
|
||||||
|
value: '"Fast, reliable, and secure dependency management. Comparable to npm. Released by Facebook in October 2016."'
|
||||||
|
- option: yarn_install
|
||||||
|
value: "{{ yarn_install }}"
|
||||||
|
- option: yarn_enabled
|
||||||
|
value: "{{ yarn_enabled }}"
|
||||||
|
|
6
runrole
6
runrole
|
@ -61,7 +61,7 @@ fi
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
if [ "$REINSTALL" == "1" ]; then
|
if [ "$REINSTALL" == "1" ]; then
|
||||||
if [ ! $1 == "internetarchive" ]; then # special handling
|
#if [ ! $1 == "internetarchive" ]; then # special handling
|
||||||
if [ $1 == "calibre-web" ]; then # role directory & installed marker differ
|
if [ $1 == "calibre-web" ]; then # role directory & installed marker differ
|
||||||
sed -i -e '/^calibreweb/d' $IIAB_STATE_FILE
|
sed -i -e '/^calibreweb/d' $IIAB_STATE_FILE
|
||||||
elif [ $1 == "httpd" ]; then # role directory & installed marker differ
|
elif [ $1 == "httpd" ]; then # role directory & installed marker differ
|
||||||
|
@ -72,8 +72,8 @@ if [ "$REINSTALL" == "1" ]; then
|
||||||
# sed -i -e '/^pan_bluetooth/d' $IIAB_STATE_FILE
|
# sed -i -e '/^pan_bluetooth/d' $IIAB_STATE_FILE
|
||||||
else
|
else
|
||||||
sed -i -e "/^$1/d" $IIAB_STATE_FILE
|
sed -i -e "/^$1/d" $IIAB_STATE_FILE
|
||||||
fi
|
fi
|
||||||
fi
|
#fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
|
|
|
@ -284,10 +284,11 @@ squid_enabled: False
|
||||||
dansguardian_install: False
|
dansguardian_install: False
|
||||||
dansguardian_enabled: False
|
dansguardian_enabled: False
|
||||||
|
|
||||||
# 2020-01-23: postgresql_install is completely ignored as PostgreSQL is
|
# 2020-02-04: postgresql_install is completely ignored as PostgreSQL is
|
||||||
# installed on demand as a dependency -- by Moodle &/or Pathagar as nec --
|
# installed on demand as a dependency -- by Moodle &/or Pathagar -- but for now
|
||||||
# but for now we set fake value 'postgresql_install: True' for
|
# we set fake value 'postgresql_install: True' so that
|
||||||
# 'postgresql_installed is defined' tests e.g. in 0-init/tasks/validate_vars.yml
|
# 'postgresql_installed is defined' input validation works, e.g. in
|
||||||
|
# 0-init/tasks/validate_vars.yml
|
||||||
postgresql_install: True
|
postgresql_install: True
|
||||||
postgresql_enabled: False
|
postgresql_enabled: False
|
||||||
|
|
||||||
|
@ -381,10 +382,11 @@ mosquitto_install: False
|
||||||
mosquitto_enabled: False
|
mosquitto_enabled: False
|
||||||
mosquitto_port: 1883
|
mosquitto_port: 1883
|
||||||
|
|
||||||
# 2020-01-23: nodejs_install is completely ignored as Node.js is installed on
|
# 2020-02-04: nodejs_install is completely ignored as Node.js is installed on
|
||||||
# demand as a dependency -- by Node-RED, Sugarizer and/or Internet Archive --
|
# demand as a dependency -- by Node-RED, Sugarizer and/or Internet Archive --
|
||||||
# but for now we set fake value 'nodejs_install: True' for
|
# but for now we set fake value 'nodejs_install: True' so that
|
||||||
# 'nodejs_installed is defined' tests e.g. in 0-init/tasks/validate_vars.yml
|
# 'nodejs_installed is defined' input validation works, e.g. in
|
||||||
|
# 0-init/tasks/validate_vars.yml
|
||||||
nodejs_install: True
|
nodejs_install: True
|
||||||
nodejs_enabled: False
|
nodejs_enabled: False
|
||||||
# Node.js version used by roles/nodejs/tasks/main.yml for 3 roles:
|
# Node.js version used by roles/nodejs/tasks/main.yml for 3 roles:
|
||||||
|
@ -454,11 +456,12 @@ moodle_enabled: False
|
||||||
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
|
# If using Moodle intensively, set apache_high_php_limits in 3-BASE-SERVER
|
||||||
|
|
||||||
# MongoDB (/library/dbdata/mongodb) greatly enhances the Sugarizer experience.
|
# MongoDB (/library/dbdata/mongodb) greatly enhances the Sugarizer experience.
|
||||||
# The roles/mongodb playbook (was?) invoked by roles/sugarizer/meta/main.yml
|
# This role was formerly installed by roles/sugarizer/meta/main.yml
|
||||||
# 2020-01-23: mongodb_install is completely ignored as MongoDB is installed on
|
#
|
||||||
|
# 2020-02-04: mongodb_install is completely ignored as MongoDB is installed on
|
||||||
# demand as a dependency -- by Sugarizer -- but for now we set fake value
|
# demand as a dependency -- by Sugarizer -- but for now we set fake value
|
||||||
# 'mongodb_install: True' for 'mongodb_installed is defined' tests e.g. in
|
# 'mongodb_install: True' so that 'mongodb_installed is defined' input
|
||||||
# 0-init/tasks/validate_vars.yml
|
# validation works, e.g. in 0-init/tasks/validate_vars.yml
|
||||||
mongodb_install: True
|
mongodb_install: True
|
||||||
# FYI 'mongodb_enabled: False' works when Sugarizer is disabled. Required by
|
# FYI 'mongodb_enabled: False' works when Sugarizer is disabled. Required by
|
||||||
# mongodb/tasks/enable.yml to shut down the service and log status, but that is
|
# mongodb/tasks/enable.yml to shut down the service and log status, but that is
|
||||||
|
@ -549,8 +552,16 @@ vnstat_enabled: True
|
||||||
|
|
||||||
# 9-LOCAL-ADDONS
|
# 9-LOCAL-ADDONS
|
||||||
|
|
||||||
# Internet Archive Decentralized Web - create your own offline version box:4244
|
# 2020-02-04: yarn_install is completely ignored as the Yarn package manager is
|
||||||
# (or http://box/archive) arising from digital library https://dweb.archive.org
|
# installed on demand as a dependency -- by Internet Archive -- but for now we
|
||||||
|
# set fake value 'yarn_install: True' so that 'yarn_installed is defined' input
|
||||||
|
# validation works, e.g. in 0-init/tasks/validate_vars.yml
|
||||||
|
yarn_install: True
|
||||||
|
yarn_enabled: False
|
||||||
|
|
||||||
|
# Internet Archive Offline / Decentralized Web - create your own offline
|
||||||
|
# version (http://box:4244 or later http://box/archive?) arising from digital
|
||||||
|
# library https://dweb.archive.org
|
||||||
internetarchive_install: False
|
internetarchive_install: False
|
||||||
internetarchive_enabled: False
|
internetarchive_enabled: False
|
||||||
internetarchive_port: 4244 # for http://box:4244
|
internetarchive_port: 4244 # for http://box:4244
|
||||||
|
|
Loading…
Reference in a new issue