1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

Merge pull request #383 from iiab/master

sync from iiab:master
This commit is contained in:
A Holt 2020-03-21 10:47:09 -04:00 committed by GitHub
commit c3a60ef050
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 129 additions and 119 deletions

View file

@ -18,7 +18,7 @@ exFAT_enabled: False
is_F18: False
# Set default 1-prep discovered hardware
rtc_id: ds3231
rtc_id: none
NUC6_firmware_needed: False
# Used in 2-common/tasks/xo.yml

View file

@ -35,7 +35,7 @@
value: "{{ ansible_local.local_facts.iiab_commit }}"
- option: install_date
value: "{{ ansible_date_time.iso8601 }}"
- option: install_xo
- option: xo_model
value: "{{ xo_model }}"
- option: is_rpi
- option: rpi_model
value: "{{ rpi_model }}"

View file

@ -69,10 +69,9 @@
# Discover: do we have a gateway?
# If Ansible detects gateway, becomes WAN candidate.
- name: "Do we have a gateway? If so set discovered_wan_iface: {{ ansible_default_ipv4.alias }}, iiab_wan_iface: {{ discovered_wan_iface }}"
- name: "Do we have a gateway? If so set discovered_wan_iface: {{ ansible_default_ipv4.alias }}"
set_fact:
discovered_wan_iface: "{{ ansible_default_ipv4.alias }}"
iiab_wan_iface: "{{ discovered_wan_iface }}"
when: ansible_default_ipv4.gateway is defined
- name: "Verify gateway active: ping -c4 {{ ansible_default_ipv4.gateway }}"
@ -80,12 +79,13 @@
when: discovered_wan_iface != "none"
register: gw_active_test
- name: If so, set gw_active
- name: If so, set gw_active, iiab_wan_iface to {{ discovered_wan_iface }}
set_fact:
iiab_wan_iface: "{{ discovered_wan_iface }}"
gw_active: True
when: discovered_wan_iface != "none" and gw_active_test.stdout == "1"
- name: Test for Internet access ({{ iiab_download_url }}/heart-beat.txt)
- name: Test with {{ iiab_wan_iface }} for Internet access ({{ iiab_download_url }}/heart-beat.txt)
get_url:
url: "{{ iiab_download_url }}/heart-beat.txt"
dest: /tmp/heart-beat.txt
@ -209,7 +209,7 @@
value: "{{ gw_active }}"
- option: internet_available
value: "{{ internet_available }}"
- option: is_rpi
- option: rpi_model
value: "{{ rpi_model }}"
- option: first_run
value: "{{ first_run }}"

View file

@ -62,6 +62,15 @@
when: grep_ubermix.rc == 0 # 1 if absent in file, 2 if file doesn't exist
#when: ro_dir.stat.exists
# 2020-03-19: for KA Lite, but moved from roles/kalite/tasks/install.yml
# This effectively does nothing at all on Ubuntu & Raspbian, where libgeos-*
# pkgs are not installed FWIW. But it's included to safeguard us across all
# OS's, in case others OS's like Ubermix later appear. See #1382 for details.
# Removing pkgs libgeos-3.6.2 & libgeos-c1v5 fixed the situation on Ubermix!
- name: Remove libgeos-* pkgs, avoiding KA Lite Django failure on Ubermix
shell: apt -y remove "libgeos-*"
when: grep_ubermix.rc == 0 # 1 if absent in file, 2 if file doesn't exist
- name: SSHD
include_role:
name: sshd
@ -77,19 +86,6 @@
name: openvpn
when: openvpn_install | bool
# for rpi, without rtc, we need time as soon as possible
- name: Install chrony (an NTP package) especially for RPi's lacking RTC
package:
name: chrony
state: present
#TODO: Use regexp filter instead of hard-code ip
- name: Install /etc/chrony.conf from template
template:
src: chrony.conf.j2
dest: /etc/chrony.conf
backup: no
# Debian 10 "Buster" is apparently enabling AppArmor in 2019:
# https://wiki.debian.org/AppArmor/Progress
# https://wiki.debian.org/AppArmor/HowToUse

View file

@ -10,41 +10,47 @@
when: rtc_id is defined and rtc_id != "none"
# RTC requires a change to the device tree (and reboot)
- name: Enable i2c-rtc device (with "dtoverlay=i2c-rtc,{{ rtc_id }}=on" in /boot/config.txt, requires reboot!) if rtc_id is defined and rtc_id != "none"
- name: Enable i2c-rtc device (with "dtoverlay=i2c-rtc,{{ rtc_id }}=on" in /boot/config.txt, requires reboot!) if rtc_id is defined and rtc_id != "none" and is_raspbian
lineinfile:
path: /boot/config.txt
line: "dtoverlay=i2c-rtc,{{ rtc_id }}=on"
state: present
register: rpiconfig # HMMM REGISTER "rpiconfig" IS *COMPLETELY UNUSED* AS OF 2018-11-02
when: rtc_id is defined and rtc_id != "none"
when: rtc_id is defined and rtc_id != "none" and is_raspbian
#- name: Install udev rule /etc/udev/rules.d/92-rtc-i2c.rules from template, to transfer hwclock to system clock at dev creation, if rtc_id != "none"
# template:
# src: 92-rtc-i2c.rules
# dest: /etc/udev/rules.d/92-rtc-i2c.rules
# owner: root
# group: root
# mode: 0644
# when: rtc_id != "none"
- name: Enable i2c-rtc device (with "dtoverlay=i2c-rtc,{{ rtc_id }}=on" in /boot/firmware/config.txt, requires reboot!) if rtc_id is defined and rtc_id != "none" and is_ubuntu
lineinfile:
path: /boot/firmware/usercfg.txt
line: "dtoverlay=i2c-rtc,{{ rtc_id }}=on"
state: present
when: rtc_id is defined and rtc_id != "none" and is_ubuntu
- name: Install latest ntp package
- name: Enable bluetooth in /boot/firmware/syscfg.txt on Ubuntu (needs reboot)
lineinfile:
path: /boot/firmware/syscfg.txt
regexp: '^include*'
line: 'include btcfg.txt'
when: is_ubuntu
- name: 'Ensure packages are installed: dphys-swapfile, fake-hwclock, iw, rfkill'
package:
name: ntp
state: latest
name:
- dphys-swapfile
- fake-hwclock
- iw
- rfkill
state: present
- name: Increase swap file size (to CONF_SWAPSIZE={{ pi_swap_file_size }} in /etc/dphys-swapfile) as kalite pip download fails (debuntu)
- name: Increase swap file size (to CONF_SWAPSIZE={{ pi_swap_file_size }} in /etc/dphys-swapfile) as kalite pip download fails
lineinfile:
path: /etc/dphys-swapfile
regexp: "^CONF_SWAPSIZE"
line: "CONF_SWAPSIZE={{ pi_swap_file_size }}"
when: is_debuntu | bool # Redundant, given raspberry_pi.yml is only run when rpi_model: != "none" Until someone tries a non-debuntu OS on RPi?
- name: Restart swap service "dphys-swapfile" (debuntu)
- name: Restart swap service "dphys-swapfile"
#command: /etc/init.d/dphys-swapfile restart
service: # A rare/legacy service that is NOT systemd
name: dphys-swapfile
state: restarted
when: is_debuntu | bool
- name: Install RPi rootfs resizing (iiab-rpi-max-rootfs.sh) and its systemd service (iiab-rpi-root-resize.service), from templates
template:

View file

@ -1,6 +1,8 @@
- name: "Install ImageMagick package: imagemagick"
package:
name: imagemagick
name:
- imagemagick
- python3-venv
state: present
- name: Allow ImageMagick to read PDFs, per /etc/ImageMagick-6/policy.xml, to create book cover thumbnails

View file

@ -9,7 +9,7 @@
# Info needed to install Gitea:
gitea_version: 1.11.2
gitea_version: 1.11.3
iset_suffixes:
i386: 386
x86_64: amd64

View file

@ -11,6 +11,11 @@
# ignore_errors: yes
# when: is_raspbian | bool
- name: Install python2
package:
name: python2
state: present
- name: Use pip to install KA Lite static to {{ kalite_venv }}
pip:
name: ka-lite-static
@ -23,13 +28,6 @@
#extra_args="--disable-pip-version-check"
when: internet_available | bool
# This effectively does nothing at all on Ubuntu & Raspbian, where libgeos-*
# pkgs are not installed FWIW. But it's included to safeguard us across all
# OS's, in case others OS's like Ubermix later appear. See #1382 for details.
# Removing pkgs libgeos-3.6.2 & libgeos-c1v5 fixed the situation on Ubermix!
- name: Remove libgeos-* pkgs, avoiding KA Lite Django failure on Ubermix
shell: apt -y remove "libgeos-*"
- name: "Install from template: venv wrapper /usr/bin/kalite, systemd unit file kalite-serve.service, Apache's kalite.conf"
template:
backup: no

View file

@ -7,7 +7,7 @@
- name: "Set fact 'kiwix_src_dir: {{ kiwix_version_armhf }}' (armv6l or armv71)"
set_fact:
kiwix_src_dir: "{{ kiwix_version_armhf }}"
when: ansible_machine == "armv7l" or ansible_machine == "armv6l"
when: ansible_machine == "armv7l" or ansible_machine == "armv6l" or ansible_machine == "aarch64"
- name: "Set fact 'kiwix_src_dir: {{ kiwix_version_linux64 }}' (x86_64)"
set_fact:

View file

@ -109,13 +109,13 @@
# make it so number 2 vars should use user_wan_iface but we can cover a single
# wired if dhcp fails the interface should revert to LAN, static address should
# stick around but testing gateway response is not performed.
- name: User wants single wired interface as static or dhcp gateway
set_fact:
user_wan_iface: "{{ discovered_wan_iface }}" # Jan 2018: Holt discovered_lan_iface was UNDEFINED on WiFi-installed
# RPi (when re-running ./iiab-network) so "discovered_wan_iface" is a
# workaround -- please see https://github.com/iiab/iiab/pull/649
# This workaround can and should evolve as IIAB 6.5 matures!
when: num_lan_interfaces == "1" and user_lan_iface == "auto" and user_wan_iface == "auto"
#- name: User wants single wired interface as static or dhcp gateway
# set_fact:
# user_wan_iface: "{{ discovered_wan_iface }}" # Jan 2018: Holt discovered_lan_iface was UNDEFINED on WiFi-installed
# # RPi (when re-running ./iiab-network) so "discovered_wan_iface" is a
# # workaround -- please see https://github.com/iiab/iiab/pull/649
# # This workaround can and should evolve as IIAB 6.5 matures!
# when: num_lan_interfaces == "1" and user_lan_iface == "auto" and user_wan_iface == "auto"
- name: Use old gateway device info if not detected and using static ip
set_fact:
@ -152,14 +152,14 @@
- name: We're hosed no work interfaces
set_fact:
iiab_network_mode: "No_network_found"
when: adapter_count.stdout|int == "0"
when: adapter_count.stdout|int == 0
# well if there ever was a point to tell the user things are FUBAR this is it.
- name: I'm not guessing declare gateway please
set_fact:
iiab_network_mode: "Undetectable_use_local_vars"
iiab_wan_iface: "none"
when: adapter_count.stdout|int >= "5" and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined
when: adapter_count.stdout|int >= 5 and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined
- name: Record IIAB_WAN_DEVICE to {{ iiab_env_file }}
lineinfile:

View file

@ -41,7 +41,7 @@
template:
dest: /etc/network/interfaces.d/iiab
src: network/systemd.j2
when: not is_raspbian (iiab_lan_iface == "br0" or wan_ip != "dhcp" or gui_static_wan_ip == "undefined")
when: not is_raspbian and (iiab_lan_iface == "br0" or wan_ip != "dhcp" or gui_static_wan_ip == "undefined")
- name: Copy the bridge script for RPi
template:

View file

@ -75,7 +75,7 @@
set_fact:
wifi2: "{{ item|trim }}"
discovered_wireless_iface: "{{ item|trim }}"
when: wireless_list2.stdout is defined
when: wireless_list2.stdout is defined and not wireless_list2.stdout == "ap0"
with_items:
- "{{ wireless_list2.stdout_lines }}"
#item|trim != discovered_wan_iface
@ -103,7 +103,7 @@
when: reserved_wifi is defined and discovered_wireless_iface != iiab_wan_iface and num_wifi_interfaces >= "2"
- name: Count LAN ifaces
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }} | wc -l
shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }} | wc -l
register: num_lan_interfaces_result
- name: Calculate number of LAN interfaces including WiFi
@ -112,7 +112,7 @@
# LAN - pick non WAN's
- name: Create list of LAN (non WAN) ifaces
shell: ls /sys/class/net | grep -v -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }}
shell: ls /sys/class/net | grep -v -e ap0 -e wwlan -e ppp -e lo -e br0 -e tun -e br- -e docker -e bridge0 -e veth -e {{ device_gw }} -e {{ ap_device }}
when: num_lan_interfaces != "0"
register: lan_list_result

View file

@ -41,51 +41,49 @@
# https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
- name: Install ffmpeg + libxml2 + 13 php packages
- name: Install ffmpeg + libxml2 + 12 php packages
package:
name:
#- dnsutils # NOT REQUESTED by Nextcloud
- ffmpeg # Optional (for preview generation)
- libxml2 # php-libxml requires libxml2 >= 2.7.0
#- dnsutils # NOT REQUESTED by Nextcloud
- ffmpeg # Optional (for preview generation)
- libxml2 # php-libxml requires libxml2 >= 2.7.0
#- libapache2-mod-php # 2020-02-15: NO LONGER NEEDED?
- php-bz2 # Optional (for extraction of apps)
#- php-cli # NOT REQUESTED by Nextcloud
#- php-common # NOT REQUESTED by Nextcloud
- php-curl
- php-fpm # ALSO INSTALLED IN roles/www_options (Stage 4) for nginx_high_php_limits
- php-gd
- php-gmp # Optional (for SFTP storage)
- php-imagick # Optional (for preview generation)
- php-intl # Optional (increases language translation performance and fixes sorting of non-ASCII characters)
- php-json
#- php-libxml # NOT INSTALLABLE: ENABLED BY DEFAULT (https://www.php.net/manual/en/libxml.installation.php)
- php-mbstring
- php-mysql
#- php-openssl # NOT INSTALLABLE: ENABLED BY DEFAULT?
#- php-pdo_mysql # NOT INSTALLABLE: php-mysql handles this on all OS's?
#- php-redis # @m-anish future work?
#- php-session # NOT INSTALLABLE: ENABLED BY DEFAULT?
- php-smbclient # Optional (SMB/CIFS integration
- php-xml # NOT FORMALLY REQUESTED by Nextcloud (BUT hopefully delivers php-simplexml if not {php-xmlreader, php-xmlwriter} on Raspbian?)
- php-zip
#- php-zlib # NOT INSTALLABLE: ENABLED BY DEFAULT?
- php{{ php_version }}-bz2 # Optional (for extraction of apps)
- php{{ php_version }}-cli # Like optional? @jvonau says this drags in php{{ php_version }}-common as @m-anish wanted in PR #2119 / #2258
- php{{ php_version }}-curl
- php{{ php_version }}-gd
- php{{ php_version }}-gmp # Optional (for SFTP storage)
- php{{ php_version }}-imagick # Optional (for preview generation)
- php{{ php_version }}-intl # Optional (increases language translation performance and fixes sorting of non-ASCII characters)
- php{{ php_version }}-json
#- php{{ php_version }}-libxml # NOT INSTALLABLE: ENABLED BY DEFAULT (https://www.php.net/manual/en/libxml.installation.php)
- php{{ php_version }}-mbstring
- php{{ php_version }}-mysql
#- php{{ php_version }}-openssl # NOT INSTALLABLE: ENABLED BY DEFAULT?
#- php{{ php_version }}-pdo_mysql # NOT INSTALLABLE: php-mysql handles this on all OS's?
#- php{{ php_version }}-redis # @m-anish future work?
#- php{{ php_version }}-session # NOT INSTALLABLE: ENABLED BY DEFAULT?
#- php{{ php_version }}-smbclient # Optional (SMB/CIFS integration)
- php{{ php_version }}-xml # NOT FORMALLY REQUESTED by Nextcloud (BUT hopefully delivers php-simplexml if not {php-xmlreader, php-xmlwriter} on Raspbian?)
- php{{ php_version }}-zip
#- php{{ php_version }}-zlib # NOT INSTALLABLE: ENABLED BY DEFAULT?
state: present
# https://docs.nextcloud.com/server/18/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
- name: Install 9 additional php packages, if OS is not Raspbian (these are not available on Raspbian on RPi, as of Feb 2020)
package:
name:
- php-ctype
- php-dom
- php-exif # Optional (for image rotation in pictures app)
- php-fileinfo # Optional (enhances file analysis performance)
- php-iconv
- php-posix
- php-simplexml
- php-xmlreader
- php-xmlwriter
state: present
when: not is_raspbian
#- name: Install 9 additional php packages, if OS is not Raspbian (these are not available on Raspbian on RPi, as of Feb 2020)
# package:
# name:
# - php{{ php_version }}-ctype
# - php{{ php_version }}-dom
# - php{{ php_version }}-exif # Optional (for image rotation in pictures app)
# - php{{ php_version }}-fileinfo # Optional (enhances file analysis performance)
# - php{{ php_version }}-iconv
# - php{{ php_version }}-posix
# - php{{ php_version }}-simplexml
# - php{{ php_version }}-xmlreader
# - php{{ php_version }}-xmlwriter
# state: present
# when: not is_raspbian
- name: Create dir {{ nextcloud_root_dir }}

View file

@ -11,7 +11,17 @@
group: root
#mode: ????
remote_src: yes
when: is_raspbian | bool
when: ansible_machine == "armv7l"
- name: Unarchive http://download.iiab.io/packages/php{{ php_version }}-stem.aarch64.tar to / (rpi)
unarchive:
src: http://download.iiab.io/packages/php{{ php_version }}-stem.aarch64.tar
dest: /
owner: root
group: root
#mode: ????
remote_src: yes
when: ansible_machine == "aarch64"
- name: Unarchive http://download.iiab.io/packages/php{{ php_version }}-stem.x64.tar to / (x64)
unarchive:

View file

@ -64,21 +64,26 @@ elif [ -f /etc/centos-release ]; then
#elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then
#elif [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then
elif [ -f /etc/debian_version ]; then # Includes Debian, Ubuntu & Raspbian
echo -e "\napt update; install dirmngr; PPA to /etc/apt/sources.list.d/iiab-ansible.list\n"
apt update
apt -y install dirmngr # Raspbian needs. Formerly: python-pip python-setuptools python-wheel patch
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" \
if ! grep -q focal /etc/os-release; then
echo -e "\napt update; install dirmngr; PPA to /etc/apt/sources.list.d/iiab-ansible.list\n"
apt update
apt -y install dirmngr
echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main" \
> /etc/apt/sources.list.d/iiab-ansible.list
echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367"\n'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367
echo -e '\nIF YOU FACE ERROR "signatures couldn'"'"'t be verified because the public key is not available" THEN REPEATEDLY RE-RUN "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367"\n'
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 93C4A3FD7BB9C367
echo -e 'PPA source "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main"'
echo -e "successfully saved to /etc/apt/sources.list.d/iiab-ansible.list\n"
echo -e "IF *OTHER* ANSIBLE SOURCES APPEAR BELOW, PLEASE MANUALLY REMOVE THEM TO"
echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n'
grep '^deb .*ansible' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v '^/etc/apt/sources.list.d/iiab-ansible.list:' || true # Override bash -e (instead of aborting at 1st error)
fi
echo -e "\napt update; apt install ansible and python3 dependencies explained at:"
echo -e "https://github.com/iiab/iiab/tree/master/scripts/ansible.md\n"
apt update
apt -y --allow-downgrades install ansible python3-pymysql python3-psycopg2 \
python3-passlib python3-pip python3-setuptools virtualenv
python3-passlib python3-pip python3-setuptools python3-venv virtualenv
echo -e "\nSUCCESS: verify Ansible using 'ansible --version' and/or 'apt -a list ansible'\n\n"
@ -91,12 +96,6 @@ elif [ -f /etc/debian_version ]; then # Includes Debian, Ubuntu & Raspbian
#wget http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb
#apt -y --allow-downgrades install ./ansible_2.4.2.0-1ppa~xenial_all.deb
echo -e 'PPA source "deb http://ppa.launchpad.net/ansible/ansible/ubuntu bionic main"'
echo -e "successfully saved to /etc/apt/sources.list.d/iiab-ansible.list\n"
echo -e "IF *OTHER* ANSIBLE SOURCES APPEAR BELOW, PLEASE MANUALLY REMOVE THEM TO"
echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n'
grep '^deb .*ansible' /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v '^/etc/apt/sources.list.d/iiab-ansible.list:' || true # Override bash -e (instead of aborting at 1st error)
else
echo -e "\nEXITING: Could not detect your OS (unsupported?)\n"
exit 1

View file

@ -78,7 +78,7 @@ elif [ -f /etc/debian_version ]; then # Includes Debian, Ubuntu & Raspbian
echo -e "https://github.com/iiab/iiab/tree/master/scripts/ansible.md\n"
apt update
apt -y --allow-downgrades install ansible python3-pymysql python3-psycopg2 \
python3-passlib python3-pip python3-setuptools virtualenv
python3-passlib python3-pip python3-setuptools python3-venv virtualenv
echo -e "\nSUCCESS: verify Ansible using 'ansible --version' and/or 'apt -a list ansible'\n\n"

View file

@ -78,7 +78,7 @@ elif [ -f /etc/debian_version ]; then # Includes Debian, Ubuntu & Raspbian
echo -e "https://github.com/iiab/iiab/tree/master/scripts/ansible.md\n"
apt update
apt -y --allow-downgrades install ansible python3-pymysql python3-psycopg2 \
python3-passlib python3-pip python3-setuptools virtualenv
python3-passlib python3-pip python3-setuptools python3-venv virtualenv
echo -e "\nSUCCESS: verify Ansible using 'ansible --version' and/or 'apt -a list ansible'\n\n"

View file

@ -28,6 +28,7 @@ case $OS_VER in
"ubuntu-17" | \
"ubuntu-18" | \
"ubuntu-19" | \
"ubuntu-20" | \
"centos-7" | \
"raspbian-8" | \
"raspbian-9" | \