mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	
						commit
						717425791d
					
				
					 14 changed files with 76 additions and 41 deletions
				
			
		| 
						 | 
				
			
			@ -3,16 +3,16 @@
 | 
			
		|||
# RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST
 | 
			
		||||
- name: Install Calibre via calibre-installer.py (redhat, ubuntu, debian if NOT calibre_debs_on_debian)
 | 
			
		||||
  include_tasks: py-installer.yml
 | 
			
		||||
  when: is_redhat or (is_ubuntu and not is_ubuntu_18) or (is_debian and not calibre_debs_on_debian)
 | 
			
		||||
  when: is_redhat or is_ubuntu or (is_debian and not calibre_debs_on_debian)
 | 
			
		||||
  #when: not is_rpi
 | 
			
		||||
 | 
			
		||||
- name: Install Calibre via .debs (Raspbian, Debian if calibre_debs_on_debian)
 | 
			
		||||
  include_tasks: debs.yml
 | 
			
		||||
  when: is_rpi or (is_debian and calibre_debs_on_debian)
 | 
			
		||||
 | 
			
		||||
- name: Install Calibre via .debs (Ubuntu 18.xx)
 | 
			
		||||
  include_tasks: debs.yml
 | 
			
		||||
  when: is_ubuntu_18
 | 
			
		||||
#- name: Install Calibre via .debs (Ubuntu 18.xx)
 | 
			
		||||
#  include_tasks: debs.yml
 | 
			
		||||
#  when: is_ubuntu_18
 | 
			
		||||
 | 
			
		||||
- name: Create calibre-serve.service and calibre.conf
 | 
			
		||||
  template:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
moodle_version: 31
 | 
			
		||||
moodle_repo_url: "https://github.com/moodle/moodle.git"
 | 
			
		||||
moodle_version: 35
 | 
			
		||||
#moodle_repo_url: "https://github.com/moodle/moodle.git"
 | 
			
		||||
moodle_repo_url: "git://git.moodle.org/moodle.git"
 | 
			
		||||
moodle_base: "{{ iiab_base }}/moodle"
 | 
			
		||||
moodle_user: moodle
 | 
			
		||||
moodle_install: True
 | 
			
		||||
moodle_enabled: False
 | 
			
		||||
#moodle_user: moodle
 | 
			
		||||
#moodle_install: True
 | 
			
		||||
#moodle_enabled: False
 | 
			
		||||
moodle_data: '{{ content_base }}/moodle'
 | 
			
		||||
moodle_database_name: moodle
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
---
 | 
			
		||||
- name: Install Moodle required packages (OS's other than debunt)
 | 
			
		||||
- name: Install Moodle required packages (OS's other than debuntu)
 | 
			
		||||
  package:
 | 
			
		||||
    name: "{{ item }}"
 | 
			
		||||
    state: present
 | 
			
		||||
| 
						 | 
				
			
			@ -16,10 +15,10 @@
 | 
			
		|||
    - python-psycopg2
 | 
			
		||||
    - php{{ php_version }}-pgsql
 | 
			
		||||
    - php{{ php_version }}-curl
 | 
			
		||||
#    - php{{ php_version }}-zip
 | 
			
		||||
    #- php{{ php_version }}-zip
 | 
			
		||||
    - php{{ php_version }}-gd
 | 
			
		||||
#    - php{{ php_version }}-mbstring
 | 
			
		||||
# mbstring is now included in php-cli
 | 
			
		||||
    #- php{{ php_version }}-mbstring
 | 
			
		||||
    # mbstring is now included in php-cli
 | 
			
		||||
    - php{{ php_version }}-cli
 | 
			
		||||
  when: is_debuntu
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -44,8 +43,9 @@
 | 
			
		|||
    dest: "{{ moodle_base }}"
 | 
			
		||||
    depth: 1
 | 
			
		||||
    force: yes
 | 
			
		||||
    version: "MOODLE_{{ moodle_version }}_STABLE"
 | 
			
		||||
#  ignore_errors: yes
 | 
			
		||||
    #version: "MOODLE_{{ moodle_version }}_STABLE"
 | 
			
		||||
    version: master   # TEMPORARY DURING MAY 2018 TESTING
 | 
			
		||||
  #ignore_errors: yes
 | 
			
		||||
  when: internet_available and moodle.stat.exists is defined and not moodle.stat.exists
 | 
			
		||||
 | 
			
		||||
- name: Prepare the downloaded directory so Apache can install config file
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +70,7 @@
 | 
			
		|||
    mode: 0770
 | 
			
		||||
    state: directory
 | 
			
		||||
 | 
			
		||||
- name: Remove stock Moodle conf
 | 
			
		||||
- name: Remove stock Moodle config file
 | 
			
		||||
  file:
 | 
			
		||||
    path: "/etc/{{ apache_config_dir }}/moodle.conf"
 | 
			
		||||
    state: absent
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +106,7 @@
 | 
			
		|||
  postgresql_user:
 | 
			
		||||
    name: Admin
 | 
			
		||||
    password: changeme
 | 
			
		||||
    encrypted: yes   # Required by PostgresSQL 10.3+ e.g. on Ubuntu 18.04, see https://github.com/iiab/iiab/issues/759
 | 
			
		||||
    encrypted: yes   # Required by PostgreSQL 10+ e.g. Ubuntu 18.04's PostgreSQL 10.3+, see https://github.com/iiab/iiab/issues/759
 | 
			
		||||
    role_attr_flags: NOSUPERUSER,NOCREATEROLE,NOCREATEDB
 | 
			
		||||
    state: present
 | 
			
		||||
  become: yes
 | 
			
		||||
| 
						 | 
				
			
			@ -114,7 +114,7 @@
 | 
			
		|||
 | 
			
		||||
- name: Create database
 | 
			
		||||
  postgresql_db:
 | 
			
		||||
    name: moodle
 | 
			
		||||
    name: "{{ moodle_database_name }}"
 | 
			
		||||
    encoding: utf8
 | 
			
		||||
    owner: Admin
 | 
			
		||||
    template: template1
 | 
			
		||||
| 
						 | 
				
			
			@ -140,7 +140,7 @@
 | 
			
		|||
    name: "{{ apache_service }}"
 | 
			
		||||
    state: restarted
 | 
			
		||||
 | 
			
		||||
- name: See if the config.php file exists
 | 
			
		||||
- name: See if config.php exists
 | 
			
		||||
  stat:
 | 
			
		||||
    path: "{{ moodle_base }}/config.php"
 | 
			
		||||
  register: config
 | 
			
		||||
| 
						 | 
				
			
			@ -150,7 +150,7 @@
 | 
			
		|||
  when: config.stat.exists is defined and not config.stat.exists
 | 
			
		||||
 | 
			
		||||
- name: Give Apache permission to read config file
 | 
			
		||||
#  command: chown -R {{ apache_user }} {{ moodle_base }}
 | 
			
		||||
  #command: chown -R {{ apache_user }} {{ moodle_base }}
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ moodle_base }}/config.php"
 | 
			
		||||
    mode: 0644
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,22 @@
 | 
			
		|||
#!/bin/bash -x
 | 
			
		||||
sudo -u {{ apache_user }} /usr/bin/php {{ moodle_base }}/admin/cli/install.php \
 | 
			
		||||
--wwwroot=http://{{ iiab_hostname }}.{{ iiab_domain }}/moodle --dataroot={{ moodle_data }} \
 | 
			
		||||
--dbtype=pgsql --dbname={{ moodle_database_name }} --dbuser=Admin --dbpass=changeme \
 | 
			
		||||
--fullname=Your_School --shortname=School \
 | 
			
		||||
--adminuser=admin --adminpass=changeme \
 | 
			
		||||
--non-interactive --agree-license
 | 
			
		||||
chown {{ apache_user }}:{{ apache_user }} {{ moodle_base }}/config.php
 | 
			
		||||
 | 
			
		||||
# May 2018: lowercase "--adminuser=admin" is still required for some odd
 | 
			
		||||
# reason, otherwise one cannot login to http://box.lan/moodle (with
 | 
			
		||||
# Admin/changeme).  At the same time --dbuser=Admin still begins with
 | 
			
		||||
# a capital letter, in keeping with Internet-in-a-Box's other server apps?
 | 
			
		||||
 | 
			
		||||
sudo -u {{ apache_user }} \
 | 
			
		||||
     /usr/bin/php {{ moodle_base }}/admin/cli/install.php \
 | 
			
		||||
     --wwwroot=http://{{ iiab_hostname }}.{{ iiab_domain }}/moodle \
 | 
			
		||||
     --dataroot={{ moodle_data }} \
 | 
			
		||||
     --dbtype=pgsql \
 | 
			
		||||
     --dbname={{ moodle_database_name }} \
 | 
			
		||||
     --dbuser=Admin --dbpass=changeme \
 | 
			
		||||
     --fullname=Your_School \
 | 
			
		||||
     --shortname=School \
 | 
			
		||||
     --adminuser=admin --adminpass=changeme \
 | 
			
		||||
     --non-interactive \
 | 
			
		||||
     --agree-license \
 | 
			
		||||
     --allow-unstable   # TEMPORARY DURING MAY 2018 TESTING
 | 
			
		||||
 | 
			
		||||
chown {{ apache_user }}:{{ apache_user }} {{ moodle_base }}/config.php
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,8 +19,8 @@ discovered_wired_iface: "none"
 | 
			
		|||
discovered_wireless_iface: "none"
 | 
			
		||||
 | 
			
		||||
#Redhat
 | 
			
		||||
iiab_wired_lan_iface: "none"
 | 
			
		||||
iiab_wireless_lan_iface: "none"
 | 
			
		||||
#iiab_wired_lan_iface: "none"
 | 
			
		||||
#iiab_wireless_lan_iface: "none"
 | 
			
		||||
has_WAN: False
 | 
			
		||||
has_ifcfg_gw: "none"
 | 
			
		||||
has_wifi_gw: "none"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,12 @@
 | 
			
		|||
    src: network/bridge-br0
 | 
			
		||||
    mode: 0600
 | 
			
		||||
 | 
			
		||||
- name: Remove br0 in Appliance Mode for NetworkManager
 | 
			
		||||
  file:
 | 
			
		||||
    dest: /etc/NetworkManager/system-connections/bridge-br0
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: iiab_network_mode == "Appliance"
 | 
			
		||||
 | 
			
		||||
- name: Stop wpa_supplicant service
 | 
			
		||||
  service:
 | 
			
		||||
    name: wpa_supplicant
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,12 @@
 | 
			
		|||
           state=stopped
 | 
			
		||||
  when: is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Disable stock dhcp_service ipv6
 | 
			
		||||
  service: name={{ dhcp_service }}6
 | 
			
		||||
           enabled=no
 | 
			
		||||
           state=stopped
 | 
			
		||||
  when: is_ubuntu_18
 | 
			
		||||
 | 
			
		||||
- name: Install systemd unit file to /etc/systemd/system/dhcpd.service
 | 
			
		||||
  template: src={{ item.src }}
 | 
			
		||||
            dest={{ item.dest }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,7 +106,7 @@
 | 
			
		|||
 | 
			
		||||
- name: NetworkManager in use
 | 
			
		||||
  include_tasks: NM-debian.yml
 | 
			
		||||
  when: is_debuntu and network_manager_active
 | 
			
		||||
  when: is_ubuntu_18 and network_manager_active
 | 
			
		||||
#and not installing
 | 
			
		||||
  tags:
 | 
			
		||||
    - network
 | 
			
		||||
| 
						 | 
				
			
			@ -127,7 +127,7 @@
 | 
			
		|||
 | 
			
		||||
- name: Not RPi, Not NetworkManager, Not systemd-networkd in use
 | 
			
		||||
  include_tasks: debian.yml
 | 
			
		||||
  when: not is_rpi and not network_manager_active and not systemd_networkd_active and is_debuntu
 | 
			
		||||
  when: (not is_rpi and not network_manager_active and not systemd_networkd_active and is_debuntu) or is_ubuntu_16
 | 
			
		||||
#and not installing
 | 
			
		||||
  tags:
 | 
			
		||||
    - network
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,21 +3,31 @@
 | 
			
		|||
  template:
 | 
			
		||||
    dest: /etc/systemd/network/IIAB-Bridge.netdev
 | 
			
		||||
    src: network/systemd-br0.j2
 | 
			
		||||
  when: iiab_lan_iface == "br0"
 | 
			
		||||
 | 
			
		||||
- name: Copy the bridge script - Assigns IP address
 | 
			
		||||
  template:
 | 
			
		||||
    dest: /etc/systemd/network/IIAB-Bridge.network
 | 
			
		||||
    src: network/systemd-br0-network.j2
 | 
			
		||||
  when: iiab_lan_iface == "br0"
 | 
			
		||||
 | 
			
		||||
- name: Copy the bridge script - Assigns br0 wired slaves
 | 
			
		||||
  template:
 | 
			
		||||
    dest: /etc/systemd/network/IIAB-Slave.network
 | 
			
		||||
    src: network/systemd-br0-slave.j2
 | 
			
		||||
  when: iiab_wired_lan_iface is defined
 | 
			
		||||
  when: iiab_wired_lan_iface is defined and iiab_lan_iface == "br0"
 | 
			
		||||
 | 
			
		||||
- name: Stopping services
 | 
			
		||||
  include_tasks: down-debian.yml
 | 
			
		||||
 | 
			
		||||
- name: Disable and mask systemd-networkd-wait-online
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: systemd-networkd-wait-online
 | 
			
		||||
    enabled: no
 | 
			
		||||
    masked: yes
 | 
			
		||||
    state: stopped
 | 
			
		||||
  when: is_ubuntu_18
 | 
			
		||||
 | 
			
		||||
- name: Reload systemd
 | 
			
		||||
  systemd:
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
[Unit]
 | 
			
		||||
Description=DHCPv4 Server Daemon
 | 
			
		||||
After=network-online.target
 | 
			
		||||
After=multi-user.target
 | 
			
		||||
Requires=multi-user.target
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
EnvironmentFile=/etc/sysconfig/dhcpd
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
[Unit]
 | 
			
		||||
Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
 | 
			
		||||
After=rc-local.service
 | 
			
		||||
After=network-online.target
 | 
			
		||||
 | 
			
		||||
[Service]
 | 
			
		||||
Type=idle
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,13 +3,9 @@
 | 
			
		|||
Name=br0
 | 
			
		||||
 | 
			
		||||
[Network]
 | 
			
		||||
Bridge=br0
 | 
			
		||||
Address={{ lan_ip }}/19
 | 
			
		||||
LinkLocalAddressing=no
 | 
			
		||||
DNS={{ lan_ip }}
 | 
			
		||||
Domains={{ iiab_domain }}
 | 
			
		||||
 | 
			
		||||
[Address]
 | 
			
		||||
Address={{ lan_ip }}/19
 | 
			
		||||
 | 
			
		||||
[Route]
 | 
			
		||||
Gateway=""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -383,6 +383,7 @@ xovis_chart_heading: "My School: Usage Data Visualization"
 | 
			
		|||
# wide to narrow
 | 
			
		||||
is_debuntu: False
 | 
			
		||||
is_ubuntu: False
 | 
			
		||||
is_ubuntu_16: False
 | 
			
		||||
is_ubuntu_18: False
 | 
			
		||||
is_debian: False
 | 
			
		||||
is_debian_9: False
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
is_debuntu: True
 | 
			
		||||
is_ubuntu: True
 | 
			
		||||
is_ubuntu_16: True
 | 
			
		||||
dns_service: bind9
 | 
			
		||||
dns_user: bind
 | 
			
		||||
dhcp_service: isc-dhcp-server
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue