Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
56a79e7
reuse config_vars.yml for installed app tracking
jvonau Sep 5, 2019
ab39fe9
rename 'test_kalite_installed' add installed tracker
jvonau Sep 5, 2019
8fab1e5
kiwix rework and add iiab_installed
jvonau Sep 5, 2019
ebfc137
kolibri rework and add iiab_installed
jvonau Sep 5, 2019
d1e01e8
sugarizer rework and add iiab_installed
jvonau Sep 5, 2019
7c6274e
moodle rework and add iiab_installed
jvonau Sep 5, 2019
bae9084
elgg rework and add iiab_installed
jvonau Sep 1, 2019
5e62904
wordpress db setup and installed tracker
jvonau Sep 1, 2019
9dab734
nextcloud add iiab_installed and tweeks
jvonau Sep 1, 2019
529b170
awstats split and iiab_installed
jvonau Sep 5, 2019
9151498
use lineinfile
jvonau Sep 9, 2019
1e14cab
azuracast - iiab_installed
jvonau Sep 14, 2019
9756860
bluetooth - iiab_installed
jvonau Sep 14, 2019
4463e4e
calibre-web - iiab_installed
jvonau Sep 14, 2019
24f1b4f
calibre - iiab_installed
jvonau Sep 14, 2019
e7ea453
dokuwiki - iiab_installed
jvonau Sep 14, 2019
3de43a3
gitea - iiab_installed
jvonau Sep 14, 2019
4094edc
lokole - iiab_installed
jvonau Sep 14, 2019
cb5e640
mediawiki - iiab_installed
jvonau Sep 14, 2019
8302811
minetest - iiab_installed
jvonau Sep 14, 2019
a311a0f
mosquitto - iiab_installed
jvonau Sep 14, 2019
130e6a2
munin - iiab_installed
jvonau Sep 14, 2019
9565410
nodered - iiab_installed
jvonau Sep 15, 2019
2807fbc
needs True
jvonau Oct 7, 2019
5b183e1
mongodb - iiab_installed
jvonau Oct 14, 2019
c63f9ba
provide ICO fuctionality at cmdline
jvonau Oct 10, 2019
8c74448
iiab-configure - deal with web services only
jvonau Oct 16, 2019
02fe653
use config_vars2 in source yaml files
jvonau Oct 1, 2019
4e52e41
mongo installed on image but not recorded workaround
jvonau Oct 14, 2019
d8df590
iiab-install can use faster code if /etc/iiab/config_vars2.yml exists
jvonau Oct 15, 2019
46f48fa
remove when install
jvonau Oct 15, 2019
83546e5
runrole --reinstall to remove role installed marker
jvonau Oct 16, 2019
2265a24
create config_vars2.yml at start of stage-4
jvonau Oct 16, 2019
ce2ec3b
kiwix allow reinstall/updates with runrole --reinstall
jvonau Oct 16, 2019
ddf8e1d
stage 4 installed
jvonau Oct 16, 2019
c396f44
cmdline tweeks
jvonau Oct 16, 2019
b67a19c
network guard against faulty user edits to local_vars
jvonau Oct 16, 2019
8423d73
runrole - ensure local_vars has *_install is set to True
jvonau Oct 17, 2019
a66b650
iiab_state
jvonau Oct 24, 2019
800ae2f
iiab_state2
jvonau Oct 24, 2019
9a0e054
Merge pull request #305 from iiab/master
holta Oct 24, 2019
626473e
Merge pull request #306 from jvonau/installed
holta Oct 24, 2019
b533cb6
#2008 var names, output, comments, small bugs
holta Oct 25, 2019
5ae521d
double-double-quote vars in echo for safety etc
holta Oct 25, 2019
217fdc5
Fix var name captive_portal_installed (not captiveportal_installed)
holta Oct 25, 2019
1604d8e
Remove 2 unnec '| bool' clauses
holta Oct 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#2008 var names, output, comments, small bugs
  • Loading branch information
holta committed Oct 25, 2019
commit b533cb6706c74c616ec32bcc45aaa7c7be942f17
43 changes: 23 additions & 20 deletions iiab-configure
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
#!/bin/bash

INVENTORY="ansible_hosts"
PLAYBOOK="iiab-from-cmdline.yml"
INVENTORY=ansible_hosts
PLAYBOOK=iiab-from-cmdline.yml
CWD=`pwd`
APPS=/etc/iiab/iiab_state.yml
ENV=/etc/iiab/iiab.env
IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
IIAB_ENV_FILE=/etc/iiab/iiab.env

if [ ! -f $PLAYBOOK ]; then
echo -e "\nExiting: IIAB Playbook not found."
echo -e "\nExiting: IIAB Playbook $PLAYBOOK not found."
echo -e "\nPlease run this in /opt/iiab/iiab (top level of the git repo)."
exit 1
fi
if [ -f $ENV ]; then

if [ -f $IIAB_ENV_FILE ]; then
STAGE=0
if grep -q STAGE= /etc/iiab/iiab.env ; then
source /etc/iiab/iiab.env
echo -e "\nExtracted STAGE="$STAGE" (counter) from /etc/iiab/iiab.env"
echo -e "\nExtracted STAGE=$STAGE (counter) from /etc/iiab/iiab.env"
if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is non-integer"
echo -e "\nEXITING: STAGE (counter) value == $STAGE is non-integer"
exit 1
elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is out-of-range"
echo -e "\nEXITING: STAGE (counter) value == $STAGE is out-of-range"
exit 1
elif [ "$STAGE" -lt 3 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE""
echo -e "\nIIAB stage 3 not complete"
echo -e "\nPlease run iiab-install"
echo -e "\nEXITING: STAGE (counter) value == $STAGE"
echo -e "\nIIAB Stage 3 not complete."
echo -e "\nPlease run: ./iiab-install"
exit 1
fi
else
echo -e "\nEXITING: STAGE (counter) not found"
echo -e "\nIIAB not installed"
echo -e "\nPlease run iiab-install"
echo -e "\nIIAB not installed."
echo -e "\nPlease run: ./iiab-install"
exit 1
fi
else
echo -e "\nEXITING: /etc/iiab/iiab.env not found"
echo -e "\nIIAB not installed"
echo -e "\nPlease run iiab-install"
echo -e "\nIIAB not installed."
echo -e "\nPlease run: ./iiab-install"
exit 1
fi
# workaround for image go away later
if grep -q sugar $APPS; then
if ! grep -q mongodb $APPS; then
echo "mongodb_installed: True" >> $APPS

# Workaround for (web-published) images; will go away later
if grep -q sugar $IIAB_STATE_FILE; then
if ! grep -q mongodb $IIAB_STATE_FILE; then
echo "mongodb_installed: True" >> $IIAB_STATE_FILE
fi
fi

Expand Down
65 changes: 32 additions & 33 deletions iiab-install
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Add cmdline options for passing to ansible
# Todo add proper shift to gobble up --debug --reinstall

PLAYBOOK="iiab-stages.yml"
INVENTORY="ansible_hosts"
APPS=/etc/iiab/iiab_state.yml
PLAYBOOK=iiab-stages.yml
INVENTORY=ansible_hosts
IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
ARGS=""
CWD=`pwd`
OS=`grep ^ID= /etc/*release|cut -d= -f2`
Expand All @@ -31,7 +31,7 @@ if [ ! -f /etc/iiab/local_vars.yml ]; then
echo -e "(2) MIN/MEDIUM/BIG samples are included in /opt/iiab/iiab/vars" >&2
echo -e "(3) NO TIME FOR DETAILS? RUN INTERNET-IN-A-BOX'S FRIENDLY 1-LINE INSTALLER:\n" >&2

echo -e ' http://download.iiab.io (click on "6.7" or a more recent version!)\n' >&2
echo -e ' http://download.iiab.io (click on "7.0" or a more recent version!)\n' >&2

exit 1
fi
Expand All @@ -54,10 +54,11 @@ fi

if [ "$1" != "--debug" ] && [ "$1" != "--reinstall" ] && [ "$1" != "" ]; then
echo "Use './iiab-install' for regular installs, or to continue an install."
echo "Use './iiab-install --reinstall' to force running all Stages 0-9."
echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9."
echo "Use './runrole' to run a single Stage or Role."
echo "Use './iiab-network' to run Network sections."
echo "Use './iiab-install --reinstall' to force running all Stages 0-9, followed by the Network Role."
echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9, followed by the Network Role."
echo "Use './iiab-configure' to run Stage 0, followed by Stages 4-9."
echo "Use './runrole' to run Stage 0, followed by a single Stage or Role."
echo "Use './iiab-network' to run Stage 0, followed by the Network Role."
exit 1
fi

Expand Down Expand Up @@ -109,21 +110,17 @@ STAGE=0
if [ -f /etc/iiab/iiab.env ]; then
if grep -q STAGE= /etc/iiab/iiab.env ; then
source /etc/iiab/iiab.env
echo "Extracted STAGE="$STAGE" (counter) from /etc/iiab/iiab.env"
echo "Extracted STAGE=$STAGE (counter) from /etc/iiab/iiab.env"
if ! [ "$STAGE" -eq "$STAGE" ] 2> /dev/null; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is non-integer in /etc/iiab/iiab.env"
echo -e "\nEXITING: STAGE (counter) value == $STAGE is non-integer in /etc/iiab/iiab.env"
exit 1
elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE" is out-of-range in /etc/iiab/iiab.env"
echo -e "\nEXITING: STAGE (counter) value == $STAGE is out-of-range in /etc/iiab/iiab.env"
exit 1
fi
fi
# if XSCE is present resolveconf will not be
if grep -q XSCE /etc/iiab/iiab.env ; then
STAGE=0
rm /etc/iiab/iiab.env
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
elif [ "$1" == "--reinstall" ]; then

if [ "$1" == "--reinstall" ]; then
STAGE=0
ARGS="$ARGS --extra-vars reinstall=True"
sed -i 's/^STAGE=.*/STAGE=0/' /etc/iiab/iiab.env
Expand All @@ -134,40 +131,42 @@ if [ -f /etc/iiab/iiab.env ]; then
echo "Wrote STAGE=2 (counter) to /etc/iiab/iiab.env"
elif [ "$STAGE" -eq 9 ]; then
echo -e "\nEXITING: STAGE (counter) in /etc/iiab/iiab.env shows Stage 9 Is Already Done."
echo -e "Use './iiab-install --reinstall' to force running all Stages 0-9."
echo -e "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9."
echo -e "Use './runrole' to run a single Stage or Role."
echo -e "Use './iiab-network' to run Network sections.\n\n"
echo -e "Use './iiab-configure' to turn installed service on|off via local_vars.yml.\n\n"
exit 0 # allows rerunning http://download.iiab.io/6.7/install.txt
echo -e "Use './iiab-install --reinstall' to force running all Stages 0-9, followed by the Network Role."
echo -e "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9, followed by the Network Role."
echo -e "Use './iiab-configure' to run Stage 0, followed by Stages 4-9."
echo -e "Use './runrole' to run Stage 0, followed by a single Stage or Role."
echo -e "Use './iiab-network' to run Stage 0, followed by the Network Role.\n\n"

exit 0 # Allows rerunning http://download.iiab.io/install.txt
fi
fi
if [ "$STAGE" -lt 2 ] && [ "$1" == "--debug" ]; then
echo -e "\n'--debug' *ignored* as STAGE (counter) < 2."
fi

# to catch up images to current code to benefit from pre-installed apps
# TEMPORARY: Catch images up to current code to benefit from pre-installed apps
if [ -f /etc/iiab/config_vars2.yml ]; then
mv /etc/iiab/config_vars2.yml $APPS
mv /etc/iiab/config_vars2.yml $IIAB_STATE_FILE
fi

if [ -f $APPS ]; then
if grep -q sugar $APPS; then
if ! grep -q mongodb $APPS; then
echo "mongodb_installed: True" >> $APPS
# Assumes /etc/iiab/iiab_state.yml is not created until (prior run of) Stage 4.
if [ -f $IIAB_STATE_FILE ]; then
if grep -q sugar $IIAB_STATE_FILE; && ! grep -q mongodb $IIAB_STATE_FILE; then
echo "mongodb_installed: True" >> $IIAB_STATE_FILE
fi

if [ "$STAGE" -eq 2 ]; then
echo -e "\n completing stage 3 from iiab image"
echo -e "\nCompleting Stage 3 from IIAB image (starts systemd service iiab-setup-db to run the 'mysql' role)."
systemctl start iiab-setup-db
fi
PLAYBOOK="iiab-from-console.yml"
ARGS=""

PLAYBOOK="iiab-from-console.yml" # Stage 4-9 then Network Role
ARGS="" # Removes '--extra-vars reinstall=True' if --reinstall, BUT WHY?
fi

echo -e "\nTRY TO RERUN './iiab-install' IF IT FAILS DUE TO CONNECTIVITY ISSUES ETC!\n"

echo -e "Running local playbooks....Stage 0 will now run....followed by Stages $(($STAGE + 1))-9"
echo -e "Running local Ansible playbooks...\n...Stage 0 will now run\n...followed by Stages $(($STAGE + 1))-9\n...and then the Network Role.\n"

export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"

Expand Down
4 changes: 2 additions & 2 deletions roles/4-server-options/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- name: ...IS BEGINNING ==================================
file:
path: "{{ iiab_installed }}"
path: "{{ iiab_state_file }}"
state: touch

- name: Install dnsmasq
Expand Down Expand Up @@ -33,7 +33,7 @@
- name: Install Bluetooth - only on Raspberry Pi
include_role:
name: bluetooth
when: (is_rpi and bluetooth_install) or pan_bluetooth_installed is defined
when: (is_rpi and bluetooth_install) or bluetooth_installed is defined
tags: bluetooth

# NETWORK moved to the very end, after Stage 9 (9-LOCAL-ADDONS)
Expand Down
4 changes: 2 additions & 2 deletions roles/awstats/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
command: mv /etc/awstats/awstats.conf /etc/awstats/awstats.conf.dist
when: awstats.stat.islnk is defined and not awstats.stat.islnk

- name: Add 'awstats_installed' variable values to {{ iiab_installed }}
- name: Add 'awstats_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^awstats_installed'
line: 'awstats_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/azuracast/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
args:
chdir: "{{ azuracast_host_dir }}"

- name: Add 'azuracast_installed' variable values to {{ iiab_installed }}
- name: Add 'azuracast_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^azuracast_installed'
line: 'azuracast_installed: True'
state: present
8 changes: 4 additions & 4 deletions roles/bluetooth/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
regexp: '^#DiscoverableTimeout'
line: 'DiscoverableTimeout = 0'

- name: Add 'pan_bluetooth_installed' variable values to {{ iiab_installed }}
- name: Add 'bluetooth_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
regexp: '^pan_bluetooth_installed'
line: 'pan_bluetooth_installed: True'
dest: "{{ iiab_state_file }}"
regexp: '^bluetooth_installed'
line: 'bluetooth_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/bluetooth/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- include_tasks: install.yml
when: bluetooth_install and not pan_bluetooth_installed is defined
when: bluetooth_install and not bluetooth_installed is defined

- include_tasks: enable.yml
when: bluetooth_install or pan_bluetooth_installed is defined
when: bluetooth_install or bluetooth_installed is defined

4 changes: 2 additions & 2 deletions roles/calibre-web/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
when: not metadatadb.stat.exists
#when: calibreweb_provision | bool

- name: Add 'calibreweb_installed' variable values to {{ iiab_installed }}
- name: Add 'calibreweb_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^calibreweb_installed'
line: 'calibreweb_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/calibre/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
include_tasks: create-db.yml
when: not calibre_db.stat.exists

- name: Add 'calibre_installed' variable values to {{ iiab_installed }}
- name: Add 'calibre_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^calibreweb_installed'
line: 'calibre_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/captive-portal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
state: absent
when: not captive_portal_enabled

- name: Add 'captiveportal_installed' variable values to {{ iiab_installed }}
- name: Add 'captiveportal_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^captiveportal_installed'
line: 'captiveportal_installed: True'
state: present
Expand Down
4 changes: 2 additions & 2 deletions roles/cups/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
tags:
- download

- name: Add 'cups_installed' variable values to {{ iiab_installed }}
- name: Add 'cups_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^cups_installed'
line: 'cups_installed: True'
state: present
Expand Down
4 changes: 2 additions & 2 deletions roles/dokuwiki/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
state: directory
recurse: yes

- name: Add 'dokuwiki_installed' variable values to {{ iiab_installed }}
- name: Add 'dokuwiki_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^dokuwiki_installed'
line: 'dokuwiki_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/elgg/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
src: elgg.conf
dest: "/etc/{{ apache_config_dir }}/elgg.conf"

- name: Add 'elgg_installed' variable values to {{ iiab_installed }}
- name: Add 'elgg_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^elgg_installed'
line: 'elgg_installed: True'
state: present
Expand Down
2 changes: 1 addition & 1 deletion roles/elgg/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
when: elgg_install and not elgg_installed is defined

- name: Provision DB
include_tasks: prov-db.yml
include_tasks: setup.yml
when: elgg_install and not installing

- name: Enable Elgg
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions roles/gitea/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@
tags:
- systemd

- name: Add 'gitea_installed' variable values to {{ iiab_installed }}
- name: Add 'gitea_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^gitea_installed'
line: 'gitea_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/internetarchive/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
- { src: 'internetarchive.service.j2', dest: '/etc/systemd/system/internetarchive.service' }
- { src: 'internetarchive.conf', dest: '/etc/apache2/sites-available/internetarchive.conf' }

- name: Add 'internetarchive_installed' variable values to {{ iiab_installed }}
- name: Add 'internetarchive_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^internetarchive_installed'
line: 'internetarchive_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/kalite/tasks/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
async: 1800
poll: 10

- name: Add 'kalite_installed' variable values to {{ iiab_installed }}
- name: Add 'kalite_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^kalite_installed'
line: 'kalite_installed: True'
state: present
4 changes: 2 additions & 2 deletions roles/kiwix/tasks/kiwix_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
- { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'}
- { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_config_dir }}/kiwix.conf', mode: '0644'}

- name: Add 'kiwix_installed' variable values to {{ iiab_installed }}
- name: Add 'kiwix_installed' variable values to {{ iiab_state_file }}
lineinfile:
dest: "{{ iiab_installed }}"
dest: "{{ iiab_state_file }}"
regexp: '^kiwix_installed'
line: 'kiwix_installed: True'
state: present
Loading