mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Merge pull request #1921 from jvonau/IA-speed
Skip yarn add if installed, but allow yarn upgrade if set in local_vars.yml
This commit is contained in:
commit
874521df84
7 changed files with 43 additions and 26 deletions
|
@ -124,6 +124,7 @@ if [ -f /etc/iiab/iiab.env ]; then
|
||||||
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
|
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
|
||||||
elif [ "$1" == "--reinstall" ]; then
|
elif [ "$1" == "--reinstall" ]; then
|
||||||
STAGE=0
|
STAGE=0
|
||||||
|
ARGS="$ARGS --extra-vars reinstall=True"
|
||||||
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
|
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
|
||||||
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
|
echo "Wrote STAGE=0 (counter) to /etc/iiab/iiab.env"
|
||||||
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then
|
elif [ "$STAGE" -ge 2 ] && [ "$1" == "--debug" ]; then
|
||||||
|
|
|
@ -1,2 +1,8 @@
|
||||||
|
- name: Create symlink /usr/bin/iiab-diagnostics
|
||||||
|
file:
|
||||||
|
src: "{{ iiab_dir }}/scripts/iiab-diagnostics"
|
||||||
|
dest: /usr/bin/iiab-diagnostics
|
||||||
|
state: link
|
||||||
|
|
||||||
- name: Create {{ iiab_ini_file }}
|
- name: Create {{ iiab_ini_file }}
|
||||||
include_tasks: iiab_ini.yml
|
include_tasks: iiab_ini.yml
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
# Initialize
|
# Initialize
|
||||||
|
|
||||||
- name: Create symlink /usr/bin/iiab-diagnostics
|
|
||||||
file:
|
|
||||||
src: "{{ iiab_dir }}/scripts/iiab-diagnostics"
|
|
||||||
dest: /usr/bin/iiab-diagnostics
|
|
||||||
state: link
|
|
||||||
|
|
||||||
- name: ...IS BEGINNING ============================================
|
- name: ...IS BEGINNING ============================================
|
||||||
stat:
|
stat:
|
||||||
path: "{{ iiab_env_file }}"
|
path: "{{ iiab_env_file }}"
|
||||||
|
@ -18,12 +11,10 @@
|
||||||
|
|
||||||
# We need to inialize the ini file and only write the location and version
|
# We need to inialize the ini file and only write the location and version
|
||||||
# sections once and only once to preserve the install date and git hash.
|
# sections once and only once to preserve the install date and git hash.
|
||||||
- name: Create IIAB directory structure and {{ iiab_ini_file }}, if first_run
|
- name: Create IIAB tools and {{ iiab_ini_file }}, if first_run
|
||||||
include_tasks: first_run.yml
|
include_tasks: first_run.yml
|
||||||
when: first_run | bool
|
when: first_run | bool
|
||||||
|
|
||||||
#- name: Loading computed_vars
|
|
||||||
# include_tasks: roles/0-init/tasks/computed_vars.yml
|
|
||||||
- name: Re-read local_facts.facts from /etc/ansible/facts.d
|
- name: Re-read local_facts.facts from /etc/ansible/facts.d
|
||||||
setup:
|
setup:
|
||||||
filter: ansible_local
|
filter: ansible_local
|
||||||
|
|
|
@ -7,3 +7,4 @@
|
||||||
# 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'
|
||||||
|
internetarchive_upgrade: False
|
||||||
|
|
|
@ -19,10 +19,12 @@
|
||||||
owner: "root"
|
owner: "root"
|
||||||
|
|
||||||
- name: Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
|
- name: Run yarn install to get needed modules (CAN TAKE ~15 MINUTES)
|
||||||
command: sudo yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
|
command: yarn add @internetarchive/dweb-archive @internetarchive/dweb-mirror
|
||||||
args:
|
args:
|
||||||
chdir: "{{ internetarchive_dir }}"
|
chdir: "{{ internetarchive_dir }}"
|
||||||
|
creates: "{{ internetarchive_dir }}/node_modules/@internetarchive/dweb-mirror/internetarchive"
|
||||||
when: internet_available | bool
|
when: internet_available | bool
|
||||||
|
register: internetarchive_installing
|
||||||
|
|
||||||
- name: Create directory /library/archiveorg
|
- name: Create directory /library/archiveorg
|
||||||
file:
|
file:
|
||||||
|
@ -30,6 +32,11 @@
|
||||||
state: directory
|
state: directory
|
||||||
owner: "root"
|
owner: "root"
|
||||||
|
|
||||||
|
- name: Set --reinstall fact
|
||||||
|
set_fact:
|
||||||
|
internetarchive_upgrade: True
|
||||||
|
when: reinstall is defined
|
||||||
|
|
||||||
|
|
||||||
# CONFIG FILES
|
# CONFIG FILES
|
||||||
|
|
||||||
|
@ -58,7 +65,25 @@
|
||||||
when: is_debuntu and not internetarchive_enabled
|
when: is_debuntu and not internetarchive_enabled
|
||||||
|
|
||||||
|
|
||||||
# RESTART/STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
|
- name: Stop 'internetarchive' systemd service
|
||||||
|
systemd:
|
||||||
|
name: internetarchive
|
||||||
|
daemon_reload: yes
|
||||||
|
state: stopped
|
||||||
|
|
||||||
|
- name: 'Update pre-existing install: yarn upgrade'
|
||||||
|
command: yarn upgrade
|
||||||
|
args:
|
||||||
|
chdir: "{{ internetarchive_dir }}"
|
||||||
|
when: not internetarchive_installing.changed and internetarchive_upgrade
|
||||||
|
|
||||||
|
# RESTART/ENABLE SYSTEMD SERVICE
|
||||||
|
- name: Disable 'internetarchive' systemd service (if not internetarchive_enabled)
|
||||||
|
systemd:
|
||||||
|
name: internetarchive
|
||||||
|
enabled: no
|
||||||
|
when: not internetarchive_enabled
|
||||||
|
|
||||||
# with "systemctl daemon-reload" in case mongodb.service changed, etc
|
# with "systemctl daemon-reload" in case mongodb.service changed, etc
|
||||||
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
|
- name: Enable & Restart 'internetarchive' systemd service (if internetarchive_enabled)
|
||||||
|
@ -69,14 +94,6 @@
|
||||||
state: restarted
|
state: restarted
|
||||||
when: internetarchive_enabled | bool
|
when: internetarchive_enabled | bool
|
||||||
|
|
||||||
- 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/archive (not just http://box:{{ internetarchive_port }})
|
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/archive (not just http://box:{{ internetarchive_port }})
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{ apache_service }}" # httpd or apache2
|
name: "{{ apache_service }}" # httpd or apache2
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
line: 'deb http://dl.yarnpkg.com/debian/ stable main'
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Yarn | Update APT cache"
|
|
||||||
apt:
|
|
||||||
update_cache: yes
|
|
||||||
|
|
||||||
- name: "Yarn | Install"
|
- name: "Yarn | Install"
|
||||||
package:
|
package:
|
||||||
name: yarn
|
name: yarn
|
||||||
|
|
9
runrole
9
runrole
|
@ -2,8 +2,13 @@
|
||||||
|
|
||||||
INVENTORY="ansible_hosts"
|
INVENTORY="ansible_hosts"
|
||||||
PLAYBOOK="run-one-role.yml"
|
PLAYBOOK="run-one-role.yml"
|
||||||
#PLAYBOOK="iiab-stages.yml"
|
ARGS=""
|
||||||
CWD=`pwd`
|
CWD=`pwd`
|
||||||
|
if [ "$1" == "--reinstall" ]; then
|
||||||
|
ARGS="$ARGS --extra-vars reinstall=True"
|
||||||
|
shift 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -eq 2 ]; then
|
||||||
export ANSIBLE_LOG_PATH="$2"
|
export ANSIBLE_LOG_PATH="$2"
|
||||||
else
|
else
|
||||||
|
@ -28,4 +33,4 @@ if [[ $# -eq 0 ]] ; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local -e "role_to_run=$1"
|
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local -e "role_to_run=$1"
|
||||||
|
|
Loading…
Reference in a new issue