pip install {pymysql, psycopg, passlib} to Ansible venv, on demand — to fix 6 IIAB Apps with new `interpreter_python=/usr/local/ansible/bin/python3` in ansible.cfg
usb_lib: building on to top of @jvonau's work in #3940. Using existence of /media to determine if a USB stick is mounted or not for both count and upload location; changing tabs to spaces for upload2usb.php
Improved upgrading of Calibre-Web via BOTH approaches: (1) `iiab-update -f` fast way, via bash (2) `iiab-update` slow/forcible/thorough way, via Ansible
Set `asterisk_rpi_patch: False` & mandate MySQL / MariaDB [as we wait for FreePBX 17 pre-releases to support Asterisk 21, which was released 2023-10-18]
remote.it workaround for incoming ICMP firewalls e.g. GitHub Actions [at least allowing IIAB installs to proceed, when service schannel does not exist]
Fix PR #3491 to install ansible-core on all OS's as Python 3.11+ proliferates — accounting for older versions of pip that lack flag `--break-system-packages`
Update jupyterhub_config.py.j2 for JupyterHub 3.1.1 & /run/jupyterhub-proxy.pid [+ refine doc. Is error "IOPub data rate exceeded" common &/or solvable?]
lineinfile was really struggling to handle a k/v value with "=" in it. ini_file is built for precisely this file format and handles the issue effortlessly.
With NetworkManager active, systemd-networkd/networkd-dispatcher are used for
br0/ap0 support but the hooks were not being installed on the first pass through
network as systemd_networkd_active was not detected when ansibled stated.
Update AzuraCast stale inline docs. Prepare to revise "azuracast_port_range_prefix: 10" (i.e. ports 10xxx for now, including blocked port 10080) as AzuraCast recommendations evolve.
Try 'skip_role_on_error: True' in default_vars.yml for more uninterrupted installs of IIAB Apps ['./iiab-install --risky' if you want to live on the wild side, forcing it too to use 'skip_role_on_error: True']
osm-vector-maps: Lint + clarify for readability e.g. map_installer_url -- and speed up initial install of 48MB planet_z0-z6_2020.mbtiles + 25MB satellite_z0-z6_2020.mbtiles
Allow manual removal of /library/calibre-web/config/app.db for easier resetting of Calibre-Web app settings (without damaging your e-book collection metadata in /library/calibre-web/metadata.db !)
[Internet-in-a-Box (IIAB)](https://internet-in-a-box.org) is a "learning hotspot" that brings the Internet's crown jewels
[Internet-in-a-Box (IIAB)](https://internet-in-a-box.org) is a “learning hotspot” that brings the Internet's crown jewels
(Wikipedia in any language, thousands of Khan Academy videos, zoomable OpenStreetMap, electronic books, WordPress journaling, Toys from Trash electronics projects, ETC) to those without Internet.
(Wikipedia in any language, thousands of Khan Academy videos, zoomable OpenStreetMap, electronic books, WordPress journaling, “Toys from Trash” electronics projects, ETC) to those without Internet.
You can build your own tiny, affordable server (an offline digital library) for your school, your medical clinic, your prison, your region and/or your very own family — accessible with any nearby smartphone, tablet or laptop.
You can build your own tiny, affordable server (an offline digital library) for your school, your medical clinic, your prison, your region and/or your very own family — accessible with any nearby smartphone, tablet or laptop.
Internet-in-a-Box gives you the DIY tools to:
Internet-in-a-Box gives you the DIY tools to:
1. Download then drag-and-drop to arrange the [very best of the World’s Free Knowledge](https://internet-in-a-box.org/#quality-content).
1. Download then drag-and-drop to arrange the [very best of the World’s Free Knowledge](https://internet-in-a-box.org/#quality-content).
2. Choose among [30+ powerful educational apps](http://FAQ.IIAB.IO#What_services_.28IIAB_apps.29_are_suggested_during_installation.3F) for your school or learning/teaching community, optionally with a complete LMS (learning management system).
2. Choose among [30+ powerful educational apps](https://wiki.iiab.io/go/FAQ#What_services_%28IIAB_apps%29_are_suggested_during_installation%3F) for your school or learning/teaching community, optionally with a complete LMS (learning management system).
3. Exchange local/indigenous knowledge with nearby communities, using our [Manage Content](https://github.com/iiab/iiab-admin-console/blob/master/roles/console/files/help/InstContent.rst#manage-content) interface and possible mesh networking.
3. Exchange local/indigenous knowledge with nearby communities, using our [Manage Content](https://github.com/iiab/iiab-admin-console/blob/master/roles/console/files/help/InstContent.rst#manage-content) interface and possible mesh networking.
FYI this [community product](https://en.wikipedia.org/wiki/Internet-in-a-Box) is enabled by professional volunteers working [side-by-side](http://FAQ.IIAB.IO#What_are_the_best_places_for_community_support.3F) with schools, clinics and libraries around the world. *Thank you for being a part of our http://OFF.NETWORK grassroots technology [movement](https://meta.wikimedia.org/wiki/Internet-in-a-Box)!*
FYI this [community product](https://en.wikipedia.org/wiki/Internet-in-a-Box) is enabled by professional volunteers working [side-by-side](https://wiki.iiab.io/go/FAQ#What_are_the_best_places_for_community_support%3F) with schools, clinics and libraries around the world. *Thank you for being a part of our http://OFF.NETWORK grassroots technology [movement](https://meta.wikimedia.org/wiki/Internet-in-a-Box)!*
## Installation
## Installation
Install Internet-in-a-Box (IIAB) from [download.iiab.io](https://download.iiab.io/)
Please see [FAQ.IIAB.IO](http://FAQ.IIAB.IO) which has 40+ questions and answers to help you along the way, as you put together the <!--digital--> "local learning hotspot" most suitable for your own teaching/learning community. Here are 2 ways to install IIAB:
Please see [FAQ.IIAB.IO](https://wiki.iiab.io/go/FAQ) which has 50+ questions and answers to help you along the way (e.g. [“Is a quick installation possible?”](https://wiki.iiab.io/go/FAQ#Is_a_quick_installation_possible%3F)) as you put together the <!--digital--> “local learning hotspot” most suitable for your own teaching/learning community. Here are 2 ways to install IIAB:
- Our [1-line installer](https://download.iiab.io/) gets you the very latest, typically within about an hour, on [different Linux distributions](https://github.com/iiab/iiab/wiki/IIAB-Platforms#operating-systems).
- Our [1-line installer](https://download.iiab.io/) gets you the very latest, typically within about an hour, on [different Linux distributions](https://github.com/iiab/iiab/wiki/IIAB-Platforms#operating-systems).
- [Prefab disk images](https://github.com/iiab/iiab/wiki/Raspberry-Pi-Images:-Summary) ([.img files](https://archive.org/search.php?query=iiab%20.img&sort=-publicdate)) are sometimes a few months out of date, but can be flashed directly onto a microSD card, for insertion into Raspberry Pi.
- [Prefab disk images](https://github.com/iiab/iiab/wiki/Raspberry-Pi-Images-~-Summary#iiab-images-for-raspberry-pi) ([.img files](https://archive.org/search.php?query=iiab%20.img&sort=-publicdate)) are sometimes a few months out of date, but can be flashed directly onto a microSD card, for insertion into Raspberry Pi.
Our [HOW-TO videos](https://www.youtube.com/channel/UC0cBGCxr_WPBPa3IqPVEe3g) can be very helpful and the [Installation](https://github.com/iiab/iiab/wiki/IIAB-Installation) wiki page has more intricate details e.g. if you're trying to install Internet-in-a-Box (IIAB) onto a [another Linux](https://github.com/iiab/iiab/wiki/IIAB-Platforms) that has not yet been tried.
Our [HOW-TO videos](https://www.youtube.com/channel/UC0cBGCxr_WPBPa3IqPVEe3g) can be very helpful and the [Installation](https://github.com/iiab/iiab/wiki/IIAB-Installation) wiki page has more intricate details e.g. if you're trying to install Internet-in-a-Box (IIAB) onto a [another Linux](https://github.com/iiab/iiab/wiki/IIAB-Platforms) that has not yet been tried.
@ -29,20 +29,22 @@ See our [Tech Docs Wiki](https://github.com/iiab/iiab/wiki) for more about the u
After you've installed the software, you should [add content](https://github.com/iiab/iiab/wiki/IIAB-Installation#add-content), which can of course take time when downloading multi-gigabyte Content Packs!
After you've installed the software, you should [add content](https://github.com/iiab/iiab/wiki/IIAB-Installation#add-content), which can of course take time when downloading multi-gigabyte Content Packs!
Finally, you can [customize your Internet-in-a-Box home page](http://FAQ.IIAB.IO#How_do_I_customize_my_Internet-in-a-Box_home_page.3F) (typically http://box or http://box.lan) using our **drag-and-drop** Admin Console (http://box.lan/admin) — to arrange Content Packs and IIAB Apps (services) for your local community's needs.
Finally, you can [customize your Internet-in-a-Box home page](https://wiki.iiab.io/go/FAQ#How_do_I_customize_my_Internet-in-a-Box_home_page%3F) (typically http://box or http://box.lan) using our **drag-and-drop** Admin Console (http://box.lan/admin) — to arrange Content Packs and IIAB Apps (services) for your local community's needs.
## Community
## Community
Internet-in-a-Box (IIAB) greatly welcomes contributions from educators, librarians and [IT/UX/QA people](https://github.com/iiab/iiab/wiki/Technical-Contributors-Guide) of all kinds!
Global community updates and videos are regularly posted to: **[@internet_in_box](https://twitter.com/internet_in_box)**
If you would like to volunteer, please [make contact](https://internet-in-a-box.org/pages/contributing.html) after looking over "[How can I help?](http://FAQ.IIAB.IO#How_can_I_help.3F)" at: [FAQ.IIAB.IO](http://FAQ.IIAB.IO)
_Internet-in-a-Box (IIAB) greatly welcomes contributions from educators, librarians and [IT/UX/QA people](https://github.com/iiab/iiab/wiki/Contributors-Guide-(EN)) ([versión en español](https://github.com/iiab/iiab/wiki/Gu%C3%ADa-para-Contribuidores-(ES))) of all kinds!_
If you would like to volunteer, please [make contact](https://internet-in-a-box.org/contributing.html) after looking over [“How can I help?”](https://wiki.iiab.io/go/FAQ#How_can_I_help%3F) at: [FAQ.IIAB.IO](https://wiki.iiab.io/go/FAQ)
<!-- To learn about our software architecture, check out our [Contributors Guide](https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide).-->
<!-- To learn about our software architecture, check out our [Contributors Guide](https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide).-->
To learn more about our open community architecture for "offline" learning, check out "[What technical documentation exists?](http://FAQ.IIAB.IO#What_technical_documentation_exists.3F)"
To learn more about our open community architecture for “offline” learning, check out [“What technical documentation exists?”](https://wiki.iiab.io/go/FAQ#What_technical_documentation_exists%3F)
FYI we use [Ansible](http://FAQ.IIAB.IO#What_is_Ansible_and_what_version_should_I_use.3F) <!--as the underlying technology--> to install, deploy, configure and manage the various software components.
FYI we use [Ansible](https://wiki.iiab.io/go/FAQ#What_is_Ansible_and_what_version_should_I_use%3F) <!--as the underlying technology--> to install, deploy, configure and manage the various software components.
*Thank you for helping us enable offline access to the Internet's free/open knowledge jewels, as well as "Sneakernet-of-Alexandria" distribution of local/indigenous content, when mass media channels do not serve grassroots voices.*
*Thank you for helping us enable offline access to the Internet's free/open knowledge jewels, as well as “Sneakernet-of-Alexandria” distribution of local/indigenous content, when mass media channels do not serve grassroots voices.*
## Versions
## Versions
@ -52,4 +54,4 @@ Install our latest pre-release using the 1-line installer at: [**download.iiab.i
You can also consider <!--latest Internet-in-a-Box (IIAB)--> earlier official releases at: [github.com/iiab/iiab/releases](https://github.com/iiab/iiab/releases)
You can also consider <!--latest Internet-in-a-Box (IIAB)--> earlier official releases at: [github.com/iiab/iiab/releases](https://github.com/iiab/iiab/releases)
For much older versions, see: [github.com/xsce](http://github.com/xsce), [schoolserver.org](http://schoolserver.org)
For much older versions, see: [github.com/xsce](https://github.com/xsce), [schoolserver.org](http://schoolserver.org)
# Disallowed by Ansible 2.11+ -- see https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#using-a-loop-on-a-package-module-via-squash-actions
# Disallowed by Ansible 2.11+ -- see https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#using-a-loop-on-a-package-module-via-squash-actions
# Todo add proper shift to gobble up --debug --reinstall
PLAYBOOK=iiab-stages.yml
PLAYBOOK=iiab-stages.yml
INVENTORY=ansible_hosts
INVENTORY=ansible_hosts
IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
IIAB_STATE_FILE=/etc/iiab/iiab_state.yml
ARGS=""
ARGS="--extra-vars {" # Needs boolean not string so use JSON list. bash forces {...} to '{...}' for Ansible
CWD=`pwd`
CWD=`pwd`
OS=`grep ^ID= /etc/os-release | cut -d= -f2`
OS=`grep ^ID= /etc/os-release | cut -d= -f2`
OS=${OS//\"/}
OS=${OS//\"/} # Remove all '"'
MIN_RPI_KERN=5.4.0 # Do not use 'rpi-update' unless absolutely necessary: https://github.com/iiab/iiab/issues/1993
MIN_RPI_KERN=5.4.0 # Do not use 'rpi-update' unless absolutely necessary: https://github.com/iiab/iiab/issues/1993
MIN_ANSIBLE_VER=2.11.6 # Ansible 2.8.3 and 2.8.6 had serious bugs, preventing their use with IIAB.
MIN_ANSIBLE_VER=2.16.14 # 2024-11-08: ansible-core 2.15 EOL is November 2024 per https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix 2022-11-09: Raspberry Pi 3 (and 3 B+ etc?) apparently install (and require?) ansible-core 2.11 for now -- @deldesir can explain more on PR #3419. Historical: Ansible 2.8.3 and 2.8.6 had serious bugs, preventing their use with IIAB.
REINSTALL=false
DEBUG=false
SKIP_ROLE_ON_ERROR=false
usage() {
echo -e "\n\e[1mUse './iiab-install' for regular installs, or to continue an install."
echo -e "Use './iiab-install --risky' to force 'skip_role_on_error: True'"
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.\e[0m\n"
echo -e "(e.g. for PR #3318 netwarn pop-ups, asking you to run iiab-network)\n"
if [ ! -f $PLAYBOOK ]; then
if [ ! -f $PLAYBOOK ]; then
echo "EXITING: IIAB Playbook ""$PLAYBOOK"" not found."
echo "EXITING: IIAB Playbook ""$PLAYBOOK"" not found."
@ -57,16 +98,6 @@ if [ ! -f $PLAYBOOK ]; then
exit 1
exit 1
fi
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, 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
# Subroutine compares software version numbers. Generates rare false positives
# Subroutine compares software version numbers. Generates rare false positives
# like "1.0 > 1" and "2.4.0 > 2.4". Avoid risks by structuring conditionals w/
# like "1.0 > 1" and "2.4.0 > 2.4". Avoid risks by structuring conditionals w/
# a consistent # of decimal points e.g. "if version_gt w.x.y.z a.b.c.d; then"
# a consistent # of decimal points e.g. "if version_gt w.x.y.z a.b.c.d; then"
@ -93,7 +124,7 @@ CURR_ANSIBLE_VER=0
#if [[ $(command -v ansible) ]]; then # Also Works! $(...) nests more easily than backticks
#if [[ $(command -v ansible) ]]; then # Also Works! $(...) nests more easily than backticks
#if [[ `which ansible` ]]; then # "which" misses built-in commands like cd, and is RISKY per https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
#if [[ `which ansible` ]]; then # "which" misses built-in commands like cd, and is RISKY per https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
#if [[ `type -P ansible` ]]; then # "type -P" isn't POSIX compliant; it misses built-in commands like "cd"
#if [[ `type -P ansible` ]]; then # "type -P" isn't POSIX compliant; it misses built-in commands like "cd"
if [[ `command -v ansible` ]]; then # "command -v" is POSIX compliant; it catches built-in commands like "cd"
if [[ $(command -v ansible) ]]; then # "command -v" is POSIX compliant; it catches built-in commands like "cd"
CURR_ANSIBLE_VER=$(ansible --version | head -1 | cut -f 2- -d " " | sed 's/.* \([^ ]*\)\].*/\1/')
CURR_ANSIBLE_VER=$(ansible --version | head -1 | cut -f 2- -d " " | sed 's/.* \([^ ]*\)\].*/\1/')
# Above works with 'ansible [core 2.11.0rc2]' -- these old ways do not:
# Above works with 'ansible [core 2.11.0rc2]' -- these old ways do not:
#CURR_ANSIBLE_VER=$(ansible --version | head -1 | awk '{print $2}')
#CURR_ANSIBLE_VER=$(ansible --version | head -1 | awk '{print $2}')
@ -125,41 +156,38 @@ if [ -f /etc/iiab/iiab.env ]; then
fi
fi
fi
fi
if [ "$1" == "--reinstall" ]; then
if $($REINSTALL); then
STAGE=0
STAGE=0
ARGS="$ARGS"" --extra-vars reinstall=True"
#ARGS="$ARGS"" --extra-vars reinstall=True"
ARGS="$ARGS,\"reinstall\":True" # Needs boolean not string so use JSON list
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"
if [ "$STAGE" -lt 2 ] && [ "$1" == "--debug" ]; then
if [ "$STAGE" -lt 2 ] && $($DEBUG); then
echo -e "\n'--debug' *ignored* as STAGE (counter) < 2."
echo -e "\n'--debug' *ignored* as STAGE (counter) < 2."
fi
fi
# /etc/iiab/iiab_state.yml is mandatory and must be created here. Background:
# /etc/iiab/iiab_state.yml is mandatory and must be created here. Background:
# Allow iiab-install to read IIAB_STATE_FILE to not repeat installs of previous
# Allow iiab-install to read IIAB_STATE_FILE to not repeat installs of previous
# roles that already completed within the stage.
# roles that already completed within the stage.
if [ ! -f $IIAB_STATE_FILE ]; then
if [ ! -f $IIAB_STATE_FILE ]; then # touch $IIAB_STATE_FILE
#touch $IIAB_STATE_FILE
echo -e "\nCreating... $IIAB_STATE_FILE"
cat > $IIAB_STATE_FILE << EOF
cat > $IIAB_STATE_FILE << EOF
# DO *NOT* MANUALLY EDIT THIS, THANKS!
# DO *NOT* MANUALLY EDIT THIS, THANKS!
# IIAB does NOT currently support uninstalling apps/services.
# IIAB does NOT currently support uninstalling apps/services.
EOF
EOF
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 "\e[1mRunning local Ansible playbooks...\n...Stage 0 will now run\n...followed by Stages $(($STAGE + 1))-9\n...and then the Network Role.\e[0m\n"
echo -e "\e[1mRunning local Ansible playbooks...\n...Stage 0 will now run\n...followed by Stages $(($STAGE + 1))-9\n...and then the Network Role.\e[0m\n"
value:'"OpenVPN enables live/remote support by connecting machines anywhere on the Internet, via a middleman server, using Virtual Private Network (VPN) techniques to create secure connections."'
value:'"OpenVPN enables live/remote support by connecting machines anywhere on the Internet, via a middleman server, using Virtual Private Network (VPN) techniques to create secure connections."'
ps -e | grep openvpn # 2018-09-05: "ps -e | grep vpn" no longer works (nor would "pgrep vpn") when invoked from iiab-vpn-off (as filename itself causes [multiple] "vpn" instances to appear in process list!)
if [ $? -eq 0 ]; then
echo "OpenVPN failed to stop."
else
echo "OpenVPN's systemd service was successfully stopped and disabled."
echo
echo "Also, 'openvpn_enabled: False' was set in /etc/iiab/local_vars.yml"
# workaround for fact that auto create does not work on iiab_ini_file (/etc/iiab/iiab.ini)
- name:Record disk_used_a_priori (permanently, into {{ iiab_ini_file }} below) to later estimate iiab_software_disk_usage
shell:df -B1 --output=used / | tail -1
register:df1
# workaround for fact that auto create does not work on iiab_ini_file
- name:Create {{ iiab_ini_file }}
- name:Create {{ iiab_ini_file }}
file:
file:
path:"{{ iiab_ini_file }}"
path:"{{ iiab_ini_file }}"# /etc/iiab/iiab.ini
state:touch
state:touch
- name:Add 'location' variable values to {{ iiab_ini_file }}
- name:Run command 'dpkg --print-architecture' to identify OS architecture (CPU arch as revealed by ansible_architecture ~= ansible_machine is NOT enough!)
command:dpkg --print-architecture
register:dpkg_arch
- name:Run command 'dpkg --print-foreign-architectures' (secondary OS arch, if available)
command:dpkg --print-foreign-architectures
register:dpkg_foreign_arch
- name:Add 'summary' variable values to {{ iiab_ini_file }}
ini_file:
ini_file:
path:"{{ iiab_ini_file }}"
path:"{{ iiab_ini_file }}"
section:location
section:summary
option:"{{ item.option }}"
option:"{{ item.option }}"
value:"{{ item.value | string }}"
value:"{{ item.value | string }}"
with_items:
with_items:
@ -15,29 +28,39 @@
value:"{{ iiab_base }}"
value:"{{ iiab_base }}"
- option:iiab_dir
- option:iiab_dir
value:"{{ iiab_dir }}"
value:"{{ iiab_dir }}"
- option:disk_used_a_priori
value:"{{ df1.stdout }}"
- name:Add 'version' variable values to {{ iiab_ini_file }}
- name:Add 'initial' variable values to {{ iiab_ini_file }}
- name:"Ansible just ran /etc/ansible/facts.d/local_facts.fact to set 11 vars -- here we extract 3 of those -- rpi_model: {{ ansible_local.local_facts.rpi_model }}, devicetree_model: {{ ansible_local.local_facts.devicetree_model }}, iiab_stage: {{ ansible_local.local_facts.stage }}"
- name:"Ansible just ran /etc/ansible/facts.d/local_facts.fact to set 15 vars -- here we extract 6 of those -- iiab_stage: {{ ansible_local.local_facts.stage }}, rpi_model: {{ ansible_local.local_facts.rpi_model }}, devicetree_model: {{ ansible_local.local_facts.devicetree_model }}, os_ver: {{ ansible_local.local_facts.os_ver }}, python_version: {{ ansible_local.local_facts.python_version }}, php_version: {{ ansible_local.local_facts.php_version }}"
- name:Create globally-writable directory /etc/iiab/diag (0777) so non-root users can run 'iiab-diagnostics'
- name:Create globally-writable directory /etc/iiab/diag (0777) so non-root users can run 'iiab-diagnostics'
file:
file:
@ -53,13 +61,14 @@
- name:Pre-check that IIAB's "XYZ_install" + "XYZ_enabled" vars (1) are defined, (2) are boolean-not-string variables, and (3) contain plausible values. Also checks that "XYZ_install" is True when "XYZ_installed" is defined.
- name:Pre-check that IIAB's "XYZ_install" + "XYZ_enabled" vars (1) are defined, (2) are boolean-not-string variables, and (3) contain plausible values. Also checks that "XYZ_install" is True when "XYZ_installed" is defined.
include_tasks:validate_vars.yml
include_tasks:validate_vars.yml
when:not (rpi_model | regex_search('\\bW\\b')) # Ansible require double backslashes, e.g. with \b "word boundary" anchors: https://www.regular-expressions.info/wordboundaries.html https://stackoverflow.com/questions/56869119/ansible-regular-expression-to-match-a-string-and-extract-the-line/56869801#56869801
- name:"Time Zone / TZ: Set symlink /etc/localtime to UTC if it doesn't exist?"
# 2022-12-30: Functionality moved to www_options/tasks/php-settings.yml
include_tasks:tz.yml
# - name: "Time Zone / TZ: Set symlink /etc/localtime to UTC if it doesn't exist?"
# include_tasks: tz.yml
- name:Test Gateway + Test Internet + Set new hostname/domain (hostname.yml) if nec + Set 'gui_port' to 80 or 443 for Admin Console
include_tasks:network.yml
- name:Set hostname / domain (etc) in various places
include_tasks:hostname.yml
- name:Add 'runtime' variable values to {{ iiab_ini_file }}
- name:Add 'runtime' variable values to {{ iiab_ini_file }}
- option:local_tz # e.g. 'EDT' (summer) or 'EST' (winter) after Ansible interprets symlink /etc/localtime -- or 'UTC' if /etc/localtime doesn't exist
# - option: local_tz # e.g. 'EDT' (summer) or 'EST' (winter) after Ansible interprets symlink /etc/localtime -- or 'UTC' if /etc/localtime doesn't exist
value:"{{ local_tz }}"
# value: "{{ local_tz }}"
- option:etc_localtime.stdout # e.g. 'America/New_York' direct from symlink /etc/localtime -- or '' if /etc/localtime doesn't exist
# - option: etc_localtime.stdout # e.g. 'America/New_York' direct from symlink /etc/localtime -- or '' if /etc/localtime doesn't exist
- name:Do we have a gateway? If 'ip route' specifies a default route, Ansible parses details here...
debug:
var:ansible_default_ipv4
- name:"If above ansible_default_ipv4.gateway is defined, set WAN candidate 'discovered_wan_iface: {{ ansible_default_ipv4.alias }}' -- using ansible_default_ipv4.alias"
# 2022-12-30: Functionality moved to www_options/tasks/php-settings.yml
- name: "'local_tz: {{ local_tz }}' was set by ansible_date_time.tz in /opt/iiab/iiab/vars/default_vars.yml -- e.g. if Ansible finds symlink /etc/localtime -> ../usr/share/zoneinfo/America/New_York -- it will simplify that to 'EDT' (in the summer) or 'EST' (in the winter)"
- name: "'local_tz: {{ local_tz }}' was set by ansible_date_time.tz in /opt/iiab/iiab/vars/default_vars.yml -- e.g. if Ansible finds symlink /etc/localtime -> ../usr/share/zoneinfo/America/New_York -- it will simplify that to 'EDT' (in the summer) or 'EST' (in the winter)"
# 2020-11-04: Fix validation of 5 [now 4] core dependencies, for ./runrole etc
# 2020-11-04: Fix validation of 5 [now 4] core dependencies, for ./runrole etc
- name:Set vars_checklist for 44 + 44 + 40 vars ("XYZ_install" + "XYZ_enabled" + "XYZ_installed") to be checked
- name:Set vars_checklist for 45 + 45 + 40 vars ("XYZ_install" + "XYZ_enabled" + "XYZ_installed") to be checked
set_fact:
set_fact:
vars_checklist:
vars_checklist:
- hostapd
- hostapd
- dhcpd
- named
- dnsmasq
- dnsmasq
- bluetooth
- bluetooth
#- wondershaper # Unmaintained
- sshd
- sshd
- openvpn
#- openvpn # Deprecated
- tailscale
- remoteit
- remoteit
- admin_console
- admin_console
#- nginx # MANDATORY
#- nginx # MANDATORY
#- apache # Unmaintained - former dependency
#- apache # Unmaintained - former dependency
#- mysql # MANDATORY
- squid
- squid
#- dansguardian # Unmaintained
- cups
- cups
- samba
- samba
- usb_lib
- usb_lib
#- xo_services # Unmaintained
#- activity_server # Unmaintained
#- ejabberd_xs # Unmaintained
#- idmgr # Unmaintained
- azuracast
- azuracast
#- dokuwiki # Unmaintained
#- ejabberd # Unmaintained
#- elgg # Unmaintained
- gitea
- gitea
- jupyterhub
- jupyterhub
- lokole
- lokole
- mysql # Dependency - excluded from _installed check below
- mediawiki
- mediawiki
- mosquitto
- mosquitto
- nodejs # Dependency - excluded from _installed check below
- nodejs # Dependency - excluded from _installed check below
@ -111,6 +102,7 @@
- osm_vector_maps
- osm_vector_maps
- transmission
- transmission
- awstats
- awstats
- matomo
- monit
- monit
- munin
- munin
- phpmyadmin
- phpmyadmin
@ -122,6 +114,7 @@
- calibreweb
- calibreweb
- calibre
- calibre
- pbx
- pbx
- network
- name:Assert that {{ vars_checklist | length }} "XYZ_install" vars are all... defined
- name:Assert that {{ vars_checklist | length }} "XYZ_install" vars are all... defined
assert:
assert:
@ -163,5 +156,41 @@
that:"{{ item }}_install or {{ item }}_installed is undefined"
that:"{{ item }}_install or {{ item }}_installed is undefined"
fail_msg:"DISALLOWED: '{{ item }}_install: False' (e.g. in /etc/iiab/local_vars.yml) WHEN '{{ item }}_installed' is defined (e.g. in /etc/iiab/iiab_state.yml) -- IIAB DOES NOT SUPPORT UNINSTALLS -- please verify those 2 files especially, and other places variables are defined?"
fail_msg:"DISALLOWED: '{{ item }}_install: False' (e.g. in /etc/iiab/local_vars.yml) WHEN '{{ item }}_installed' is defined (e.g. in /etc/iiab/iiab_state.yml) -- IIAB DOES NOT SUPPORT UNINSTALLS -- please verify those 2 files especially, and other places variables are defined?"
quiet:yes
quiet:yes
when:item != 'nodejs' and item != 'postgresql' and item != 'mongodb' and item != 'yarn' # Exclude auto-installed dependencies
when:item != 'mysql' and item != 'postgresql' and item != 'mongodb' and item != 'nodejs' and item != 'yarn' # Exclude auto-installed dependencies
loop:"{{ vars_checklist }}"
loop:"{{ vars_checklist }}"
- name:Set vars_deprecated_list for 4+ vars ("XYZ_install") to be checked
set_fact:
vars_deprecated_list:
- dhcpd # Deprecated
- named # Deprecated
- wondershaper # Deprecated
- dansguardian # Deprecated
#- xo_services # Unmaintained
#- activity_server # Unmaintained
#- ejabberd_xs # Unmaintained
#- idmgr # Unmaintained
#- dokuwiki # Unmaintained
#- ejabberd # Unmaintained
#- elgg # Unmaintained
- name:'DISALLOW "XYZ_install: True" if deprecated'
assert:
that:"{{ item }}_install is undefined or not {{ item }}_install"
fail_msg:"DISALLOWED: '{{ item }}_install: True' (e.g. in /etc/iiab/local_vars.yml)"
quiet:yes
loop:"{{ vars_deprecated_list }}"
# 2023-12-04: ansible-core 2.16.1 suddenly no longer allows 'assert' with
- name:Download {{ iiab_download_url }}/iwlwifi-8000C-13.ucode to /lib/firmware for built-in WiFi on NUC6 # iiab_download_url is http://download.iiab.io/packages
# 2024-02-09: Code below appears stale for Shanti's #3707 hardware
get_url:
#- name: Check if the identifier for Intel's NUC6 built-in WiFi is present
- name:Install packages 'parted' and 'cloud-guest-utils' (for /usr/bin/growpart, though raspi-config uses fdisk)
package:
name:
- parted # 2022-03-15:RasPiOS and Ubuntu install this regardless -- so rarely nec, but just in case.
- cloud-guest-utils # 2022-04-02:For growpart command -- whereas RasPiOS's 'raspi-config --expand-rootfs' instead uses fdisk (requiring a reboot, see do_expand_rootfs() in https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config). FYI Ubuntu pre-installs cloud-guest-utils, for use with cloud-init.
state:present
- name:"Install from templates: /usr/sbin/iiab-expand-rootfs, /etc/systemd/system/iiab-expand-rootfs.service"
- name:Copy iiab-network from {{ iiab_dir }}/scripts to /usr/local/bin/
copy:
src:"{{ iiab_dir }}/scripts/iiab-network"
dest:/usr/local/bin/
mode:'0755'
- name:Install ~12 network/wifi/related packages + Squid if necessary + configure /etc/sysctl.conf -- full configuration LATER in 'network', after Stage 9
include_tasks:roles/network/tasks/install.yml
when:network_install and network_installed is undefined
- include_tasks:uuid.yml
- include_tasks:uuid.yml
- include_tasks:ubermix.yml
- include_tasks:ubermix.yml
- include_tasks:hardware.yml # Can run raspberry_pi.yml
- name:install-expand-rootfs.yml, raspberry_pi.yml, NUC6 WiFi firmware, check for WiFi devices
include_tasks:hardware.yml
# Debian 10 "Buster" is apparently enabling AppArmor in 2019:
# Debian 10 "Buster" is apparently enabling AppArmor in 2019:
@ -60,7 +74,10 @@
# when: not is_debuntu and selinux_disabled is defined and selinux_disabled.changed
# when: not is_debuntu and selinux_disabled is defined and selinux_disabled.changed
- name:Recording STAGE 1 HAS COMPLETED ============================
- name:Install {{ iiab_env_file }} from template -- FYI this file can be run as a script if absolutely nec -- e.g. 'source /etc/iiab/iiab.env && echo $WWWROOT'
template:
template:
src:roles/1-prep/templates/iiab.env.j2
src:roles/1-prep/templates/iiab.env.j2
dest:"{{ iiab_env_file }}"# Can also be run as a script if absolutely nec, e.g. 'source /etc/iiab/iiab.env && echo $WWWROOT'
dest:"{{ iiab_env_file }}"
- name:Recording STAGE 1 HAS COMPLETED ============================
- cloud-guest-utils # Contains 'growpart' for resizing a partition during boot, which is normally done with the aid of cloud-init
- fake-hwclock # 2021-03-15:Missing on Ubuntu etc. RasPiOS installs this regardless -- to save/restore system clock on machines w/o working RTC (above).
- dphys-swapfile # 2021-07-27:RaspiOS installs this regardless -- autogenerate and use a swap file
- dphys-swapfile # 2021-03-15:Missing on Ubuntu etc. RasPiOS installs this regardless -- to autogenerate and use a swap file (below).
- fake-hwclock # 2021-07-27:RaspiOS installs this regardless -- save/restore system clock on machines without working RTC hardware
- iw # 2021-07-27:RaspiOS installs this regardless -- configure Linux wireless devices -- hard dependence for ap0 creation, SEE https://github.com/iiab/iiab/blob/master/roles/network/templates/hostapd/iiab-clone-wifi.service.j2
- wireless-tools # 2021-07-27:RaspiOS installs this regardless -- manipulate Linux Wireless Extensions
state:present
state:present
- name:Increase swap file size (to CONF_SWAPSIZE={{ pi_swap_file_size }} in /etc/dphys-swapfile) as kalite pip download fails
- name:Increase swap file size (to CONF_SWAPSIZE={{ pi_swap_file_size }} in /etc/dphys-swapfile) as kalite pip download fails
lineinfile:
lineinfile:
path:/etc/dphys-swapfile
path:/etc/dphys-swapfile
@ -70,18 +42,9 @@
state:restarted
state:restarted
- name:Install RPi rootfs resizing (/usr/sbin/iiab-rpi-max-rootfs.sh) and its systemd service (/etc/systemd/system/iiab-rpi-root-resize.service), from templates (root:root by default)
#- name: Enable bluetooth in /boot/firmware/syscfg.txt on Ubuntu (needs reboot)
# OR https://github.com/iiab/iiab-factory/blob/master/box/rpi/exp-sd
if [ -f /.expand-rootfs ] || [ -f /.resize-rootfs ]; then
echo "$0: Expanding rootfs partition"
if [ -x /usr/bin/raspi-config ]; then # Raspberry Pi OS -- WARNING: their fdisk-centric approach of course FAILS with "Hybrid MBR" or GPT partition tables, as required by any drive > 2TB :/
reboot # In future, we might warn interactive users that a reboot is coming?
else # REQUIRES NO REBOOT; BEWARE iiab-expand-rootfs.service RACE CONDITION WITH fsck (PR #2522 & #3325)
# 2022-03-15: Borrows from above raspi-config URL's do_expand_rootfs()
ROOT_PART="$(findmnt / -o SOURCE -n)" # e.g. /dev/sda2 or /dev/mmcblk0p2
ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" # e.g. /dev/sda or /dev/mmcblk0
ROOT_PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")" # e.g. 2
# SLOW (~10 seconds) but it works!
LAST_PART_NUM=$(parted "$ROOT_DEV" -ms unit s p | tail -n 1 | cut -f 1 -d:)
if [ $ROOT_PART_NUM -ne $LAST_PART_NUM ]; then
echo "ERROR: $ROOT_PART partition ($ROOT_PART_NUM) is not the last partition ($LAST_PART_NUM). Don't know how to expand."
exit 1
fi
# Expand partition
growpart $ROOT_DEV $ROOT_PART_NUM || true # raspi-config instead uses fdisk (assuming MBR). They really should transition to gdisk, as required by any drive > 2TB. WARNING: growpart RC 2 is more severe than RC 1, and should possibly be handled separately in future?
rc=$? # Make Return Code visible, for 'bash -x'
resize2fs $ROOT_PART
rc=$? # Make RC visible (as above)
# 2022-03-15: Legacy code below worked with Raspberry Pi microSD cards
# but *not* with USB boot drives, internal spinning disks/SSD's, etc.
# # ASSUMES SD CARD STYLE PARTITION NAME LIKE <device>p<partition number>
# # e.g. /dev/mmcblk0p2 mounts at / (typical RasPiOS microSD)
# # BUT /dev/sda2 mounts at /media/usb1 (RasPiOS USB boot disk...
- name: '2021-07-27:SEE ALSO ~3 networking packages EARLIER installed by https://github.com/iiab/iiab/blob/master/roles/1-prep/tasks/raspberry_pi.yml'
meta:noop
- name: '2021-07-27:SEE ALSO ~4 networking packages EARLIER installed by https://github.com/iiab/iiab/blob/master/roles/2-common/tasks/packages.yml'
meta:noop
- name:Install package networkd-dispatcher (OS's other than RaspiOS)
package:
name:networkd-dispatcher # Dispatcher service for systemd-networkd connection status changes
state:present
when:not is_raspbian
- name: 'Install network packages:hostapd, iproute2, iptables-persistent, netmask -- later used by https://github.com/iiab/iiab/tree/master/roles/network'
package:
name:
- hostapd # IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator -- has its service masked out of the box, and only used when IIAB's network roles detects the presence of WiFi and an AP is desired
- iproute2 # 2021-07-27:RaspiOS installs this regardless -- the new networking and traffic control tools, meant to replace net-tools
- iptables-persistent # Boot-time loader for netfilter rules, iptables (firewall) plugin -- however Netfilter / nftables is ever moving forward so keep an eye on it!
- name:"Use 'sysctl' to set 'kernel.core_uses_pid: 1' + 4 network settings in /etc/sysctl.conf -- e.g. disabling IPv6 (this might be overkill, as IPv6 should really only be disabled on the LAN side, i.e. br0)"
sysctl:# Places these settings in /etc/sysctl.conf, to survive reboot
- acpid # 55kB download:Daemon for ACPI (power mgmt) events
- avahi-daemon # 2021-07-27:RaspiOS (and package libnss-mnds, below) install this regardless -- holdover from the XO days and used to advertise ssh/admin-console being available via avahi-daemon -- used with https://github.com/iiab/iiab/blob/master/roles/network/tasks/avahi.yml
- bzip2 # 47kB download: RasPiOS installs this regardless -- 2021-04-26:Prob not used, but can't hurt?
#- avahi-discover # 2021-07-27: Commented out long ago
- cron # 98kB download: RasPiOS installs this regardless -- 2022-10-13:Debian 12 needs this added (for now?)
- bzip2 # 2021-04-26:Prob not used, but can't hurt?
- curl # 254kB download:RasPiOS installs this regardless -- Used to install roles/nodejs and roles/nodered
- curl # Used to install roles/nodejs and roles/nodered
#- etckeeper # 54kB download: "nobody is really using etckeeper and it's bloating the filesystem every time apt runs" per @jvonau at https://github.com/iiab/iiab/issues/1146
#- etckeeper # "nobody is really using etckeeper and it's bloating the filesystem every time apt runs" per @jvonau at https://github.com/iiab/iiab/issues/1146
#- exfat-fuse # 28kB download: 2021-07-27: Should no longer be nec with 5.4+ kernels, so let's try commenting it out
#- exfat-fuse # 2021-07-27: Should no longer be nec with 5.4+ kernels, so let's try commenting it out
#- exfat-utils # 41kB download: Ditto! See also 'ntfs-3g' below
#- exfat-utils # Ditto! See also 'ntfs-3g' below
- gawk # 533kB download
- gawk
- gpg # 884kB download:Debian 12+ (especially!) require this for apt installs of gitea, kolibri, mongodb, yarn
- htop
- htop # 109kB download:RasPiOS installs this regardless
- i2c-tools # Low-level bus/chip/register/EEPROM tools e.g. for RTC
- i2c-tools # 78kB download:Low-level bus/chip/register/EEPROM tools e.g. for RTC
#- inetutils-syslogd # 2021-07-27: Error logging facility -- holdover from the XO days, journalctl has replaced this in newer distros
- logrotate # 67kB download:RasPiOS installs this regardless
#- iproute2 # Installed by roles/2-common/tasks/network.yml
- lshw # 257kB download:For 'lshw -C network' in iiab-diagnostics
- logrotate
#- lynx # 505kB download: Installed by 1-prep's roles/iiab-admin/tasks/main.yml
- libnss-mdns # 2021-07-27:RaspiOS (and package avahi-daemon, above) install this regardless -- client-side library -- provides name resolution via mDNS (Multicast DNS) using Zeroconf/Bonjour e.g. Avahi
#- make # 376kB download: 2021-07-27: Currently used by roles/pbx and no other roles
#- lynx # Installed by 1-prep's roles/iiab-admin/tasks/access.yml
#- ntfs-3g # 379kB download: RasPiOS installs this regardless -- 2021-07-31: But this should no longer be nec with 5.4+ kernels, similar to exfat packages above -- however, see also this symlink warning: https://superuser.com/questions/1050544/mount-with-kernel-ntfs-and-not-ntfs-3g -- and upcoming kernel 5.15 improvements: https://www.phoronix.com/scan.php?page=news_item&px=New-NTFS-Likely-For-Linux-5.15
#- make # 2021-07-27: Currently used by roles/pbx and no other roles
#- openssh-server # 318kB download: RasPiOS installs this regardless -- this is also installed by 1-prep's roles/sshd/tasks/main.yml to cover all OS's
#- ntfs-3g # 2021-07-31: RaspiOS installs this regardless -- but this should no longer be nec with 5.4+ kernels, similar to exfat packages above -- however, see also this symlink warning: https://superuser.com/questions/1050544/mount-with-kernel-ntfs-and-not-ntfs-3g -- and upcoming kernel 5.15 improvements: https://www.phoronix.com/scan.php?page=news_item&px=New-NTFS-Likely-For-Linux-5.15
#- mlocate # 92kB download
#- openssh-server # ssh (Raspbian) or openssh-server (other OS's) already installed by 1-prep's roles/sshd/tasks/main.yml
#- python3-pip # 337kB download: 2023-03-22: Used to be installed by /opt/iiab/iiab/scripts/ansible -- which would auto-install 'python3-setuptools' and 'python3' etc
- pastebinit # For /usr/bin/iiab-diagnostics
#- python3-venv # 1188kB download: 2023-03-22: Already installed by /opt/iiab/iiab/scripts/ansible -- used by roles like {calibre-web, jupyterhub, lokole} -- whereas roles/kalite uses (virtual) package 'virtualenv' for Python 2 -- all these 3+1 IIAB roles install 'python3-venv' for themselves. FYI: Debian 11 no longer auto-installs 'python3-venv' when you install 'python3'
#- python3-pip # 2021-07-29: Already installed by /opt/iiab/iiab/scripts/ansible -- this auto-installs 'python3-setuptools' and 'python3' etc
- rsync # 351kB download:RasPiOS installs this regardless
#- python3-venv # 2021-07-30: For Ansible module 'pip' used in roles like {calibre-web, jupyterhub, lokole} -- whereas roles/kalite uses (virtual) package 'virtualenv' for Python 2 -- all these 3+1 IIAB roles install 'python3-venv' for themselves. FYI: Debian 11 auto-installs 'python3-venv' when you install 'python3' -- whereas Ubuntu (e.g. 20.04 & 21.10) and RaspiOS 10 do not.
#- screen # 551kB download: Installed by 1-prep's roles/iiab-admin/tasks/main.yml
- rsync
- sqlite3 # 1054kB download
#- screen # Installed by 1-prep's roles/iiab-admin/tasks/access.yml
- tar # 799kB download:RasPiOS installs this regardless
- sqlite3
- unzip # 151kB download:RasPiOS installs this regardless
#- sudo # (1) Should be installed prior to installing IIAB, (2) Can also be installed by roles/1-prep's roles/openvpn/tasks/install.yml, (3) Is definitely installed by 1-prep's roles/iiab-admin/tasks/sudo-prereqs.yml
#- usbmount # 18kB download: Moved to roles/usb_lib/tasks/install.yml
- tar
- usbutils # 67kB download: RasPiOS installs this regardless -- 2021-07-27:move to roles/usb_lib/tasks/install.yml ?
- unzip
- wget # 922kB download:RasPiOS installs this regardless
#- usbmount # Moved to roles/usb_lib/tasks/install.yml
- usbutils # 2021-07-27:RaspiOS installs this regardless -- move to roles/usb_lib/tasks/install.yml ?
- wget
- wpasupplicant # 2021-07-27:RaspiOS installs this regardless -- client library for connections to a WiFi AP
This 3rd `stage <https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide#ansible>`_ installs base server infra that `Internet-in-a-Box (IIAB) <https://internet-in-a-box.org/>`_ requires, including:
This 3rd `stage <https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide#ansible>`_ installs base server infra that `Internet-in-a-Box (IIAB) <https://internet-in-a-box.org/>`_ requires, including:
- `MySQL <https://github.com/iiab/iiab/blob/master/roles/mysql>`_ (database underlying many/most user-facing apps). This IIAB role also installs apt package:
- |ss|`MySQL <https://github.com/iiab/iiab/blob/master/roles/mysql>`_ (database underlying many/most user-facing apps). |se| |nbsp| *As of 2023-11-05, MySQL / MariaDB is NO LONGER INSTALLED by 3-base-server — instead it's installed on-demand — as a dependency of Matomo, MediaWiki, Nextcloud, PBX (for FreePBX), WordPress &/or Admin Console.* This IIAB role (roles/mysql) also installs apt package:
- `NGINX <https://github.com/iiab/iiab/blob/master/roles/nginx>`_ web server (with Apache in some lingering cases). This IIAB role also installs apt package:
- `NGINX <https://github.com/iiab/iiab/blob/master/roles/nginx>`_ web server (with Apache in some lingering cases). This IIAB role also installs apt package:
- **php{{ php_version }}-fpm** — which forcibly installs **php{{ php_version }}-cli**, **php{{ php_version }}-common** and **libsodium23**
- **php{{ php_version }}-fpm** — which forcibly installs **php{{ php_version }}-cli**, **php{{ php_version }}-common** and **libsodium23**
Whereas 3-base-server installs critical packages needed by all, this 4th `stage <https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide#ansible>`_ installs a broad array of *options* — depending on which server apps will be installed in later stages — as specified in `/etc/iiab/local_vars.yml <http://FAQ.IIAB.IO#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_
Whereas 3-base-server installs critical packages needed by all, this 4th `stage <https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide#ansible>`_ installs a broad array of *options* — depending on which server apps will be installed in later stages — as specified in `/etc/iiab/local_vars.yml <http://FAQ.IIAB.IO#What_is_local_vars.yml_and_how_do_I_customize_it%3F>`_
This includes more networking fundamentals, that may further be configured later on.
This includes more networking fundamentals, that may further be configured later on.
@ -11,7 +11,7 @@ Specifically, these might be installed:
- Python libraries
- Python libraries
- SSH daemon
- SSH daemon
- Bluetooth for Raspberry Pi
- Bluetooth for Raspberry Pi
- Instant-sharing of `USB stick content <https://wiki.iiab.io/go/FAQ#Can_teachers_display_their_own_content.3F>`_
- Instant-sharing of `USB stick content <https://wiki.iiab.io/go/FAQ#Can_teachers_display_their_own_content%3F>`_
when:kalite_install and (is_ubuntu_2204 or is_ubuntu_2310 or is_debian_12) # Also covers is_linuxmint_21 and is_raspbian_12
- name:KOLIBRI
- name:KOLIBRI
include_role:
include_role:
name:kolibri
name:kolibri
when:kolibri_install
when:kolibri_install
#when: kolibri_install and python_version is version('3.12', '<') # Debian 13 still uses Python 3.11 (for now!) so really this just avoids Ubuntu 24.04 and 24.10 pre-releases during initial iiab-install. CLARIF: This is all TEMPORARY until learningequality/kolibri#11316 brings Python 3.12 support to Kolibri 0.17 pre-releases (expected very soon).
- name:KIWIX
- name:KIWIX
include_role:
include_role:
@ -40,10 +41,23 @@
name:pathagar
name:pathagar
when:pathagar_install is defined and pathagar_install
when:pathagar_install is defined and pathagar_install
# WARNING: Since March 2023, 32-bit RasPiOS can act as 64-bit on RPi 4 and
# RPi 400 (unlike RPi 3!) SEE: https://github.com/iiab/iiab/pull/3422 and #3516
- name:Run command 'dpkg --print-architecture' to identify OS architecture (CPU arch as revealed by ansible_architecture ~= ansible_machine is NO LONGER enough!)
command:dpkg --print-architecture
register:dpkg_arch
when:sugarizer_install
- name:Explain bypassing of Sugarizer install if 32-bit OS
fail:# FORCE IT RED THIS ONCE!
msg:"BYPASSING SUGARIZER INSTALL ATTEMPT, as Sugarizer Server 1.5.0 requires MongoDB 3.2+ which is NO LONGER SUPPORTED on 32-bit Raspberry Pi OS. 'dpkg --print-architecture' output for your OS: {{ dpkg_arch.stdout }}"
when:sugarizer_install and not dpkg_arch.stdout is search("64")
ignore_errors:True
- name:SUGARIZER
- name:SUGARIZER
include_role:
include_role:
name:sugarizer
name:sugarizer
when:sugarizer_install
when:sugarizer_install and dpkg_arch.stdout is search("64")
- name:Recording STAGE 7 HAS COMPLETED ========================
- name:Recording STAGE 7 HAS COMPLETED ========================
when:transmission_install and not (is_ubuntu_2404 or is_ubuntu_2410 or is_ubuntu_2504) # Also excludes is_linuxmint_22, for#3756 (whereas Debian 13 works great!)
- name:Run command 'dpkg --print-architecture' to identify OS architecture (CPU arch as revealed by ansible_architecture ~= ansible_machine is NO LONGER enough!)
command:dpkg --print-architecture
register:dpkg_arch
when:internetarchive_install
- name:Explain bypassing of Internet Archive install if 32-bit OS
fail:# FORCE IT RED THIS ONCE!
msg:"BYPASSING INTERNET ARCHIVE PER https://github.com/iiab/iiab/issues/3641 -- 'dpkg --print-architecture' output for your OS: {{ dpkg_arch.stdout }}"
when:internetarchive_install and not dpkg_arch.stdout is search("64")
ignore_errors:True
- name:INTERNETARCHIVE
- name:INTERNETARCHIVE
include_role:
include_role:
name:internetarchive
name:internetarchive
when:internetarchive_install
when:internetarchive_install and dpkg_arch.stdout is search("64")
- name:MINETEST
- name:MINETEST
include_role:
include_role:
@ -37,12 +55,46 @@
name:pbx
name:pbx
when:pbx_install
when:pbx_install
- name:"2021-06-27 TEMPORARY CODE TO INSTALL 'php-pear' UNTIL ADMIN CONSOLE DECLARES ITS OWN DEPENDENCY FOR: https://github.com/iiab/iiab-admin-console/blob/master/roles/cmdsrv/tasks/main.yml#L19"
package:
- name: '2023-11-05 / TEMPORARY UNTIL ADMIN CONSOLE DECLARES ITS DEPENDENCY:Install MySQL (MariaDB) if admin_console_install (for setup-feedback and record_feedback.php)'
name: php-pear # WARNING:this also drags in 'php{{ php_version }}-xml' (also installed by MediaWiki, Nextcloud, roles/pbx's FreePBX, WordPress) AND 'php{{ php_version }}-cgi' (also installed by roles/pbx's FreePBX)
set_fact:
state:present
mysql_install:True
mysql_enabled:True
when:admin_console_install
when:admin_console_install
- name: '2023-11-05 / TEMPORARY UNTIL ADMIN CONSOLE DECLARES ITS DEPENDENCY:Install MySQL (MariaDB) if admin_console_install (for setup-feedback and record_feedback.php)'
include_role:
name:mysql
when:admin_console_install
- name: '2023-11-05 / TEMPORARY UNTIL ADMIN CONSOLE DECLARES ITS DEPENDENCY:Install MySQL (MariaDB) if admin_console_install (for setup-feedback and record_feedback.php)'
fail:
msg:"Admin Console install cannot proceed, as MySQL / MariaDB is not installed."
when:admin_console_install and mysql_installed is undefined
# 2023-11-05: Moved from Stage 8, as it acts on mysql_installed (that might be set just above!)
- name:MUNIN
include_role:
name:munin
when:munin_install
- name:Read 'disk_used_a_priori' from /etc/iiab/iiab.ini
- name:Install AWStats if 'awstats_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
- block:
include_tasks:install.yml
when:awstats_installed is undefined
- name:Install AWStats if 'awstats_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks:install.yml
when:awstats_installed is undefined
- name:Enable/Disable/Restart NGINX
- name:Enable/Disable/Restart NGINX
include_tasks:nginx.yml
include_tasks:nginx.yml
- name:Add 'awstats' variable values to {{ iiab_ini_file }}
ini_file:
path:"{{ iiab_ini_file }}"# /etc/iiab/iiab.ini
section:awstats
option:"{{ item.option }}"
value:"{{ item.value | string }}"
with_items:
- option:name
value:AWStats
- option:description
value:'"AWStats (originally known as Advanced Web Statistics) is a package written in Perl which generates static or dynamic html summaries based upon web server logs."'
- option:awstats_install
value:"{{ awstats_install }}"
- option:awstats_enabled
value:"{{ awstats_enabled }}"
- name:Add 'awstats' variable values to {{ iiab_ini_file }}
value:'"AWStats (originally known as Advanced Web Statistics) is a package written in Perl which generates static or dynamic html summaries based upon web server logs."'
This playbook adds `AzuraCast <https://azuracast.com/>`_ to Internet-in-a-Box (IIAB) for network radio station functionality. With 'AzuraCast' you and your community can schedule podcasts, music, and even do live streaming of audio content. A variety of streaming formats are supported.
Install `AzuraCast <https://azuracast.com/>`_ with your `Internet-in-a-Box (IIAB) <https://internet-in-a-box.org/>`_ if you want a simple, self-hosted "web radio station" with a modern web UI/UX. You and your community can then schedule newscasts, podcasts, music, and even do live streaming of audio content (video streaming might also be possible in future!)
Please see AzuraCast's `screenshots <https://www.azuracast.com/about/screenshots.html>`_.
As soon as you install AzuraCast with IIAB, it can stream MP3 files (and similar files) using `LiquidSoap <https://docs.azuracast.com/en/developers/liquidsoap>`_ to help you schedule or randomize playback of MP3 songs (and similar).
As of 2019-08-04, this will only run on Ubuntu 18.04, and tentatively on Debian 10 "Buster" (`#1766 <https://github.com/iiab/iiab/issues/1766>`_). Support for Raspberry Pi remains a goal for now — please if you can, consider helping us solve this critical challenge (`#1772 <https://github.com/iiab/iiab/issues/1772>`_, `AzuraCast/AzuraCast#332 <https://github.com/AzuraCast/AzuraCast/issues/332>`_).
Please see AzuraCast's `screenshots <https://www.google.com/search?q=azuracast+screenshot&tbm=isch>`_ and `docs <./README.rst#azuracast-docs>`_. Community implementation examples:
Optionally, live-streaming can also be made to work, e.g. if you install `Mixxx or BUTT <https://docs.azuracast.com/en/user-guide/streaming-software>`_ on your own. (If so, you have many options to configure streaming with `Icecast <https://icecast.org/>`_, `Shoutcast <https://www.shoutcast.com/>`_, etc.)
As of 2022-08-31, AzuraCast should run on Ubuntu 22.04 and **64-bit** Raspberry Pi OS: `#1772 <https://github.com/iiab/iiab/issues/1772>`_, `AzuraCast/AzuraCast#332 <https://github.com/AzuraCast/AzuraCast/issues/332>`_, `PR #2946 <https://github.com/iiab/iiab/pull/2946>`_
Other Linux distributions may also work, at your own risk, especially if Docker runs smoothly.
NOTE: AzuraCast was designed to be installed *just once* on a fresh OS. So ``./runrole --reinstall azuracast`` is not supported in general. However, if you accidentally damage your AzuraCast software, IIAB has posted `technical tips <./tasks/install.yml>`_*(use at your own risk!)* in case of emergency.
Using It
Using It
--------
--------
* Do a normal IIAB install (http://download.iiab.io), making sure to set both variables ``azuracast_install`` and ``azuracast_enabled`` to ``True`` when it prompts you to edit `/etc/iiab/local_vars.yml <http://FAQ.IIAB.IO#What_is_local_vars.yml_and_how_do_I_customize_it.3F>`_, as you begin the installation.
* Do a normal IIAB install (https://download.iiab.io), making sure to set both variables ``azuracast_install`` and ``azuracast_enabled`` to ``True`` when IIAB's installer prompts you to edit `/etc/iiab/local_vars.yml <http://FAQ.IIAB.IO#What_is_local_vars.yml_and_how_do_I_customize_it%3F>`_
* When the IIAB software install completes, it will ask you to reboot, and AzuraCast's console will then be available at http://box.lan:10080
* When the IIAB software install completes, it will ask you to reboot, and AzuraCast's console will then be available at http://box.lan:12080
* This console site will prompt you to complete AzuraCast's initial setup: user accounts, managing stations, radio streams, etc.
* That console site will prompt you to complete AzuraCast's initial setup: user accounts, managing stations, radio streams, etc.
* Finally, check out some `how-to videos <https://www.youtube.com/watch?v=b1Rxlu5P804>`_ to learn to manage your own radio station!
* Finally, check out some `how-to videos <https://www.youtube.com/watch?v=b1Rxlu5P804>`_ to learn to manage your own radio station!
Note: When creating a station using AzuraCast's console, its default streaming ports for ``station`` and ``autodj`` need to be in the `port range 10000-10100 <https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services>`_.
NOTE: When creating a station using AzuraCast's console, its default streaming ports for ``station`` and ``autodj`` need to be in the `port range 10000-10499 <https://github.com/iiab/iiab/wiki/IIAB-Networking#list-of-ports--services>`_ (ports 12080 and 12443 may also be required!)
#- name: Change default port number range 8xxx:8xxx to {{ azuracast_port_range_prefix }}xxx:{{ azuracast_port_range_prefix }}xxx icecast-stations in docker-compose.yml
- name:Change default port number range 8xxx:8xxx to {{ azuracast_port_range_prefix }}xxx:{{ azuracast_port_range_prefix }}xxx icecast-stations in docker-compose.yml
# 2022-09-28: "yes 'Y'" toggled whatever it found in /opt/azuracast/.env (e.g.
replace:
# AZURACAST_VERSION=stable from templates/prod.env.j2) to the opposite (e.g.
- name:Install AzuraCast if 'azuracast_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
- block:
include_tasks:install.yml
when:azuracast_installed is undefined
- name:Install AzuraCast if 'azuracast_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks:install.yml
when:azuracast_installed is undefined
# TODO figure out what to turn off/on for AzuraCast
# TODO figure out what to turn off/on for AzuraCast
# - include_tasks: enable-or-disable.yml
# - include_tasks: enable-or-disable.yml
- name:Add 'azuracast' variable values to {{ iiab_ini_file }}
ini_file:
path:"{{ iiab_ini_file }}"# /etc/iiab/iiab.ini
section:azuracast
option:"{{ item.option }}"
value:"{{ item.value | string }}"
with_items:
- option:name
value:azuracast
- option:description
value:'"AzuraCast is simple, self-hosted web radio. Use it to schedule student newscasts, podcasts, music (e.g. MP3''s and similar) and even do live-streaming."'
- option:enabled
value:"{{ azuracast_enabled }}"
- name:Add 'azuracast' variable values to {{ iiab_ini_file }}
value:'"AzuraCast is a self-hosted, all-in-one radio station platform. Use AzuraCast to schedule podcasts, music, and even do live streaming of audio content. A variety of streaming formats are supported."'
within Calibre-Web's **Configuration > Basic Configuration > Logfile
Configuration**.
Finally, http://box/live/stats (Calibre-Web's **About** page) can be a very
useful list of ~42 `Calibre-Web dependencies <https://github.com/janeczku/calibre-web/wiki/Dependencies-in-Calibre-Web-Linux-and-Windows>`_
(mostly Python packages, and the version number of each that's installed).
Back Up Everything
Back Up Everything
------------------
------------------
Please back up the entire folder ``/library/calibre-web`` before upgrading —
Please back up the entire folder ``/library/calibre-web`` before upgrading —
as it contains your Calibre-Web content **and** settings!
as it contains your Calibre-Web content **and** configuration settings!
Upgrading
Upgrading
---------
---------
Reinstalling Calibre-Web automatically upgrades to the latest version if your
Please see our `new/automated upgrade technique (iiab-update) <https://github.com/iiab/calibre-web/wiki#upgrading>`_
Internet-in-a-Box (IIAB) is online.
introduced in July 2024.
But first: back up your content **and** settings, as explained above.
But first: back up your content **and** configuration settings, as outlined
above!
**Then move your /library/calibre-web/metadata.db out of the way, if you're
**Conversely if you're sure you want to fully reset your Calibre-Web settings,
sure you want to (re)install bare/minimal metadata, and force all Calibre-Web
and remove all existing e-book/video/media metadata — then move your
settings to the default. Then run**::
/library/calibre-web/config/app.db, /library/calibre-web/metadata.db and
/library/calibre-web/xklb-metadata.db out of the way.**
RECAP: Either way, "reinstalling" Calibre-Web automatically installs the latest
version — so long as your Internet-in-a-Box (IIAB) is online. Most people
should stick with the new ``iiab-update`` technique above. However if you must
use the older/manual approach, you would need to run, as root::
cd /opt/iiab/iiab
cd /opt/iiab/iiab
./runrole calibre-web
./runrole --reinstall calibre-web
Or, to reinstall all of IIAB::
cd /opt/iiab/iiab
Or, if there's a need to try updating Calibre-Web's code alone::
./iiab-install --reinstall
Or, if you just want to upgrade Calibre-Web code alone, prior to proceeding
cd /usr/local/calibre-web-py3
manually::
cd /opt/iiab/calibre-web
git pull
git pull
Finally, this much older way is *no longer recommended*::
cd /opt/iiab/iiab
./iiab-install --reinstall # OR: ./iiab-configure
Known Issues
Known Issues
------------
------------
@ -153,7 +231,7 @@ Known Issues
* |ss| Imagemagick policy prevents generating thumbnails for PDF's during upload: `#1530 <https://github.com/iiab/iiab/issues/1530>`_`janeczku/calibre-web#827 <https://github.com/janeczku/calibre-web/issues/827>`_ |se|
* |ss| Imagemagick policy prevents generating thumbnails for PDF's during upload: `#1530 <https://github.com/iiab/iiab/issues/1530>`_`janeczku/calibre-web#827 <https://github.com/janeczku/calibre-web/issues/827>`_ |se|
* Upload of not supported file formats gives no feedback to the user: `janeczku/calibre-web#828 <https://github.com/janeczku/calibre-web/issues/828>`_
* |ss| Upload of not supported file formats gives no feedback to the user: `janeczku/calibre-web#828 <https://github.com/janeczku/calibre-web/issues/828>`_ |se| |nbsp| Fixed by `361a124 <https://github.com/janeczku/calibre-web/commit/361a1243d732116e6f520fabbaae017068b86037>`_ on 2019-02-27.
* *Please assist us in reporting serious issues here:*
- name:If enabling with Calibre-Web enhanced for large audio/video "books" too, also append onto calibre-web-nginx.conf AND symlink /library/www/html/calibre-web -> /library/calibre-web (WIP)
shell:|
if [ -f {{ calibreweb_venv_path }}/scripts/calibre-web-nginx.conf ]; then
- name:"Create 3 Calibre-Web folders to store data and config files: {{ calibreweb_home }}, {{ calibreweb_venv_path }}, {{ calibreweb_config }} (all set to {{ calibreweb_user }}:{{ apache_user }}) (default to 0755)"
- name:"Create 2 Calibre-Web folders to store data and config files: {{ calibreweb_home }}, {{ calibreweb_config }} (each set to {{ calibreweb_user }}:{{ apache_user }}, default to 0755)"
#force: True # CLAIM: "If true, any modified files in the working repository will be discarded" -- REALITY: even if `force: no`, Ansible destructively reclones (also removing all test branch commits etc!) -- unless a git credential is provided to Ansible?
depth:1
#depth: 1 # 2023-11-04: Full clone for now, to help @deldesir & wider community testing
version:"{{ calibreweb_version }}"# e.g. master, 0.6.5
version:"{{ calibreweb_version }}"# e.g. master, 0.6.22
when:not calibreweb_venv.stat.exists
## Ansible Pip Bug: Cannot use 'chdir' with 'env' https://github.com/ansible/ansible/issues/37912 (Patch landed)
- name:If Calibre-Web is being enhanced with audio/video "books" too, install/upgrade additional prereqs -- SEE https://github.com/iiab/calibre-web/wiki
shell:|
if [ -f {{ calibreweb_venv_path }}/scripts/lb-wrapper ]; then
apt install ffmpeg pipx -y
if lb --version; then
if pipx list | grep -q 'xklb'; then
pipx uninstall xklb
pipx install library
else
pipx reinstall library
fi
else
pipx install library
fi
ln -sf /root/.local/bin/lb /usr/local/bin/lb
if [ -f /root/.local/share/pipx/venvs/library/bin/yt-dlp ]; then
- name:Install Captive Portal if 'captiveportal_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
- block:
include_tasks:install.yml
when:captiveportal_installed is undefined
- name:Install Captive Portal if 'captiveportal_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks:install.yml
when:captiveportal_installed is undefined
- name:Enable or Disable Captive Portal
- include_tasks:enable-or-disable.yml
include_tasks:enable-or-disable.yml
- name:Add 'captiveportal' variable values to {{ iiab_ini_file }}
ini_file:
path:"{{ iiab_ini_file }}"# /etc/iiab/iiab.ini
section:captiveportal
option:"{{ item.option }}"
value:"{{ item.value | string }}"
with_items:
- option:name
value:Captive Portal
- option:description
value:'"Captive Portal tries to open the browser automatically, so users don''t have to type in URL''s like http://box.lan in support of kiosk-like situations, in multilingual and less literate communities."'
- option:captiveportal_install
value:"{{ captiveportal_install }}"
- option:captiveportal_enabled
value:"{{ captiveportal_enabled }}"
- name:Add 'captiveportal' variable values to {{ iiab_ini_file }}
value:'"Captive Portal tries to open the browser automatically, so users don''t have to type in URL''s like http://box.lan in support of kiosk-like situations, in multilingual and less literate communities."'
[CUPS](https://en.wikipedia.org/wiki/CUPS) (also known as the "Common UNIX Printing System") is the standards-based, open source printing system for Linux and macOS.
[CUPS](https://en.wikipedia.org/wiki/CUPS) (also known as the "Common UNIX Printing System") is the standards-based, open source printing system for Linux and macOS.
It allows your [Internet-in-a-Box (IIAB)](http://internet-in-a-box.org) to act as a print server.
It allows your [Internet-in-a-Box (IIAB)](https://internet-in-a-box.org) to act as a print server.
This can be useful if a printer is attached to your IIAB — so student/teacher print jobs from client computers and phones can be processed — and then sent to the appropriate printer.
This can be useful if a printer is attached to your IIAB — so student/teacher print jobs from client computers and phones can be processed — and then sent to the appropriate printer.
## Using it
## Using it
Make sure your IIAB was installed with these 2 lines in [/etc/iiab/local_vars.yml](http://faq.iiab.io/#What_is_local_vars.yml_and_how_do_I_customize_it.3F) :
Make sure your IIAB was installed with these 2 lines in [/etc/iiab/local_vars.yml](http://faq.iiab.io/#What_is_local_vars.yml_and_how_do_I_customize_it%3F) :
# (OR ANY MEMBER OF LINUX GROUP 'lpadmin') AS SET UP BELOW...
# (OR ANY MEMBER OF LINUX GROUP 'lpadmin') AS SET UP BELOW...
- name:Record (initial) disk space used
shell:df -B1 --output=used / | tail -1
register:df1
- name:Install 'cups' package
- name:Install 'cups' package
package:
package:
name:cups
name:cups
@ -49,19 +54,34 @@
blockinfile:
blockinfile:
path:/etc/cups/cupsd.conf
path:/etc/cups/cupsd.conf
insertafter:'^<Location /admin>$'
insertafter:'^<Location /admin>$'
block: |2 # Indent with 2 spaces, and surround block with 2 comment lines:"# BEGIN ANSIBLE MANAGED BLOCK","# END ANSIBLE MANAGED BLOCK"
block: |2 # |n MEANS:Set the block's left edge n CHARACTERS TO THE RIGHT of *this line's* indentation -- where n is {1..9} -- instead of setting its left edge to the 1st non-blank line's indentation below. Also surround block with comment lines: "# BEGIN ANSIBLE MANAGED BLOCK", "# END ANSIBLE MANAGED BLOCK"
AuthType Default
AuthType Default
Require user @SYSTEM
Require user @SYSTEM
- name:"CUPS web administration: Create Linux username 'Admin' with password 'changeme' in Linux group 'lpadmin' (shell: /usr/sbin/nologin, create_home: no)"
- name:"CUPS web administration: Create Linux username 'Admin' in Linux group 'lpadmin' (shell: /usr/sbin/nologin, create_home: no)"
user:
user:
name:Admin
name:Admin
append:yes# Don't clobber other groups, that other IIAB Apps might need.
append:yes# Don't clobber other groups, that other IIAB Apps might need.
groups:lpadmin
groups:lpadmin
password:"{{ 'changeme' | password_hash('sha512') }}"# Random salt. Presumably runs 5000 rounds of SHA-512 per /etc/login.defs & /etc/pam.d/common-password -- https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#encrypting-and-checksumming-strings-and-passwords
#password: "{{ 'changeme' | password_hash('sha512') }}" # Random salt. Presumably runs 5000 rounds of SHA-512 per /etc/login.defs & /etc/pam.d/common-password -- https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_filters.html#hashing-and-encrypting-strings-and-passwords
create_home:no
create_home:no
shell:/usr/sbin/nologin # Debian/Ubuntu norm -- instead of /sbin/nologin, /bin/false
shell:/usr/sbin/nologin # Debian/Ubuntu norm -- instead of /sbin/nologin, /bin/false
# 2024-05-01: Above password-setting approach no longer works w/ Ansible 2.17 RC1 (#3727).
# Ansible STOPS with this error...
#
# "[DEPRECATION WARNING]: Encryption using the Python crypt module is deprecated. The Python crypt module is
# deprecated and will be removed from Python 3.13. Install the passlib library for continued encryption
# functionality. This feature will be removed in version 2.17. Deprecation warnings can be disabled by
# setting deprecation_warnings=False in ansible.cfg."
#
# ...so we instead use Linux's "chpasswd" command (below!)
- name:Use chpasswd to set Linux username 'Admin' password to 'changeme'
command:chpasswd
args:
stdin:Admin:changeme
# - name: Add user '{{ iiab_admin_user }}' to Linux group 'lpadmin' -- for CUPS web administration (or modify default 'SystemGroup lpadmin' in /etc/cups/cups-files.conf -- in coordination with ~14 -> ~15 '@SYSTEM' lines in /etc/cups/cupsd.conf)
# - name: Add user '{{ iiab_admin_user }}' to Linux group 'lpadmin' -- for CUPS web administration (or modify default 'SystemGroup lpadmin' in /etc/cups/cups-files.conf -- in coordination with ~14 -> ~15 '@SYSTEM' lines in /etc/cups/cupsd.conf)
# #command: "gpasswd -a {{ iiab_admin_user | quote }} lpadmin"
# #command: "gpasswd -a {{ iiab_admin_user | quote }} lpadmin"
# - name: "Authorize Nearby IP Addresses: Run 'cupsctl --remote-admin --share-printers --user-cancel-any' to enable http://192.168.0.x:631 AND http://172.18.96.1:631 (if cups_enabled) -- REPEATED USE OF 'cupsctl' COMMANDS CAN *DAMAGE* /etc/cups/cupsd.conf BY ADDING DUPLICATE LINES (AND WORSE!) -- SO PLEASE ALSO MANUALLY RUN 'sudo cupsctl' AND 'sudo cupsd -t' TO VERIFY /etc/cups/cupsd.conf"
# - name: "Authorize Nearby IP Addresses: Run 'cupsctl --remote-admin --share-printers --user-cancel-any' to enable http://192.168.0.x:631 AND http://{{ lan_ip }}:631 (if cups_enabled) -- REPEATED USE OF 'cupsctl' COMMANDS CAN *DAMAGE* /etc/cups/cupsd.conf BY ADDING DUPLICATE LINES (AND WORSE!) -- SO PLEASE ALSO MANUALLY RUN 'sudo cupsctl' AND 'sudo cupsd -t' TO VERIFY /etc/cups/cupsd.conf"
# 2021-07-11: BOTH FLAGS *CANNOT* BE USED TOGETHER -- CHOOSE ONE OR THE OTHER:
# 2021-07-11: BOTH FLAGS *CANNOT* BE USED TOGETHER -- CHOOSE ONE OR THE OTHER:
# (1) '--remote-admin' AS ABOVE, OR (2) '--remote-any' AS BELOW.
# (1) '--remote-admin' AS ABOVE, OR (2) '--remote-any' AS BELOW.
# (RUN 'cupsctl' WITHOUT PARAMETERS TO CONFIRM THIS!)
# (RUN 'cupsctl' WITHOUT PARAMETERS TO CONFIRM THIS!)
- name:"Authorize All IP Addresses: Run 'cupsctl --remote-any --share-printers --user-cancel-any' to enable http://192.168.0.x:631 AND http://172.18.96.1:631 AND http://10.8.0.y:631 (if cups_enabled) -- REPEATED USE OF 'cupsctl' COMMANDS CAN *DAMAGE* /etc/cups/cupsd.conf BY ADDING DUPLICATE LINES (AND WORSE!) -- SO PLEASE ALSO MANUALLY RUN 'sudo cupsctl' AND 'sudo cupsd -t' TO VERIFY /etc/cups/cupsd.conf"
- name:"Authorize All IP Addresses: Run 'cupsctl --remote-any --share-printers --user-cancel-any' to enable http://192.168.0.x:631 AND http://{{ lan_ip }}:631 AND http://10.8.0.y:631 (if cups_enabled) -- REPEATED USE OF 'cupsctl' COMMANDS CAN *DAMAGE* /etc/cups/cupsd.conf BY ADDING DUPLICATE LINES (AND WORSE!) -- SO PLEASE ALSO MANUALLY RUN 'sudo cupsctl' AND 'sudo cupsd -t' TO VERIFY /etc/cups/cupsd.conf"
# - name: "2021-07-14: EXPERIMENTALLY ADD DIRECTIVES TO /etc/cups/cupsd.conf followed by 'systemctl restart cups'. As should no longer be nec thanks to NEW cups/templates/cups.conf for /etc/nginx/conf.d/cups.conf (followed by 'systemctl restart nginx'). Which FIXED URL'S LIKE: http://box/print, http://box.lan/print, http://192.168.0.x/print, http://172.18.96.1/print and http://10.8.0.x/print (WITH OR WITHOUT THE TRAILING SLASH!) RECAP: (1) So be it that these 2 URL'S STILL DON'T WORK: http://box:631, http://box.lan:631 (due to CUPS' internal web server's overly stringent hostname checks, i.e. '400 Bad Request' and 'Request from \"localhost\" using invalid Host: field \"box[.lan]:631\".' in /var/log/cups/error_log) -- (2) While these 2 URL'S STILL DO WORK: http://localhost:631, http://127.0.0.1:631 -- (3) Whereas these 3 URL'S MAY WORK, DEPENDING ON 'cupsctl' COMMAND(S) ABOVE: http://192.168.0.x:631, http://172.18.96.1:631, http://10.8.0.x:631"
# - name: "2021-07-14: EXPERIMENTALLY ADD DIRECTIVES TO /etc/cups/cupsd.conf followed by 'systemctl restart cups'. As should no longer be nec thanks to NEW cups/templates/cups.conf for /etc/nginx/conf.d/cups.conf (followed by 'systemctl restart nginx'). Which FIXED URL'S LIKE: http://box/print, http://box.lan/print, http://192.168.0.x/print, http://{{ lan_ip }}/print and http://10.8.0.x/print (WITH OR WITHOUT THE TRAILING SLASH!) RECAP: (1) So be it that these 2 URL'S STILL DON'T WORK: http://box:631, http://box.lan:631 (due to CUPS' internal web server's overly stringent hostname checks, i.e. '400 Bad Request' and 'Request from \"localhost\" using invalid Host: field \"box[.lan]:631\".' in /var/log/cups/error_log) -- (2) While these 2 URL'S STILL DO WORK: http://localhost:631, http://127.0.0.1:631 -- (3) Whereas these 3 URL'S MAY WORK, DEPENDING ON 'cupsctl' COMMAND(S) ABOVE: http://192.168.0.x:631, http://{{ lan_ip }}:631, http://10.8.0.x:631"
# lineinfile:
# lineinfile:
# path: /etc/cups/cupsd.conf
# path: /etc/cups/cupsd.conf
# line: "{{ item }}"
# line: "{{ item }}"
@ -105,7 +125,7 @@
# - "HostNameLookups On" # More False Leads: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530027
# - "HostNameLookups On" # More False Leads: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=530027