1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-12 19:22:24 +00:00

2008 var names, output, comments, small bugs

This commit is contained in:
holta 2019-10-24 21:05:47 -04:00 committed by Jerry Vonau
parent 6be97bba6c
commit 38fd86ac90
42 changed files with 144 additions and 137 deletions

View file

@ -1,48 +1,51 @@
#!/bin/bash #!/bin/bash
INVENTORY="ansible_hosts" INVENTORY=ansible_hosts
PLAYBOOK="iiab-from-cmdline.yml" PLAYBOOK=iiab-from-cmdline.yml
CWD=`pwd` CWD=`pwd`
APPS=/etc/iiab/iiab_state.yml IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
ENV=/etc/iiab/iiab.env IIAB_ENV_FILE=/etc/iiab/iiab.env
if [ ! -f $PLAYBOOK ]; then 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)." echo -e "\nPlease run this in /opt/iiab/iiab (top level of the git repo)."
exit 1 exit 1
fi fi
if [ -f $ENV ]; then
if [ -f $IIAB_ENV_FILE ]; then
STAGE=0 STAGE=0
if grep -q STAGE= /etc/iiab/iiab.env ; then if grep -q STAGE= /etc/iiab/iiab.env ; then
source /etc/iiab/iiab.env 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 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 exit 1
elif [ "$STAGE" -lt 0 ] || [ "$STAGE" -gt 9 ]; then 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 exit 1
elif [ "$STAGE" -lt 3 ]; then elif [ "$STAGE" -lt 3 ]; then
echo -e "\nEXITING: STAGE (counter) value == "$STAGE"" echo -e "\nEXITING: STAGE (counter) value == $STAGE"
echo -e "\nIIAB stage 3 not complete" echo -e "\nIIAB Stage 3 not complete."
echo -e "\nPlease run iiab-install" echo -e "\nPlease run: ./iiab-install"
exit 1 exit 1
fi fi
else else
echo -e "\nEXITING: STAGE (counter) not found" echo -e "\nEXITING: STAGE (counter) not found"
echo -e "\nIIAB not installed" echo -e "\nIIAB not installed."
echo -e "\nPlease run iiab-install" echo -e "\nPlease run: ./iiab-install"
exit 1 exit 1
fi fi
else else
echo -e "\nEXITING: /etc/iiab/iiab.env not found" echo -e "\nEXITING: /etc/iiab/iiab.env not found"
echo -e "\nIIAB not installed" echo -e "\nIIAB not installed."
echo -e "\nPlease run iiab-install" echo -e "\nPlease run: ./iiab-install"
exit 1 exit 1
fi fi
# workaround for image go away later
if grep -q sugar $APPS; then # Workaround for (web-published) images; will go away later
if ! grep -q mongodb $APPS; then if grep -q sugar $IIAB_STATE_FILE; then
echo "mongodb_installed: True" >> $APPS if ! grep -q mongodb $IIAB_STATE_FILE; then
echo "mongodb_installed: True" >> $IIAB_STATE_FILE
fi fi
fi fi

View file

@ -3,9 +3,9 @@
# Add cmdline options for passing to ansible # Add cmdline options for passing to ansible
# Todo add proper shift to gobble up --debug --reinstall # Todo add proper shift to gobble up --debug --reinstall
PLAYBOOK="iiab-stages.yml" PLAYBOOK=iiab-stages.yml
INVENTORY="ansible_hosts" INVENTORY=ansible_hosts
APPS=/etc/iiab/iiab_state.yml IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
ARGS="" ARGS=""
CWD=`pwd` CWD=`pwd`
OS=`grep ^ID= /etc/*release|cut -d= -f2` OS=`grep ^ID= /etc/*release|cut -d= -f2`
@ -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 "(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 "(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 exit 1
fi fi
@ -54,10 +54,11 @@ fi
if [ "$1" != "--debug" ] && [ "$1" != "--reinstall" ] && [ "$1" != "" ]; then if [ "$1" != "--debug" ] && [ "$1" != "--reinstall" ] && [ "$1" != "" ]; then
echo "Use './iiab-install' for regular installs, or to continue an install." 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 --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." echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9, followed by the Network Role."
echo "Use './runrole' to run a single Stage or Role." echo "Use './iiab-configure' to run Stage 0, followed by Stages 4-9."
echo "Use './iiab-network' to run Network sections." 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 exit 1
fi fi
@ -119,12 +120,8 @@ if [ -f /etc/iiab/iiab.env ]; then
exit 1 exit 1
fi fi
fi fi
# if XSCE is present resolveconf will not be
if grep -q XSCE /etc/iiab/iiab.env ; then if [ "$1" == "--reinstall" ]; then
STAGE=0
rm /etc/iiab/iiab.env
echo "Removed /etc/iiab/iiab.env effectively resetting STAGE (counter)."
elif [ "$1" == "--reinstall" ]; then
STAGE=0 STAGE=0
ARGS="$ARGS"" --extra-vars reinstall=True" 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
@ -135,40 +132,42 @@ if [ -f /etc/iiab/iiab.env ]; then
echo "Wrote STAGE=2 (counter) to /etc/iiab/iiab.env" echo "Wrote STAGE=2 (counter) to /etc/iiab/iiab.env"
elif [ "$STAGE" -eq 9 ]; then elif [ "$STAGE" -eq 9 ]; then
echo -e "\nEXITING: STAGE (counter) in /etc/iiab/iiab.env shows Stage 9 Is Already Done." 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 --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." echo -e "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9, followed by the Network Role."
echo -e "Use './runrole' to run a single Stage or Role." echo -e "Use './iiab-configure' to run Stage 0, followed by Stages 4-9."
echo -e "Use './iiab-network' to run Network sections.\n\n" echo -e "Use './runrole' to run Stage 0, followed by a single Stage or Role."
echo -e "Use './iiab-configure' to turn installed service on|off via local_vars.yml.\n\n" echo -e "Use './iiab-network' to run Stage 0, followed by the Network Role.\n\n"
exit 0 # allows rerunning http://download.iiab.io/6.7/install.txt
exit 0 # Allows rerunning http://download.iiab.io/install.txt
fi fi
fi fi
if [ "$STAGE" -lt 2 ] && [ "$1" == "--debug" ]; then if [ "$STAGE" -lt 2 ] && [ "$1" == "--debug" ]; then
echo -e "\n'--debug' *ignored* as STAGE (counter) < 2." echo -e "\n'--debug' *ignored* as STAGE (counter) < 2."
fi 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 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 fi
if [ -f $APPS ]; then # Assumes /etc/iiab/iiab_state.yml is not created until (prior run of) Stage 4.
if grep -q sugar $APPS; then if [ -f $IIAB_STATE_FILE ]; then
if ! grep -q mongodb $APPS; then if grep -q sugar $IIAB_STATE_FILE; && ! grep -q mongodb $IIAB_STATE_FILE; then
echo "mongodb_installed: True" >> $APPS echo "mongodb_installed: True" >> $IIAB_STATE_FILE
fi fi
if [ "$STAGE" -eq 2 ]; then 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 systemctl start iiab-setup-db
fi 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 fi
echo -e "\nTRY TO RERUN './iiab-install' IF IT FAILS DUE TO CONNECTIVITY ISSUES ETC!\n" 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" export ANSIBLE_LOG_PATH="$CWD""/iiab-install.log"

View file

@ -2,7 +2,7 @@
- name: ...IS BEGINNING ================================== - name: ...IS BEGINNING ==================================
file: file:
path: "{{ iiab_installed }}" path: "{{ iiab_state_file }}"
state: touch state: touch
- name: NGINX - name: NGINX
@ -34,7 +34,7 @@
- name: Install Bluetooth - only on Raspberry Pi - name: Install Bluetooth - only on Raspberry Pi
include_role: include_role:
name: bluetooth 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 tags: bluetooth
- name: USB-LIB - name: USB-LIB

View file

@ -94,9 +94,9 @@
shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update
when: awstats_enabled and is_debuntu when: awstats_enabled and is_debuntu
- name: Add 'awstats_installed' variable values to {{ iiab_installed }} - name: Add 'awstats_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^awstats_installed' regexp: '^awstats_installed'
line: 'awstats_installed: True' line: 'awstats_installed: True'
state: present state: present

View file

@ -64,9 +64,9 @@
args: args:
chdir: "{{ azuracast_host_dir }}" chdir: "{{ azuracast_host_dir }}"
- name: Add 'azuracast_installed' variable values to {{ iiab_installed }} - name: Add 'azuracast_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^azuracast_installed' regexp: '^azuracast_installed'
line: 'azuracast_installed: True' line: 'azuracast_installed: True'
state: present state: present

View file

@ -55,9 +55,9 @@
regexp: '^#DiscoverableTimeout' regexp: '^#DiscoverableTimeout'
line: 'DiscoverableTimeout = 0' line: 'DiscoverableTimeout = 0'
- name: Add 'pan_bluetooth_installed' variable values to {{ iiab_installed }} - name: Add 'bluetooth_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^pan_bluetooth_installed' regexp: '^bluetooth_installed'
line: 'pan_bluetooth_installed: True' line: 'bluetooth_installed: True'
state: present state: present

View file

@ -1,6 +1,6 @@
- include_tasks: install.yml - 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 - include_tasks: enable.yml
when: bluetooth_install or pan_bluetooth_installed is defined when: bluetooth_install or bluetooth_installed is defined

View file

@ -102,9 +102,9 @@
when: not metadatadb.stat.exists when: not metadatadb.stat.exists
#when: calibreweb_provision | bool #when: calibreweb_provision | bool
- name: Add 'calibreweb_installed' variable values to {{ iiab_installed }} - name: Add 'calibreweb_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^calibreweb_installed' regexp: '^calibreweb_installed'
line: 'calibreweb_installed: True' line: 'calibreweb_installed: True'
state: present state: present

View file

@ -79,9 +79,9 @@
include_tasks: create-db.yml include_tasks: create-db.yml
when: not calibre_db.stat.exists 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: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^calibreweb_installed' regexp: '^calibreweb_installed'
line: 'calibre_installed: True' line: 'calibre_installed: True'
state: present state: present

View file

@ -119,9 +119,9 @@
state: absent state: absent
when: not captive_portal_enabled 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: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^captiveportal_installed' regexp: '^captiveportal_installed'
line: 'captiveportal_installed: True' line: 'captiveportal_installed: True'
state: present state: present

View file

@ -7,9 +7,9 @@
tags: tags:
- download - download
- name: Add 'cups_installed' variable values to {{ iiab_installed }} - name: Add 'cups_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^cups_installed' regexp: '^cups_installed'
line: 'cups_installed: True' line: 'cups_installed: True'
state: present state: present

View file

@ -48,9 +48,9 @@
state: directory state: directory
recurse: yes recurse: yes
- name: Add 'dokuwiki_installed' variable values to {{ iiab_installed }} - name: Add 'dokuwiki_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^dokuwiki_installed' regexp: '^dokuwiki_installed'
line: 'dokuwiki_installed: True' line: 'dokuwiki_installed: True'
state: present state: present

View file

@ -87,9 +87,9 @@
src: elgg.conf src: elgg.conf
dest: "/etc/{{ apache_config_dir }}/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: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^elgg_installed' regexp: '^elgg_installed'
line: 'elgg_installed: True' line: 'elgg_installed: True'
state: present state: present

View file

@ -3,7 +3,7 @@
when: elgg_install and not elgg_installed is defined when: elgg_install and not elgg_installed is defined
- name: Provision DB - name: Provision DB
include_tasks: prov-db.yml include_tasks: setup.yml
when: elgg_install and not installing when: elgg_install and not installing
- name: Enable Elgg - name: Enable Elgg

View file

@ -125,9 +125,9 @@
tags: tags:
- systemd - systemd
- name: Add 'gitea_installed' variable values to {{ iiab_installed }} - name: Add 'gitea_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^gitea_installed' regexp: '^gitea_installed'
line: 'gitea_installed: True' line: 'gitea_installed: True'
state: present state: present

View file

@ -45,9 +45,9 @@
- { 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/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: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^internetarchive_installed' regexp: '^internetarchive_installed'
line: 'internetarchive_installed: True' line: 'internetarchive_installed: True'
state: present state: present

View file

@ -15,9 +15,9 @@
async: 1800 async: 1800
poll: 10 poll: 10
- name: Add 'kalite_installed' variable values to {{ iiab_installed }} - name: Add 'kalite_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^kalite_installed' regexp: '^kalite_installed'
line: 'kalite_installed: True' line: 'kalite_installed: True'
state: present state: present

View file

@ -100,9 +100,9 @@
- { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'} - { 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'} - { 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: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^kiwix_installed' regexp: '^kiwix_installed'
line: 'kiwix_installed: True' line: 'kiwix_installed: True'
state: present state: present

View file

@ -112,9 +112,9 @@
# apache2_module: # apache2_module:
# name: proxy_http # name: proxy_http
- name: Add 'kolibri_installed' variable values to {{ iiab_installed }} - name: Add 'kolibri_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^kolibri_installed' regexp: '^kolibri_installed'
line: 'kolibri_installed: True' line: 'kolibri_installed: True'
state: present state: present

View file

@ -98,9 +98,9 @@
state: restarted state: restarted
when: lokole_enabled | bool when: lokole_enabled | bool
- name: Add 'lokole_installed' variable values to {{ iiab_installed }} - name: Add 'lokole_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^lokole_installed' regexp: '^lokole_installed'
line: 'lokole_installed: True' line: 'lokole_installed: True'
state: present state: present

View file

@ -65,9 +65,9 @@
src: mediawiki.conf.j2 src: mediawiki.conf.j2
dest: "/etc/{{ apache_config_dir }}/mediawiki.conf" dest: "/etc/{{ apache_config_dir }}/mediawiki.conf"
- name: Add 'mediawiki_installed' variable values to {{ iiab_installed }} - name: Add 'mediawiki_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^mediawiki_installed' regexp: '^mediawiki_installed'
line: 'mediawiki_installed: True' line: 'mediawiki_installed: True'
state: present state: present

View file

@ -71,9 +71,9 @@
path: "{{ minetest_game_dir }}/mods/name_restrictions" path: "{{ minetest_game_dir }}/mods/name_restrictions"
when: minetest_default_game == "carbone-ng" when: minetest_default_game == "carbone-ng"
- name: Add 'minetest_installed' variable values to {{ iiab_installed }} - name: Add 'minetest_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^minetest_installed' regexp: '^minetest_installed'
line: 'minetest_installed: True' line: 'minetest_installed: True'
state: present state: present

View file

@ -128,9 +128,9 @@
- { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' } - { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' }
- { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' } - { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' }
- name: Add 'mongodb_installed' variable values to {{ iiab_installed }} - name: Add 'mongodb_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^mongodb_installed' regexp: '^mongodb_installed'
line: 'mongodb_installed: True' line: 'mongodb_installed: True'
state: present state: present

View file

@ -138,9 +138,9 @@
path: "{{ moodle_base }}/config.php" path: "{{ moodle_base }}/config.php"
mode: 0644 mode: 0644
- name: Add 'moodle_installed' variable values to {{ iiab_installed }} - name: Add 'moodle_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^moodle_installed' regexp: '^moodle_installed'
line: 'moodle_installed: True' line: 'moodle_installed: True'
state: present state: present

View file

@ -30,9 +30,9 @@
group: root group: root
mode: 0755 mode: 0755
- name: Add 'mosquitto_installed' variable values to {{ iiab_installed }} - name: Add 'mosquitto_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^mosquitto_installed' regexp: '^mosquitto_installed'
line: 'mosquitto_installed: True' line: 'mosquitto_installed: True'
state: present state: present

View file

@ -40,9 +40,9 @@
create: yes create: yes
state: present state: present
- name: Add 'munin_installed' variable values to {{ iiab_installed }} - name: Add 'munin_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^munin_installed' regexp: '^munin_installed'
line: 'munin_installed: True' line: 'munin_installed: True'
state: present state: present

View file

@ -50,9 +50,9 @@
state: directory state: directory
when: ansible_distribution == "CentOS" when: ansible_distribution == "CentOS"
- name: Add 'dansguardian_installed' variable values to {{ iiab_installed }} - name: Add 'dansguardian_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^dansguardian_installed' regexp: '^dansguardian_installed'
line: 'dansguardian_installed: True' line: 'dansguardian_installed: True'
state: present state: present

View file

@ -60,9 +60,9 @@
state: file state: file
when: is_redhat | bool when: is_redhat | bool
- name: Add 'dhcpd_installed' variable values to {{ iiab_installed }} - name: Add 'dhcpd_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^dhcpd_installed' regexp: '^dhcpd_installed'
line: 'dhcpd_installed: True' line: 'dhcpd_installed: True'
state: present state: present

View file

@ -100,9 +100,9 @@
state: absent state: absent
when: not is_debuntu and not dns_jail_enabled when: not is_debuntu and not dns_jail_enabled
- name: Add 'named_installed' variable values to {{ iiab_installed }} - name: Add 'named_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^named_installed' regexp: '^named_installed'
line: 'named_installed: True' line: 'named_installed: True'
state: present state: present

View file

@ -82,9 +82,9 @@
- include_tasks: roles/network/tasks/dansguardian.yml - include_tasks: roles/network/tasks/dansguardian.yml
when: dansguardian_install | bool when: dansguardian_install | bool
- name: Add 'squid_installed' variable values to {{ iiab_installed }} - name: Add 'squid_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^squid_installed' regexp: '^squid_installed'
line: 'squid_installed: True' line: 'squid_installed: True'
state: present state: present

View file

@ -38,9 +38,9 @@
group: root group: root
state: link state: link
- name: Add 'wondershaper_installed' variable values to {{ iiab_installed }} - name: Add 'wondershaper_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^wondershaper_installed' regexp: '^wondershaper_installed'
line: 'wondershaper_installed: True' line: 'wondershaper_installed: True'
state: present state: present

View file

@ -182,9 +182,9 @@
group: root group: root
mode: 0644 mode: 0644
- name: Add 'nextcloud_installed' variable values to {{ iiab_installed }} - name: Add 'nextcloud_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^nextcloud_installed' regexp: '^nextcloud_installed'
line: 'nextcloud_installed: True' line: 'nextcloud_installed: True'
state: present state: present

View file

@ -10,7 +10,7 @@
when: nextcloud_install and (not nextcloud_installed is defined or not nextcloud_page.stat.exists) when: nextcloud_install and (not nextcloud_installed is defined or not nextcloud_page.stat.exists)
- name: Provision NextCloud's Mysql DB - name: Provision NextCloud's Mysql DB
include_tasks: prov-db.yml include_tasks: setup.yml
when: nextcloud_install and not installing when: nextcloud_install and not installing
- name: Enables or disable Nextcloud! - name: Enables or disable Nextcloud!

View file

@ -97,9 +97,9 @@
state: present state: present
name: proxy_wstunnel name: proxy_wstunnel
- name: Add 'nodered_installed' variable values to {{ iiab_installed }} - name: Add 'nodered_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^nodered_installed' regexp: '^nodered_installed'
line: 'nodered_installed: True' line: 'nodered_installed: True'
state: present state: present

View file

@ -30,9 +30,9 @@
src: smb.conf.j2 src: smb.conf.j2
dest: /etc/samba/smb.conf dest: /etc/samba/smb.conf
- name: Add 'samba_installed' variable values to {{ iiab_installed }} - name: Add 'samba_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^samba_installed' regexp: '^samba_installed'
line: 'samba_installed: True' line: 'samba_installed: True'
state: present state: present

View file

@ -221,9 +221,9 @@
# # Use this instead, if tabs are truly nec: # # Use this instead, if tabs are truly nec:
# # block: "\tvar pathPrefix = '/sugarizer';\n\tapp.use(pathPrefix, require('path-prefix-proxy')(pathPrefix));" # # block: "\tvar pathPrefix = '/sugarizer';\n\tapp.use(pathPrefix, require('path-prefix-proxy')(pathPrefix));"
- name: Add 'sugarizer_installed' variable values to {{ iiab_installed }} - name: Add 'sugarizer_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^sugarizer_installed' regexp: '^sugarizer_installed'
line: 'sugarizer_installed: True' line: 'sugarizer_installed: True'
state: present state: present

View file

@ -101,9 +101,9 @@
dest: "/etc/{{ apache_config_dir }}/wordpress.conf" dest: "/etc/{{ apache_config_dir }}/wordpress.conf"
when: apache_enabled when: apache_enabled
- name: Add 'wordpress_installed' variable values to {{ iiab_installed }} - name: Add 'wordpress_installed' variable values to {{ iiab_state_file }}
lineinfile: lineinfile:
dest: "{{ iiab_installed }}" dest: "{{ iiab_state_file }}"
regexp: '^wordpress_installed' regexp: '^wordpress_installed'
line: 'wordpress_installed: True' line: 'wordpress_installed: True'
state: present state: present

View file

@ -1,7 +1,7 @@
# SEE "emergency" REINSTALL INSTRUCTIONS IN roles/wordpress/tasks/install.yml # SEE "emergency" REINSTALL INSTRUCTIONS IN roles/wordpress/tasks/install.yml
- name: Provision MySql DB for WordPress - name: Provision MySql DB for WordPress
include_tasks: prov-db.yml include_tasks: setup.yml
when: wordpress_install | bool and not installing | bool when: wordpress_install | bool and not installing | bool
- name: Install WordPress if wordpress_installed is absent - name: Install WordPress if wordpress_installed is absent

35
runrole
View file

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
INVENTORY="ansible_hosts" INVENTORY=ansible_hosts
PLAYBOOK="run-one-role.yml" PLAYBOOK=run-one-role.yml
ARGS="" ARGS=""
REINSTALL=0 REINSTALL=0
CWD=`pwd` CWD=`pwd`
APPS=/etc/iiab/iiab_state.yml IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
VARS=/etc/iiab/local_vars.yml LOCAL_VARS_FILE=/etc/iiab/local_vars.yml
if [ ! -f $PLAYBOOK ]; then if [ ! -f $PLAYBOOK ]; then
echo "Exiting: IIAB Playbook not found." echo "Exiting: IIAB Playbook not found."
@ -15,25 +15,30 @@ if [ ! -f $PLAYBOOK ]; then
fi fi
if [[ $# -eq 0 ]] ; then if [[ $# -eq 0 ]] ; then
echo " usage: ./runrole <name of role>" echo "Usage: ./runrole <name of role>"
echo " usage: ./runrole --reinstall <name of role>" echo "Usage: ./runrole --reinstall <name of role>"
echo " Last variable would be full path to log file." echo
echo " If ommited current directory is used." echo "Optional 2nd parameter is full PATH/FILENAME for logging."
echo "If omitted, <current directory>/iiab-debug.log is used."
exit 0 exit 0
fi fi
if ! grep -q "^""$1""_install: True" $LOCAL_VARS_FILE; then
echo "ERROR: $LOCAL_VARS_FILE must contain '""$1""_install: True'"
exit 1
fi
clear_marker(){ clear_marker(){
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' $APPS sed -i -e '/^calibreweb/d' $IIAB_STATE_FILE
elif [ $1 == "captive-portal" ]; then # role directory & installed marker differ elif [ $1 == "captive-portal" ]; then # role directory & installed marker differ
sed -i -e '/^captiveportal/d' $APPS sed -i -e '/^captiveportal/d' $IIAB_STATE_FILE
#elif [ $1 == "bluetooth" ]; then # role directory & installed marker differ
elif [ $1 == "bluetooth" ]; then # role directory & installed marker differ # sed -i -e '/^pan_bluetooth/d' $IIAB_STATE_FILE
sed -i -e '/^pan_bluetooth/d' $APPS else
sed -i -e "/^$1/d" $IIAB_STATE_FILE
fi fi
sed -i -e "/^$1/d" $APPS
fi fi
} }