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

Merge pull request #415 from iiab/master

Sync from iiab/iiab:master
This commit is contained in:
A Holt 2020-09-01 21:03:02 -04:00 committed by GitHub
commit 42b5018200
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 291 additions and 217 deletions

View file

@ -14,12 +14,6 @@
state: present state: present
when: is_redhat | bool when: is_redhat | bool
- name: Install {{ iiab_download_url }}/usbmount_0.0.14.1_all.deb, missing from Debian (debian-9 or debian-10, if NOT rpi)
apt:
deb: "{{ iiab_download_url }}/usbmount_0.0.14.1_all.deb"
#timeout: "{{ download_timeout }}" # Ansible's apt module doesn't support timeout parameter; that's ok as usbmount_0.0.14.1_all.deb is only 10KB
when: internet_available and (is_debian_9 or is_debian_10) and not is_raspbian
- name: "Install 6 deb/apt packages: avahi-daemon, exfat-fuse, exfat-utils, inetutils-syslogd, libnss-mdns, wpasupplicant (debuntu)" - name: "Install 6 deb/apt packages: avahi-daemon, exfat-fuse, exfat-utils, inetutils-syslogd, libnss-mdns, wpasupplicant (debuntu)"
package: package:
name: name:
@ -60,7 +54,6 @@
- sudo - sudo
- tar - tar
- unzip - unzip
- usbmount
- usbutils - usbutils
- wget - wget
state: present state: present

View file

@ -8,9 +8,9 @@
name: mysql name: mysql
when: mysql_install | bool when: mysql_install | bool
# 2020-05-21: Apache role 'httpd' is installed as nec by any of these 6 roles: # 2020-05-21: Apache role 'httpd' is installed as nec by any of these 7 roles:
# #
# cups, elgg, lokole, moodle, nodered, phpmyadmin # cups, elgg, lokole, moodle, nodered, pbx, phpmyadmin
# #
# These 14 roles conditionally touch /etc/apache2/sites-available/*.conf files: # These 14 roles conditionally touch /etc/apache2/sites-available/*.conf files:
# #

View file

@ -1,13 +1,5 @@
# 1. INSTALL MongoDB PACKAGES OR BINARIES # 1. INSTALL MongoDB PACKAGES OR BINARIES
- name: "Install packages: mongodb, mongodb-server (not raspbian)"
package:
name:
- mongodb-server
- mongodb # 2019-01-31: this package does not exist on (cannot be installed on) Debian 10, SEE #1437
state: present
when: internet_available and not is_raspbian
# 2019-02-02: Sugarizer with Node.js 10.x requires MongoDB 2.6+ so # 2019-02-02: Sugarizer with Node.js 10.x requires MongoDB 2.6+ so
# https://andyfelong.com/2017/08/mongodb-3-0-14-for-raspbian-stretch/ is # https://andyfelong.com/2017/08/mongodb-3-0-14-for-raspbian-stretch/ is
# being used on Raspbian, all I found! (Raspbian's apt pkg is MongoDB 2.4.14) # being used on Raspbian, all I found! (Raspbian's apt pkg is MongoDB 2.4.14)
@ -18,86 +10,105 @@
# CLARIF: mongodb_stretch_3_0_14_core.zip IS IN FACT 3.0.14 (core) BUT... # CLARIF: mongodb_stretch_3_0_14_core.zip IS IN FACT 3.0.14 (core) BUT...
# mongodb_stretch_3_0_14_tools.zip IS REALLY 3.0.15 (tools) # mongodb_stretch_3_0_14_tools.zip IS REALLY 3.0.15 (tools)
- name: Create dir /tmp/mongodb-3.0.1x (raspbian) - block:
- name: Create dir /tmp/mongodb-3.0.1x (aarch32)
file: file:
path: /tmp/mongodb-3.0.1x path: /tmp/mongodb-3.0.1x
state: directory state: directory
when: internet_available and is_raspbian
- name: Download & unzip 20MB http://download.iiab.io/packages/mongodb_stretch_3_0_14_core.zip to /tmp/mongodb-3.0.1x (raspbian) - name: Download & unzip 20MB http://download.iiab.io/packages/mongodb_stretch_3_0_14_core.zip to /tmp/mongodb-3.0.1x (aarch32)
unarchive: unarchive:
remote_src: yes remote_src: yes
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip" src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip"
dest: /tmp/mongodb-3.0.1x dest: /tmp/mongodb-3.0.1x
when: internet_available and is_raspbian
- name: Install (move) its 3 CORE binaries from /tmp/mongodb-3.0.1x/core to /usr/bin (raspbian) - name: Install (move) its 3 CORE binaries from /tmp/mongodb-3.0.1x/core to /usr/bin (aarch32)
shell: mv /tmp/mongodb-3.0.1x/core/* /usr/bin shell: mv /tmp/mongodb-3.0.1x/core/* /usr/bin
when: internet_available and is_raspbian
- name: Download & unzip 15MB http://download.iiab.io/packages/mongodb_stretch_3_0_14_tools.zip [IN FACT THIS ONE'S 3.0.15] to /tmp/mongodb-3.0.1x (raspbian) - name: Download & unzip 15MB http://download.iiab.io/packages/mongodb_stretch_3_0_14_tools.zip [IN FACT THIS ONE'S 3.0.15] to /tmp/mongodb-3.0.1x (aarch32)
unarchive: unarchive:
remote_src: yes remote_src: yes
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip" src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
dest: /tmp/mongodb-3.0.1x dest: /tmp/mongodb-3.0.1x
when: internet_available and is_raspbian
- name: Install (move) its 9 TOOLS binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (raspbian) - name: Install (move) its 9 TOOLS binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (aarch32)
shell: mv /tmp/mongodb-3.0.1x/tools/* /usr/bin shell: mv /tmp/mongodb-3.0.1x/tools/* /usr/bin
when: internet_available and is_raspbian
# OLD WAY / MUCH SLOWER: had put unnec duplicate copies in /opt/iiab/downloads/mongodb-3.0.1x - name: Create Linux group mongodb (aarch32)
#
#- name: Create dir /opt/iiab/downloads/mongodb-3.0.1x (raspbian)
# file:
# path: "{{ downloads_dir }}/mongodb-3.0.1x"
# state: directory
# when: internet_available and is_raspbian
#
#- name: Download & unzip MongoDB 3.0.14's 3 core binaries to /opt/iiab/downloads/mongodb-3.0.1x (raspbian)
# unarchive:
# remote_src: yes
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip"
# dest: "{{ downloads_dir }}/mongodb-3.0.1x"
# when: internet_available and is_raspbian
#
#- name: Install (copy) 3 binaries from /opt/iiab/downloads/mongodb-3.0.1x/core to /usr/bin (raspbian)
# copy:
# src: "{{ item }}"
# dest: /usr/bin
# with_fileglob:
# - "{{ downloads_dir }}/mongodb-3.0.1x/core/*"
# when: internet_available and is_raspbian
#
#- name: Download & unzip MongoDB 3.0.15's 9 tools binaries to /opt/iiab/downloads/mongodb-3.0.1x (raspbian)
# unarchive:
# remote_src: yes
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
# dest: "{{ downloads_dir }}/mongodb-3.0.1x"
# when: internet_available and is_raspbian
#
#- name: Install (copy) 9 binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (raspbian)
# copy:
# src: "{{ item }}"
# dest: /usr/bin
# with_fileglob:
# - "{{ downloads_dir }}/mongodb-3.0.1x/tools/*"
# when: internet_available and is_raspbian
- name: Create Linux group mongodb (raspbian)
group: group:
name: mongodb name: mongodb
state: present state: present
when: is_raspbian | bool
- name: Create Linux user mongodb (raspbian) - name: Create Linux user mongodb (aarch32)
user: user:
name: mongodb name: mongodb
group: mongodb # primary group group: mongodb # primary group
groups: mongodb groups: mongodb
home: /var/lib/mongodb home: /var/lib/mongodb
shell: /usr/sbin/nologin shell: /usr/sbin/nologin
when: is_raspbian | bool
- name: Install /etc/mongod.conf from template (aarch32)
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: "{{ item.mode }}"
with_items:
- { src: 'mongod.conf.j2', dest: "{{ mongodb_conf }}", mode: '0644' } # i.e. /etc/mongod.conf
# end block
when: not (ansible_architecture == "x86_64" or ansible_architecture == "aarch64")
# 32 bit OS's get caught above should handle aarch32 including 32-bit ubuntu
# from https://ubuntu.com/download/raspberry-pi. 20.4-32bit might fail untested
# 32bit intel might puke as this was orginally deployed for raspbian. Haven't
# see bootable 32bit intel installers for a while now.
# 64 bit OS's proceed below.
- block:
- name: Add mongodb.org signing key (only 64-bit support available)
shell: wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
args:
warn: false
- name: Add mongodb repo for Debian 10 (only amd64 support available)
apt_repository:
repo: deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main
state: present
filename: mongodb-org
when: is_debian_10 and (ansible_architecture == "x86_64")
# Debian 10 aarch64 might work below but is blocked in main.yml
- name: Add mongodb repo for RaspOS-aarch64
apt_repository:
repo: deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse
state: present
filename: mongodb-org
when: (ansible_architecture == "aarch64" and is_raspbian_10)
- name: Add mongodb repo for Ubuntu 64bit only
apt_repository:
repo: deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/4.4 multiverse
state: present
filename: mongodb-org
when: is_ubuntu
- name: "Install packages: mongodb-org, mongodb-org-server"
package:
name:
- mongodb-org
- mongodb-org-server
state: present
- name: Change the mongodb port to 27018
lineinfile:
path: /etc/mongod.conf
regexp: 'port: 27017'
backrefs: yes
line: ' port: 27018'
# end block
when: (ansible_architecture == "aarch64") or (ansible_architecture == "x86_64")
# 2. CONFIGURE MongoDB FOR IIAB # 2. CONFIGURE MongoDB FOR IIAB
@ -114,7 +125,7 @@
- /var/log/mongodb - /var/log/mongodb
- "{{ mongodb_db_path }}" # i.e. /library/dbdata/mongodb/ - "{{ mongodb_db_path }}" # i.e. /library/dbdata/mongodb/
- name: Install /etc/mongod.conf, mongodb.service, /usr/bin/iiab-mongodb-repair-if-no-lock from templates - name: Install mongodb.service, /usr/bin/iiab-mongodb-repair-if-no-lock from templates
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
@ -122,10 +133,17 @@
group: root group: root
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: with_items:
- { src: 'mongod.conf.j2', dest: "{{ mongodb_conf }}", mode: '0644' } # i.e. /etc/mongod.conf
- { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' } - { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' }
- { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' } - { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' }
# daemon_reload is used to force systemd to recognize a newly installed .service file
# restarted here to ensure the port has been changed
- name: Disable 'mongodb' systemd service - started on demand by sugarizer
systemd:
name: mongodb
daemon_reload: yes
enabled: no
state: restarted
# 3. RECORD MongoDB AS INSTALLED # 3. RECORD MongoDB AS INSTALLED

View file

@ -31,24 +31,38 @@
- debug: - debug:
var: is_raspbian var: is_raspbian
- name: EXIT 'mongodb' ROLE & CONTINUE, IF 'is_debian and not is_raspbian' i.e. TRUE DEBIAN (where MongoDB no longer exists) # might be able to lift this once we know using bionic would work
- name: EXIT 'mongodb' ROLE & CONTINUE, IF 'is_debian_10 and aarch64 and not is_raspbian' i.e. TRUE DEBIAN with arch64
fail: # FORCE IT RED THIS ONCE! fail: # FORCE IT RED THIS ONCE!
msg: ATTEMPTED MongoDB INSTALLATION WITH (TRUE) DEBIAN, which is no longer supported. Nevertheless IIAB will continue (consider this a warning!) msg: ATTEMPTED MongoDB INSTALLATION WITH (TRUE) DEBIAN aarch64, which is not supported upstream. Nevertheless IIAB will continue (consider this a warning!)
when: is_debian and not is_raspbian when: (ansible_architecture == "aarch64") and is_debian_10 and not is_raspbian
#when: (is_debian and not is_raspbian) and (not is_debian_8) and (not is_debian_9) # Test for Debian 10+
ignore_errors: yes ignore_errors: yes
# ELSE... # ELSE...
- name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: install.yml
when: mongodb_installed is undefined and not (ansible_architecture == "aarch64" and is_debian_10 and not is_raspbian)
- name: Install/Enable/Disable/Record MongoDB (main2.yml) if is_raspbian or not is_debian, i.e. not True Debian - name: Disable & Stop 'mongodb' service, if not mongodb_enabled
include_tasks: main2.yml systemd:
when: is_raspbian or not is_debian name: mongodb
enabled: no
state: stopped
when: not mongodb_enabled and mongodb_installed is defined
# THE block: APPROACH BELOW WORKS JUST LIKE main2.yml ABOVE. #'mongodb' systemd service - started on demand by sugarizer
# BUT IT VISUALLY POLLUTES: MANY BLUE "skipping:" MESSAGES IN ANSIBLE'S OUTPUT. # Just recording that mongodb should be running
# - block: # ENTIRE BLOCK CONDITIONED ON 'when: is_raspbian or not is_debian' - name: Add 'mongodb' variable values to {{ iiab_ini_file }}
# ini_file:
# [MOVED TO main2.yml] path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
# section: mongodb
# when: is_raspbian or not is_debian # CONDITION FOR ENTIRE ABOVE block: option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: name
value: MongoDB
- option: description
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
- option: enabled
value: "{{ mongodb_enabled }}"

View file

@ -1,34 +0,0 @@
- name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
include_tasks: install.yml
when: mongodb_installed is undefined
- name: Enable & Restart 'mongodb' systemd service if mongodb_enabled, incl daemon-reload (in case mongodb.service changed?)
systemd:
name: mongodb
daemon_reload: yes
enabled: yes
state: restarted
when: mongodb_enabled | bool
- name: Disable & Stop 'mongodb' service, if not mongodb_enabled
systemd:
name: mongodb
enabled: no
state: stopped
when: not mongodb_enabled
- name: Add 'mongodb' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}" # /etc/iiab/iiab.ini
section: mongodb
option: "{{ item.option }}"
value: "{{ item.value | string }}"
with_items:
- option: name
value: MongoDB
- option: description
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
- option: enabled
value: "{{ mongodb_enabled }}"

View file

@ -45,8 +45,8 @@
* kalite (menu goes directly to ports 8006-8008) * kalite (menu goes directly to ports 8006-8008)
* minetest [*] * minetest [*]
* openvpn * openvpn
* pbx [*, requires Apache for now, as in Section 3.] * pbx [*, requires Apache for now, as in Section iii.]
* phpmyadmin [*, requires Apache for now, as in Section 3.] * phpmyadmin [*, requires Apache for now, as in Section iii.]
* transmission [*] * transmission [*]
[*] The 6 above starred roles could use improvement, as of 2020-08-24. [*] The 6 above starred roles could use improvement, as of 2020-08-24.

View file

@ -89,6 +89,17 @@
dest: '{{ vector_map_path }}/installer/detail.mbtiles' dest: '{{ vector_map_path }}/installer/detail.mbtiles'
state: link state: link
- name: Link to the World Map to zoom 6
file:
src: '{{ vector_map_path }}/installer/planet_z0-z6_2019.mbtiles'
dest: '{{ vector_map_path }}/viewer/tiles/planet_z0-z6_2019.mbtiles'
state: link
- name: Copy the map abbreviated satellite images
get_url:
url: "{{ map_catalog_url }}/satellite_z0-z6_v3.mbtiles"
dest: '{{ vector_map_path }}/viewer/tiles/satellite_z0-z6_v3.mbtiles'
- name: Fetch the javascript bundle for map installer - name: Fetch the javascript bundle for map installer
get_url: get_url:
url: "{{ osm_repo_url }}/{{ maps_branch }}/osm-source/pages/installer/build/{{ item }}" url: "{{ osm_repo_url }}/{{ maps_branch }}/osm-source/pages/installer/build/{{ item }}"
@ -181,10 +192,6 @@
- iiab-make-init.py - iiab-make-init.py
- iiab-update-map - iiab-update-map
- name: Install the World Map to zoom 10
shell: iiab-install-map-region
when: osm_vector_maps_enabled | bool
- name: Install /etc/nginx/osm-vector-maps-nginx.conf from template - name: Install /etc/nginx/osm-vector-maps-nginx.conf from template
template: template:
src: osm-vector-maps-nginx.conf.j2 src: osm-vector-maps-nginx.conf.j2

View file

@ -14,7 +14,7 @@
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml # All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing! # If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
pbx_installed: False #pbx_installed: False
asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/ asterisk_url: http://downloads.asterisk.org/pub/telephony/asterisk/
asterisk_src_file: asterisk-16-current.tar.gz asterisk_src_file: asterisk-16-current.tar.gz

View file

@ -37,6 +37,11 @@
src: "roles/pbx/templates/71-freepbx-framework.patch" src: "roles/pbx/templates/71-freepbx-framework.patch"
dest: "{{ freepbx_src_dir }}/amp_conf/htdocs/admin/libraries/BMO/Framework.class.php" dest: "{{ freepbx_src_dir }}/amp_conf/htdocs/admin/libraries/BMO/Framework.class.php"
- name: FreePBX - Patch FreePBX source - wants [] not {}
patch:
src: "roles/pbx/templates/pbx.patch"
dest: "{{ freepbx_src_dir }}/amp_conf/htdocs/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php"
- name: FreePBX - Disable & Stop asterisk service - name: FreePBX - Disable & Stop asterisk service
systemd: systemd:
daemon_reload: yes daemon_reload: yes
@ -97,13 +102,21 @@
recurse: yes recurse: yes
- name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER! - name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER!
command: "{{ item }}" command: ./start_asterisk start
args: args:
chdir: "{{ freepbx_src_dir }}" chdir: "{{ freepbx_src_dir }}"
creates: "{{ freepbx_install_dir }}" creates: "{{ freepbx_install_dir }}"
with_items:
- ./start_asterisk start - name: FreePBX - Install (just run once) - CAN TAKE 12 MIN OR LONGER!
- ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }} command: ./install -n --webroot {{ freepbx_install_dir }} --dbuser {{ asterisk_db_user }} --dbpass {{ asterisk_db_password }} --dbname {{ asterisk_db_dbname }} --cdrdbname {{ asterisk_db_cdrdbname }}
args:
chdir: "{{ freepbx_src_dir }}"
creates: "{{ freepbx_install_dir }}"
- name: FreePBX - Patch FreePBX source - disable get_magic_quotes_gpc()
patch:
src: "roles/pbx/templates/pbx2.patch"
dest: "{{ freepbx_install_dir }}/freepbx/admin/libraries/view.functions.php"
- name: FreePBX - Create /etc/odbc.ini - name: FreePBX - Create /etc/odbc.ini
template: template:
@ -117,29 +130,16 @@
template: template:
src: freepbx.conf.j2 src: freepbx.conf.j2
dest: /etc/apache2/sites-available/freepbx.conf dest: /etc/apache2/sites-available/freepbx.conf
owner: {{ apache_user }} owner: "{{ apache_user }}"
group: {{ apache_user }} group: "{{ apache_user }}"
mode: '0644' mode: '0644'
- name: FreePBX - Enable http://box:{{ pbx_http_port }} via Apache, if pbx_enabled # http://box:83
command: a2ensite freepbx.conf
when: apache_installed and pbx_enabled
- name: FreePBX - Disable http://box:{{ pbx_http_port }} via Apache, if not pbx_enabled # http://box:83
command: a2dissite freepbx.conf
when: apache_installed and not pbx_enabled
- name: FreePBX - Add {{ pbx_http_port }} as a Listen directive to apache ports.conf - name: FreePBX - Add {{ pbx_http_port }} as a Listen directive to apache ports.conf
lineinfile: lineinfile:
path: /etc/apache2/ports.conf path: /etc/apache2/ports.conf
line: "Listen {{ pbx_http_port }}" line: "Listen {{ pbx_http_port }}"
insertafter: Listen 80 insertafter: Listen 80
- name: FreePBX - Restart Apache service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # httpd or apache2
state: restarted
- name: FreePBX - Install /etc/systemd/system/freepbx.service systemd unit file from template - name: FreePBX - Install /etc/systemd/system/freepbx.service systemd unit file from template
template: template:
src: freepbx.service.j2 src: freepbx.service.j2

View file

@ -16,7 +16,7 @@
- php-mbstring - php-mbstring
- php-gd - php-gd
- php-mysql - php-mysql
- php-gettext # - php-gettext
- php-bcmath - php-bcmath
- php-zip - php-zip
- php-xml - php-xml

View file

@ -13,3 +13,16 @@
enabled: no enabled: no
state: stopped state: stopped
when: not pbx_enabled when: not pbx_enabled
- name: FreePBX - Enable http://box:{{ pbx_http_port }} via Apache, if pbx_enabled # http://box:83
command: a2ensite freepbx.conf
when: pbx_enabled | bool
- name: FreePBX - Disable http://box:{{ pbx_http_port }} via Apache, if not pbx_enabled # http://box:83
command: a2dissite freepbx.conf
when: not pbx_enabled
- name: FreePBX - Restart Apache service ({{ apache_service }})
systemd:
name: "{{ apache_service }}" # httpd or apache2
state: restarted

View file

@ -15,8 +15,16 @@
- name: FAIL (STOP THE INSTALL) IF 'nodejs_version != "10.x"' - name: FAIL (STOP THE INSTALL) IF 'nodejs_version != "10.x"'
fail: fail:
msg: "PBX install cannot proceed, as it currently requires Node.js 10.x, whereas nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml, /etc/iiab/local_vars.yml, /opt/iiab/iiab/roles/nodejs, etc." msg: "PBX install cannot proceed, as it currently requires Node.js 10.x, whereas nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml, /etc/iiab/local_vars.yml, /opt/iiab/iiab/roles/nodejs, etc."
when: nodejs_version != "10.x" when: nodejs_version != "12.x"
- name: "Set 'apache_install: True' and 'apache_enabled: True'"
set_fact:
apache_install: True
apache_enabled: True
- name: APACHE - run 'httpd' role
include_role:
name: httpd
#- name: TODO: Check if asterisk and freepbx are already installed #- name: TODO: Check if asterisk and freepbx are already installed
@ -40,24 +48,14 @@
- name: Install Asterisk (debuntu) - name: Install Asterisk (debuntu)
include_tasks: asterisk.yml include_tasks: asterisk.yml
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu and (not freepbx_installed.stat.exists) when: internet_available and pbx_install and (pbx_installed is undefined) and is_debuntu and (not freepbx_installed.stat.exists)
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) #when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
- name: Install FreePBX (debuntu) - name: Install FreePBX (debuntu)
include_tasks: freepbx.yml include_tasks: freepbx.yml
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu and (not freepbx_installed.stat.exists) when: internet_available and pbx_install and (pbx_installed is undefined) and is_debuntu and (not freepbx_installed.stat.exists)
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) #when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
- name: Enable FreePBX (debuntu)
include_tasks: freepbx_enable.yml
when: internet_available and pbx_install and (not pbx_installed) and is_debuntu
#when: internet_available and pbx_install and (not pbx_installed) and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18)
- name: Asterisk - Install chan_dongle
include: chan_dongle.yml
when: asterisk_chan_dongle | bool
# RECORD PBX AS INSTALLED # RECORD PBX AS INSTALLED

View file

@ -23,6 +23,13 @@
include_tasks: install.yml include_tasks: install.yml
when: pbx_installed is undefined when: pbx_installed is undefined
- name: Enable FreePBX (debuntu)
include_tasks: freepbx_enable.yml
when: pbx_installed is defined
- name: Asterisk - Install chan_dongle
include: chan_dongle.yml
when: asterisk_chan_dongle | bool
- name: Add 'pbx' variable values to {{ iiab_ini_file }} - name: Add 'pbx' variable values to {{ iiab_ini_file }}
ini_file: ini_file:

View file

@ -0,0 +1,18 @@
--- /opt/iiab/freepbx/amp_conf/htdocs/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php.orig 2020-08-24 08:52:41.291376894 +0000
+++ /opt/iiab/freepbx/amp_conf/htdocs/admin/libraries/Composer/vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php 2020-08-24 08:55:36.429818838 +0000
@@ -193,11 +193,11 @@
$buf = "";
for($i = 0; $i < $max; $i++){
- $c1 = $text{$i};
+ $c1 = $text[$i];
if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
- $c2 = $i+1 >= $max? "\x00" : $text{$i+1};
- $c3 = $i+2 >= $max? "\x00" : $text{$i+2};
- $c4 = $i+3 >= $max? "\x00" : $text{$i+3};
+ $c2 = $i+1 >= $max? "\x00" : $text[$i+1];
+ $c3 = $i+2 >= $max? "\x00" : $text[$i+2];
+ $c4 = $i+3 >= $max? "\x00" : $text[$i+3];
if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
$buf .= $c1 . $c2;

View file

@ -0,0 +1,19 @@
--- /var/www/html/freepbx/admin/libraries/view.functions.php.orig 2020-08-24 11:14:51.551433838 +0000
+++ /var/www/html/freepbx/admin/libraries/view.functions.php 2020-08-24 11:14:30.207107776 +0000
@@ -12,11 +12,11 @@
// send error if magic_quotes_gpc is enabled on this system as much of the code base assumes not
//
- if(get_magic_quotes_gpc()) {
- $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
- } else {
- $nt->delete('core', 'MQGPC');
- }
+ //if(get_magic_quotes_gpc()) {
+ // $nt->add_error('core', 'MQGPC', _("Magic Quotes GPC"), _("You have magic_quotes_gpc enabled in your php.ini, http or .htaccess file which will cause errors in some modules. FreePBX expects this to be off and runs under that assumption"));
+ //} else {
+ // $nt->delete('core', 'MQGPC');
+ //}
}
// setup locale

View file

@ -80,6 +80,21 @@
state: stopped state: stopped
enabled: no enabled: no
- name: Disable & Stop stock 'postgresql@11-main.service' systemd service - debian-10
systemd:
name: postgresql@11-main.service
state: stopped
enabled: no
# when: is_debian_10
when: is_debian_10 and not is_raspbian
- name: Disable & Stop stock 'postgresql@' systemd service - debian-10
systemd:
name: postgresql@
enabled: no
# when: is_debian_10
when: is_debian_10 and not is_raspbian
# RECORD PostgreSQL AS INSTALLED # RECORD PostgreSQL AS INSTALLED

View file

@ -22,12 +22,18 @@
# 3 stanzas moved up from install.yml, so Debian finishes "BIG" IIAB install: # 3 stanzas moved up from install.yml, so Debian finishes "BIG" IIAB install:
# (WITH LOUD RED WARNINGS!) # (WITH LOUD RED WARNINGS!)
- name: "Set 'mongodb_install: True' and 'mongodb_enabled: True'" # If we got here sugarizer_install is True
- name: "Set 'mongodb_install: True'"
set_fact: set_fact:
mongodb_install: True mongodb_install: True
mongodb_enabled: True
- name: MONGODB - run 'mongodb' role (attempt to install & enable MongoDB) # auto started by sugarizer.service just to record that mongodb should be running
- name: "Set 'mongodb_enabled: True' when sugarizer_enabled"
set_fact:
mongodb_enabled: True
when: sugarizer_enabled
- name: MONGODB - run 'mongodb' role (attempt to install MongoDB)
include_role: include_role:
name: mongodb name: mongodb

View file

@ -18,27 +18,13 @@
when: sugarizer_enabled | bool # CONDITION FOR 2-STANZA block: ABOVE when: sugarizer_enabled | bool # CONDITION FOR 2-STANZA block: ABOVE
- block: # 3 STANZAS BELOW, CONDITIONED ON 'when: not sugarizer_enabled'
# Stops 'sugarizer' but not 'mongodb' # Stops 'sugarizer' but not 'mongodb'
- name: Disable & Stop 'sugarizer' systemd service, if not sugarizer_enabled - name: Disable & Stop 'sugarizer' systemd service, if not sugarizer_enabled
systemd: systemd:
name: sugarizer name: sugarizer
enabled: no enabled: no
state: stopped state: stopped
when: not sugarizer_enabled
# Disable & Stop 'mongodb' via 2 stanzas below
# (meta/main.yml did this in the past)
- name: "Set 'mongodb_enabled: False' if not sugarizer_enabled"
set_fact:
mongodb_enabled: False
- name: MONGODB - run 'mongodb' role, to Disable & Stop MongoDB, if not sugarizer_enabled
include_role:
name: mongodb
when: not sugarizer_enabled # CONDITION FOR 3-STANZA block: ABOVE
- name: Enable/Disable/Restart Apache if primary - name: Enable/Disable/Restart Apache if primary
include_tasks: apache.yml include_tasks: apache.yml

View file

@ -1,3 +1,16 @@
#http://raspbian.raspberrypi.org/raspbian/pool/main/u/usbmount/usbmount_0.0.22_all.deb
- name: Install {{ iiab_download_url }}/usbmount_0.0.22_all.deb, missing from Debian
apt:
deb: "{{ iiab_download_url }}/usbmount_0.0.22_all.deb"
when: is_debian
# check status of usbmount on mintlinux - should be ok Ubuntu variant
- name: Install usbmount from OS repo for Ubuntu variants
package:
name: usbmount
state: present
when: is_ubuntu
- name: Add dir {{ doc_root }}/local_content, where USB drive links can appear - name: Add dir {{ doc_root }}/local_content, where USB drive links can appear
file: file:
state: directory state: directory

View file

@ -85,15 +85,16 @@ elif [ -f /etc/debian_version ]; then # Includes Debian, Ubuntu & Raspbian
echo -e 'ENSURE ANSIBLE UPDATES CLEANLY: (then re-run this script to be sure!)\n' 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) 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 fi
if [ -f /etc/rpi-issue ]; then # 2020-08-25: Let's revert to RaspiOS's own /etc/apt/sources.list for 64-bit RaspiOS etc
# 2020-06-06: https://www.raspberrypi.org/forums/viewtopic.php?t=276340 #if [ -f /etc/rpi-issue ]; then
echo -e "\nAdd a mirror to /etc/apt/sources.list if Raspberry Pi OS, which can be flaky..." # # 2020-06-06: https://www.raspberrypi.org/forums/viewtopic.php?t=276340
mv --no-clobber /etc/apt/sources.list /etc/apt/sources.list.old || true # echo -e "\nAdd a mirror to /etc/apt/sources.list if Raspberry Pi OS, which can be flaky..."
echo -e "deb http://mirror.us.leaseweb.net/raspbian/raspbian buster main contrib non-free rpi" > /etc/apt/sources.list # mv --no-clobber /etc/apt/sources.list /etc/apt/sources.list.old || true
echo -e "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" >> /etc/apt/sources.list # echo -e "deb http://mirror.us.leaseweb.net/raspbian/raspbian buster main contrib non-free rpi" > /etc/apt/sources.list
echo -e "# Uncomment line below then 'apt-get update' to enable 'apt-get source'" >> /etc/apt/sources.list # echo -e "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" >> /etc/apt/sources.list
echo -e "#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" >> /etc/apt/sources.list # echo -e "# Uncomment line below then 'apt-get update' to enable 'apt-get source'" >> /etc/apt/sources.list
fi # echo -e "#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" >> /etc/apt/sources.list
#fi
echo -e "\napt update; apt install ansible and python3 dependencies explained at:" 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" echo -e "https://github.com/iiab/iiab/tree/master/scripts/ansible.md\n"
$APT_PATH/apt update $APT_PATH/apt update

View file

@ -297,7 +297,7 @@ moodle_enabled: True
# Regional OSM vector maps use far less disk space than bitmap/raster versions. # Regional OSM vector maps use far less disk space than bitmap/raster versions.
# Instructions: https://github.com/iiab/iiab/wiki/IIAB-Maps # Instructions: https://github.com/iiab/iiab/wiki/IIAB-Maps
osm_vector_maps_install: True osm_vector_maps_install: True
osm_vector_maps_enabled: False osm_vector_maps_enabled: True
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957 # Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957
@ -333,8 +333,8 @@ awstats_install: True
awstats_enabled: True awstats_enabled: True
# 2019-07-08 WARNING: both vars are IGNORED on Debian 10+ due to: github.com/iiab/iiab/issues/1849 # 2019-07-08 WARNING: both vars are IGNORED on Debian 10+ due to: github.com/iiab/iiab/issues/1849
monit_install: True monit_install: False
monit_enabled: True monit_enabled: False
munin_install: True munin_install: True
munin_enabled: True munin_enabled: True

View file

@ -297,7 +297,7 @@ moodle_enabled: False
# Regional OSM vector maps use far less disk space than bitmap/raster versions. # Regional OSM vector maps use far less disk space than bitmap/raster versions.
# Instructions: https://github.com/iiab/iiab/wiki/IIAB-Maps # Instructions: https://github.com/iiab/iiab/wiki/IIAB-Maps
osm_vector_maps_install: True osm_vector_maps_install: True
osm_vector_maps_enabled: False osm_vector_maps_enabled: True
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957 # Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957

View file

@ -297,7 +297,7 @@ moodle_enabled: False
# Regional OSM vector maps use far less disk space than bitmap/raster versions. # Regional OSM vector maps use far less disk space than bitmap/raster versions.
# Instructions: https://github.com/iiab/iiab/wiki/IIAB-Maps # Instructions: https://github.com/iiab/iiab/wiki/IIAB-Maps
osm_vector_maps_install: True osm_vector_maps_install: True
osm_vector_maps_enabled: False osm_vector_maps_enabled: True
# Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879 # Might stall MongoDB on Power Failure: github.com/xsce/xsce/issues/879
# Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957 # Sugarizer 1.0.1+ strategies to solve? github.com/iiab/iiab/pull/957