1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Merge pull request #2190 from holta/avoid-dups

Refine @jvonau's PR #2134 - avoid dependency dups for speed / bugfix
This commit is contained in:
A Holt 2020-01-23 23:47:56 -05:00 committed by GitHub
commit 016b914037
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 118 additions and 120 deletions

View file

@ -123,19 +123,6 @@
# We decided to enable mysql unconditionally.
# when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install
# There might be other db's
- name: Turn on both vars for PostgreSQL if moodle_enabled or pathagar_enabled
set_fact:
postgresql_install: True
postgresql_enabled: True
when: moodle_enabled or (pathagar_enabled is defined and pathagar_enabled)
#- name: Turn on vars for Docker if SchoolTool is to be installed
# set_fact:
# docker_install: True
# docker_enabled: True
# when: schooltool_enabled or schooltool_install
- name: "Set python_path: /lib/python2.7/site-packages/ (redhat)"
set_fact:
python_path: /lib/python2.7/site-packages/

View file

@ -66,26 +66,22 @@
include_role:
name: sshd
# has no "when: XXXXX_install" flag
#tags: base, sshd
- name: IIAB-ADMIN
include_role:
name: iiab-admin
# has no "when: XXXXX_install" flag
#tags: base, iiab-admin
- name: OPENVPN
include_role:
name: openvpn
when: openvpn_install | bool
#tags: openvpn
# 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
#tags: download
#TODO: Use regexp filter instead of hard-code ip
- name: Install /etc/chrony.conf from template

View file

@ -7,13 +7,11 @@
include_role:
name: httpd
when: apache_install | bool
#tags: base, httpd
- name: MYSQL
include_role:
name: mysql
when: mysql_install | bool
#tags: base, mysql
- name: Install NGINX (configured LATER, in Stage 9-LOCAL-ADDONS)
include_tasks: roles/nginx/tasks/install.yml
@ -22,7 +20,6 @@
- name: Install dnsmasq
include_tasks: roles/network/tasks/dnsmasq.yml
when: dnsmasq_install | bool
#tags: base, domain, dnsmasq, network
- name: Recording STAGE 3 HAS COMPLETED =====================
lineinfile:

View file

@ -8,63 +8,41 @@
- name: Install named / BIND
include_tasks: roles/network/tasks/named.yml
when: named_install | bool
#tags: base, named, network, domain
- name: Installing dhcpd
include_tasks: roles/network/tasks/dhcpd.yml
when: dhcpd_install | bool
#tags: base, dhcpd, network, domain
- name: Install Squid (and DansGuardian if dansguardian_install)
include_tasks: roles/network/tasks/squid.yml
when: squid_install | bool
#tags: base, squid, network, domain
- name: Install Bluetooth - only on Raspberry Pi
include_role:
name: bluetooth
when: (is_rpi and bluetooth_install) or bluetooth_installed is defined
#tags: bluetooth
when: is_rpi and bluetooth_install # or bluetooth_installed is defined
- name: USB-LIB
include_role:
name: usb-lib
when: usb_lib_install | bool
#tags: usb-lib
# NETWORK moved to the very end, after Stage 9 (9-LOCAL-ADDONS)
# It can also be run manually using: cd /opt/iiab/iiab; ./iiab-network
#
#- name: NETWORK
# include_role:
# name: network
# # has no "when: XXXXX_install" flag
# tags: base, network
# MANDATORY SO PERHAPS THIS BELONGS IN 3-BASE-SERVER ?
# This is in Stage 4-SERVER-OPTIONS (rather than 3-BASE-SERVER) because var
# iiab_home_url changes, and may need to be re-run in the field/offline/etc.
- name: HOMEPAGE
include_role:
name: homepage
# has no "when: XXXXX_install" flag
#tags: base, homepage
- name: POSTGRESQL
include_role:
name: postgresql
when: postgresql_install | bool
#tags: postgresql, pathagar, moodle
- name: CUPS
include_role:
name: cups
when: cups_install or cups_installed is defined
#tags: cups
when: cups_install # or cups_installed is defined
- name: SAMBA
include_role:
name: samba
when: samba_install or samba_installed is defined
#tags: samba
when: samba_install # or samba_installed is defined
- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed at the beginning of Stage 3 = roles/3-base-server/tasks/main.yml, which ran Apache playbook = roles/httpd/tasks/main.yml)
command: /usr/bin/iiab-refresh-wiki-docs

View file

@ -3,24 +3,23 @@
- name: ...IS BEGINNING =====================================
command: echo
# UNMAINTAINED
- name: ACTIVITY-SERVER
include_role:
name: activity-server
when: activity_server_install | bool
#tags: olpc, activity-server
when: activity_server_install is defined and activity_server_install
# UNMAINTAINED
- name: EJABBERD_XS
include_role:
name: ejabberd_xs
when: ejabberd_xs_install | bool
#tags: olpc, ejabberd-xs
when: ejabberd_xs_install is defined and ejabberd_xs_install
# UNMAINTAINED
- name: IDMGR
include_role:
name: idmgr
when: idmgr_install | bool
#tags: olpc, idmgr
when: idmgr_install is defined and idmgr_install
- name: Recording STAGE 5 HAS COMPLETED =====================
lineinfile:

View file

@ -7,75 +7,63 @@
include_role:
name: azuracast
when: azuracast_install | bool
#tags: azuracast
# UNMAINTAINED
- name: DOKUWIKI
include_role:
name: dokuwiki
when: dokuwiki_install | bool
#tags: dokuwiki
when: dokuwiki_install is defined and dokuwiki_install
# UNMAINTAINED
- name: EJABBERD
include_role:
name: ejabberd
when: ejabberd_install | bool
#tags: ejabberd
when: ejabberd_install is defined and ejabberd_install
- name: ELGG
include_role:
name: elgg
when: elgg_install | bool
#tags: elgg
- name: GITEA
include_role:
name: gitea
when: gitea_install | bool
#tags: gitea
- name: LOKOLE
include_role:
name: lokole
when: lokole_install | bool
#tags: lokole
- name: MEDIAWIKI
include_role:
name: mediawiki
when: mediawiki_install | bool
#tags: mediawiki
- name: MOSQUITTO
include_role:
name: mosquitto
when: mosquitto_install | bool
#tags: mosquitto
- name: NODE-RED
include_role:
name: nodered
when: nodered_install | bool
#tags: nodered
- name: NEXTCLOUD
include_role:
name: nextcloud
when: nextcloud_install | bool
#tags: nextcloud
- name: PBX
include_role:
name: pbx
when: pbx_install | bool
#tags: pbx
- name: WORDPRESS
include_role:
name: wordpress
when: wordpress_install | bool
#tags: wordpress
- name: Recording STAGE 6 HAS COMPLETED ====================
lineinfile:

View file

@ -7,51 +7,43 @@
include_role:
name: kalite
when: kalite_install | bool
#tags: kalite
- name: KOLIBRI
include_role:
name: kolibri
when: kolibri_install | bool
#tags: kolibri
- name: KIWIX
include_role:
name: kiwix
when: kiwix_install | bool
#tags: kiwix
- name: MOODLE
include_role:
name: moodle
when: moodle_install | bool
#tags: olpc, moodle
- name: OSM-VECTOR-MAPS
include_role:
name: osm-vector-maps
when: osm_vector_maps_install | bool
#tags: osm, maps
# UNMAINTAINED
- name: OSM
include_role:
name: osm
when: osm_install is defined and osm_install
#tags: osm, maps
# UNMAINTAINED
- name: PATHAGAR
include_role:
name: pathagar
when: pathagar_install is defined and pathagar_install
#tags: pathagar
- name: SUGARIZER
include_role:
name: sugarizer
when: sugarizer_install | bool
#tags: sugarizer
- name: Recording STAGE 7 HAS COMPLETED ========================
lineinfile:

View file

@ -7,37 +7,31 @@
include_role:
name: transmission
when: transmission_install | bool
#tags: transmission
- name: AWSTATS
include_role:
name: awstats
when: awstats_install | bool
#tags: awstats
- name: MONIT
include_role:
name: monit
when: monit_install | bool
#tags: monit
- name: MUNIN
include_role:
name: munin
when: munin_install | bool
#tags: munin
- name: PHPMYADMIN
include_role:
name: phpmyadmin
when: phpmyadmin_install | bool
#tags: phpmyadmin
- name: VNSTAT
include_role:
name: vnstat
when: vnstat_install | bool
#tags: vnstat
- name: Recording STAGE 8 HAS COMPLETED ======================
lineinfile:

View file

@ -1,3 +1,18 @@
- name: Enable 'postgresql-iiab' systemd service, if moodle_enabled
systemd:
name: postgresql-iiab
state: started
enabled: yes
when: moodle_enabled
# if the only service using the backend db disable if not running
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
systemd:
name: postgresql-iiab
state: stopped
enabled: no
when: not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
# Apache
- name: Enable http://box/moodle via Apache
@ -8,7 +23,7 @@
command: a2dissite 022-moodle.conf
when: apache_install and not moodle_enabled
- name: Restart Apache systemd service ({{ apache_service }})
- name: Restart '{{ apache_service }}' systemd service
systemd:
name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
state: restarted

View file

@ -1,3 +1,12 @@
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
set_fact:
postgresql_install: True
postgresql_enabled: True
- name: POSTGRESQL - run the 'postgresql' role
include_role:
name: postgresql
- name: "Install packages: python-psycopg2, php-pgsql (OS's other than debuntu)"
package:
name:

View file

@ -14,7 +14,6 @@
- php{{ php_version }}-xmlrpc
state: present
when: is_debuntu | bool
#tags: download
- name: Install php{{ php_version }}-xml (ubuntu or debian 9+)
package:
@ -44,15 +43,12 @@
- php-xmlrpc
state: present
when: not is_debuntu
#tags: download
- include_tasks: centos.yml
when: ansible_distribution == "CentOS"
#tags: download
- include_tasks: fedora.yml
when: ansible_distribution == "Fedora"
#tags: download
# 2019-07-03 @jvonau @holta: the next 50 lines (6 stanzas) double MariaDB's
@ -178,6 +174,7 @@
state: stopped
when: not mysql_enabled
- name: Add 'mysql' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"

View file

@ -41,13 +41,22 @@
# /etc/iiab/local_vars.yml -- then re-run this IIAB installer.
# when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stderr == ""
# Forces < 12 or > 12 to be removed, ignored if file is absent
- name: Remove /etc/apt/sources.list.d/nodesource.list if nodejs_version_installed.stdout is not {{ nodejs_version }}
file:
state: absent
path: /etc/apt/sources.list.d/nodesource.list
when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stdout != ""
# BRUTAL but ensures consistency across OS's / distros like Raspbian Desktop & Ubermix that often include an older version of Node.js
# Forces < 12 or > 12 to be uninstalled
- name: ASK apt/yum/dnf TO REMOVE PRE-EXISTING Node.js {{ nodejs_version_installed.stdout }} (IF IT'S NOT {{ nodejs_version }})
package:
name: nodejs
state: absent
when: nodejs_version_installed is defined and nodejs_version_installed.stdout != nodejs_version and nodejs_version_installed.stdout != ""
# Forces == 12
- name: Warn if Node.js {{ nodejs_version}} already installed & might be updated
debug:
msg: "WARN: YOUR Node.js {{ nodejs_version }} MIGHT NOW BE UPDATED USING nodesource.com"
@ -79,6 +88,7 @@
# 19.04 Beta. Comment it out for now, and manually run: "apt install npm" then
# "npm install -g npm@latest" (all *SHOULD* be magically fixed by 2019-04-18 ?)
# Forces update
- name: Install latest Node.js {{ nodejs_version }} which includes /usr/bin/npm (debuntu)
package:
#name: nodejs={{ nodejs_version }}

View file

@ -1,2 +0,0 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: nodered_install | bool }

View file

@ -1,5 +1,10 @@
# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) &
# npm to roles/nodejs/tasks/main.yml, triggered by roles/nodered/meta/main.yml
# npm to roles/nodejs/tasks/main.yml
- name: NODEJS - run the 'nodejs' role
include_role:
name: nodejs
# 2020-01-04 no longer triggered by roles/nodered/meta/main.yml
# BRUTAL but ensures consistency across OS's / distros like Raspbian Desktop &
# Ubermix that often include an older version of Node-RED. Brutal, as this
@ -75,7 +80,7 @@
- name: Install /etc/systemd/system/nodered.service systemd unit file from template
template:
backup: yes
backup: no
src: nodered.service.j2
dest: /etc/systemd/system/nodered.service
# mode: '0666'

View file

@ -1,9 +1,18 @@
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
set_fact:
postgresql_install: True
postgresql_enabled: True
- name: POSTGRESQL - run the 'postgresql' role
include_role:
name: postgresql
- name: Remove package Pathagar (in case rpm?)
package:
name: pathagar
state: absent
- name: Install Pathagar prerequisites (all OSs)
- name: "Install Pathagar prerequisites: python-virtualenv, python-pip, python-psycopg2"
package:
name: "{{ item }}"
state: present
@ -12,7 +21,7 @@
- python-pip
- python-psycopg2
- name: Install Pathagar prerequisites (debuntu)
- name: "Install Pathagar prerequisites: libapache2-mod-wsgi, libxml2-dev, libxslt-dev (debuntu)"
package:
name: "{{ item }}"
state: present
@ -22,7 +31,7 @@
- libxslt-dev
when: is_debuntu | bool
- name: Install Pathagar prerequisites (not debuntu)
- name: "Install Pathagar prerequisites: mod_wsgi, libxml2-devel, libxslt-devel (not debuntu)"
package:
name: "{{ item }}"
state: present
@ -32,21 +41,21 @@
- libxslt-devel
when: not is_debuntu
- name: Create destination folder
- name: "Create destination folder: {{ pathagar_src }}"
file:
path: "{{ pathagar_src }}"
state: directory
owner: root
group: root
mode: 0755
# owner: root
# group: root
# mode: '0755'
- name: Create books destination folder
- name: "Create books destination folder: {{ pathagar_media }}"
file:
path: "{{ pathagar_media }}"
state: directory
owner: "{{ apache_user }}"
group: "{{ apache_user }}"
mode: 0755
mode: '0755'
- name: Determine if Pathagar has already been downloaded from git
stat:
@ -89,10 +98,12 @@
become: yes
become_user: postgres
- name: Start postgresql-iiab
service:
- name: Start 'postgresql-iiab' systemd service
systemd:
name: postgresql-iiab
state: started
enabled: yes
when: pathagar_enabled
- name: Enable Pathagar postgresql user access by md5 method
lineinfile:
@ -106,8 +117,8 @@
group: postgres
register: enable_pathagar_md5_access
- name: Reload postgresql service
service:
- name: Reload 'postgresql-iiab' systemd service
systemd:
name: postgresql-iiab
state: reloaded
when: enable_pathagar_md5_access.changed
@ -126,9 +137,9 @@
template:
src: prod_settings.py
dest: "{{ pathagar_src }}/prod_settings.py"
owner: root
group: root
mode: 0644
# owner: root
# group: root
# mode: '0644'
- name: Create Pathagar initial db
django_manage:
@ -143,7 +154,7 @@
dest: "{{ pathagar_dir }}/auth.User.json"
owner: root
group: root
mode: 0600
mode: '0600'
- name: Load Pathagar admin user
django_manage:
@ -164,35 +175,44 @@
template:
src: wsgi.py
dest: "{{ pathagar_dir }}/wsgi.py"
owner: root
group: root
mode: 0644
# owner: root
# group: root
# mode: '0644'
- name: Install httpd conf for Pathagar
- name: Install /etc/{{ apache_config_dir }}/pathagar.conf from template
template:
src: pathagar.conf
backup: yes
dest: "/etc/{{ apache_config_dir }}/pathagar.conf"
mode: 0644
- name: Enable Pathagar (debuntu)
- name: Enable Pathagar via Apache (debuntu)
file:
path: /etc/apache2/sites-enabled/pathagar.conf
src: /etc/apache2/sites-available/pathagar.conf
state: link
when: pathagar_enabled and is_debuntu
- name: Disable Pathagar (debuntu)
- name: Disable Pathagar via Apache (debuntu)
file:
path: /etc/apache2/sites-enabled/pathagar.conf
state: absent
when: not pathagar_enabled and is_debuntu
- name: Reload Apache ({{ apache_service }})
- name: Reload '{{ apache_service }}' systemd service
systemd:
name: "{{ apache_service }}"
state: reloaded
# if the only service using the backend db disable if not running
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not pathagar_enabled
systemd:
name: postgresql-iiab
state: stopped
enabled: no
when: not moodle_enabled and not pathagar_enabled
- name: Add 'pathagar' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"

View file

@ -1,3 +0,0 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: pbx_install and (nodejs_version == "10.x")}

View file

@ -1,3 +1,7 @@
- name: NODEJS - run the 'nodejs' role
include_role:
name: nodejs
- name: Fail if nodejs_version is incorrect
fail:
msg: >-

View file

@ -1,3 +0,0 @@
dependencies:
- { role: mongodb, tags: ['generic','mongodb'], when: sugarizer_install | bool }
- { role: nodejs, tags: ['nodejs'], when: sugarizer_install | bool }

View file

@ -1,3 +1,4 @@
# auto starts mongodb via the requires= line in unit file
- name: Enable & Restart 'sugarizer' systemd service
systemd:
name: sugarizer
@ -6,6 +7,7 @@
state: restarted
when: sugarizer_enabled | bool
# stops sugarizer but not mongodb
- name: Disable & Stop 'sugarizer' systemd service
systemd:
name: sugarizer
@ -13,6 +15,11 @@
state: stopped
when: not sugarizer_enabled
# stops mongodb would of been called via meta/main.yml prior
- name: Run mongodb/tasks/enable.yml to stop MongoDB, if not sugarizer_enabled
include_tasks: roles/mongodb/tasks/enable.yml
when: not sugarizer_enabled
# Apache
- name: Enable http://box/sugarizer & http://box/sugar via Apache

View file

@ -1,3 +1,11 @@
- name: MONGODB - run the 'mongodb' role
include_role:
name: mongodb
- name: NODEJS - run the 'nodejs' role
include_role:
name: nodejs
- name: FAIL (STOP INSTALLING) IF nodejs_version is not set to 12.x
fail:
msg: "Sugarizer install cannot proceed, as it currently requires Node.js 12.x, and your nodejs_version is set to {{ nodejs_version }}. Please check the value of nodejs_version in /opt/iiab/iiab/vars/default_vars.yml and possibly also /etc/iiab/local_vars.yml"