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

Merge pull request #57 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2018-02-12 12:44:24 -05:00 committed by GitHub
commit 8d1f9ac651
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 130 additions and 93 deletions

View file

@ -1,6 +1,7 @@
- name: Install AWStats package - name: Install AWStats package
package: name={{ item }} package:
state=present name: "{{ item }}"
state: present
with_items: with_items:
- awstats - awstats
- pwauth - pwauth
@ -9,8 +10,9 @@
- download - download
- name: Install AWStats package (debuntu) - name: Install AWStats package (debuntu)
package: name={{ item }} package:
state=present name: "{{ item }}"
state: present
with_items: with_items:
- libapache2-mod-authnz-external - libapache2-mod-authnz-external
- apache2-utils - apache2-utils
@ -18,74 +20,82 @@
tags: tags:
- download - download
- name: enable cgi execution (debuntu) - name: Enable cgi execution (debuntu)
command: a2enmod cgi command: a2enmod cgi
when: is_debuntu when: is_debuntu
- name: Create directory for AWStats to use as intermediate summary storage - name: Create directory for AWStats to use as intermediate summary storage
file: path={{ item }} file:
mode=0750 path: "{{ item }}"
owner={{ apache_user }} mode: 0750
group={{ apache_user }} owner: "{{ apache_user }}"
state=directory group: "{{ apache_user }}"
force=true state: directory
force: true
with_items: with_items:
- "{{ awstats_data_dir }}" - "{{ awstats_data_dir }}"
- "{{ apache_log_dir }}" - "{{ apache_log_dir }}"
- name: Install the Apache config for AWStats (debuntu) - name: Install the Apache config for AWStats (debuntu)
template: src=apache.conf template:
dest=/etc/{{ apache_config_dir }}/awstats.conf src: apache.conf
owner=root dest: "/etc/{{ apache_config_dir }}/awstats.conf"
group=root owner: root
mode=0644 group: root
mode: 0644
when: awstats_enabled and is_debuntu when: awstats_enabled and is_debuntu
- name: Install the Apache config for AWStats (OS's other than debuntu) - name: Install the Apache config for AWStats (OS's other than debuntu)
template: src=apache-awstats.conf template:
dest=/etc/{{ apache_config_dir }}/awstats.conf src: apache-awstats.conf
owner=root dest: "/etc/{{ apache_config_dir }}/awstats.conf"
group=root owner: root
mode=0644 group: root
mode: 0644
when: awstats_enabled and not is_debuntu when: awstats_enabled and not is_debuntu
- name: make sure logrotate does not make logs unreadable (debuntu) - name: Make sure logrotate does not make logs unreadable (debuntu)
template: src=logrotate.d.apache2 template:
dest=/etc/logrotate.d/apache2 src: logrotate.d.apache2
dest: /etc/logrotate.d/apache2
when: is_debuntu when: is_debuntu
- name: See if awstats package installed a config file - name: See if AWStats package installed a config file
stat: path=/etc/awstats/awstats.conf stat:
path: /etc/awstats/awstats.conf
register: awstats register: awstats
- name: If there was a config file installed by package, move it aside - name: If there was a config file installed by package, move it aside
command: mv /etc/awstats/awstats.conf /etc/awstats/awstats.conf.dist command: mv /etc/awstats/awstats.conf /etc/awstats/awstats.conf.dist
when: awstats.stat.islnk is defined and not awstats.stat.islnk when: awstats.stat.islnk is defined and not awstats.stat.islnk
- name: Enable AWStats (debuntu) - name: Enable AWStats (debuntu)
file: src=/etc/apache2/sites-available/awstats.conf file:
path=/etc/apache2/sites-enabled/awstats.conf src: /etc/apache2/sites-available/awstats.conf
state=link path: /etc/apache2/sites-enabled/awstats.conf
state: link
when: awstats_enabled and is_debuntu when: awstats_enabled and is_debuntu
- name: Disable AWStats (debuntu) - name: Disable AWStats (debuntu)
file: path=/etc/apache2/sites-enabled/awstats.conf file:
state=absent path: /etc/apache2/sites-enabled/awstats.conf
state: absent
when: not awstats_enabled and is_debuntu when: not awstats_enabled and is_debuntu
- name: Install the AWStats config - name: Install the AWStats config
template: src=awstats.schoolserver.conf.j2 template:
dest=/etc/awstats/awstats.schoolserver.conf src: awstats.schoolserver.conf.j2
owner=root dest: /etc/awstats/awstats.schoolserver.conf
group=root owner: root
mode=0644 group: root
mode: 0644
when: awstats_enabled when: awstats_enabled
- name: Create a symbolic link to use when access is by IP address - name: Create a symbolic link to use when access is by IP address
file: src=/etc/awstats/awstats.schoolserver.conf file:
dest=/etc/awstats/awstats.conf src: /etc/awstats/awstats.schoolserver.conf
state=link dest: /etc/awstats/awstats.conf
state: link
when: awstats_enabled when: awstats_enabled
- name: On first enabling of AWStats, summarize httpd logs up to now (OS's other than debuntu) - name: On first enabling of AWStats, summarize httpd logs up to now (OS's other than debuntu)

View file

@ -2,10 +2,11 @@
when: awstats_install when: awstats_install
- name: Add 'awstats' to list of services at /etc/iiab/iiab.ini - name: Add 'awstats' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=awstats dest: "{{ service_filelist }}"
option='{{ item.option }}' section: awstats
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: AWStats value: AWStats

View file

@ -16,9 +16,9 @@
name: "php{{ php_version }}-sqlite" name: "php{{ php_version }}-sqlite"
when: is_debian and ansible_distribution_major_version == "8" when: is_debian and ansible_distribution_major_version == "8"
#- name: Debian changed sqlite name - name: Debian changed sqlite name (debian-9)
# package: name=php{{ php_version }}-sqlite3 package: name=php{{ php_version }}-sqlite3
# when: ansible_local.local_facts.os_ver == "debian-9" when: is_debian and ansible_distribution_major_version == "9"
- name: Install httpd required packages (ubuntu) - name: Install httpd required packages (ubuntu)
package: package:

View file

@ -1,16 +1,26 @@
============== ==============
USB Lib README usb-lib README
============== ==============
This role implements Library Box type functionality to mount and link content on a USB drive. PLEASE SEE "Can teachers display their own content?" WITHIN http://FAQ.IIAB.IO FOR UP-TO-DATE DOCUMENTATION.
Automount is handled by usbmount and scripts in this role look in the root of the mounted drive for This role implements functionality similar to LibraryBox, to mount "teacher content" from USB drives.
Users should have nearly immediate access to this "teacher content" (on all inserted USB drives) by browsing to http://box/usb
Automount is handled by usbmount, and scripts in this role look in the root of the mounted drive for...
* /usb
* /USB
* /share * /share
* /Share * /Share
* /PirateShare * /Piratebox/Share
and if found create a symlink of the form /library/content/USBn points to /media/usbn. ...and if found, creates a symlink of the form /library/www/html/local_content/USBn pointing to /media/usbn.
USB drives must be formatted with one of the filesystems listed under "FILESYSTEMS=" at /etc/usbmount/usbmount.conf
WARNING: even if you manually add "exfat ntfs fuseblk" within the above line, problems remain automounting exFAT and NTFS filesystems using usbmount, as of February 2018. It's recommended you stick to FAT32 and ext4 filesystems for now.
There is also a patch for problems with automount on Fedora 21+ There is also a patch for problems with automount on Fedora 21+

View file

@ -1,67 +1,77 @@
- name: Add a content directory for links to be located - name: Add a content directory for links to be located
file: dest={{ doc_root }}/local_content file:
state=directory dest: "{{ doc_root }}/local_content"
owner={{ apache_user }} state: directory
group={{ iiab_admin_user }} owner: "{{ apache_user }}"
mode=0775 group: "{{ iiab_admin_user }}"
mode: 0775
- name: Copy mount file to usbmount when enabled - name: Copy mount file to usbmount when enabled
template: src=mount.d/70-usb-library template:
dest=/etc/usbmount/mount.d/ src: mount.d/70-usb-library
owner=root dest: /etc/usbmount/mount.d/
group=root owner: root
mode=0751 group: root
mode: 0751
when: usb_lib_enabled when: usb_lib_enabled
- name: Copy umount file to usbmount when enabled - name: Copy umount file to usbmount when enabled
template: src=umount.d/70-usb-library template:
dest=/etc/usbmount/umount.d src: umount.d/70-usb-library
owner=root dest: /etc/usbmount/umount.d
group=root owner: root
mode=0751 group: root
mode: 0751
when: usb_lib_enabled when: usb_lib_enabled
- name: Remove mount file to usbmount when not enabled - name: Remove mount file to usbmount when not enabled
file: path=/etc/usbmount/mount.d/70-usb-library file:
state=absent path: /etc/usbmount/mount.d/70-usb-library
state: absent
when: not usb_lib_enabled when: not usb_lib_enabled
- name: Remove umount file to usbmount when not enabled - name: Remove umount file to usbmount when not enabled
file: path=/etc/usbmount/umount.d/70-usb-library file:
state=absent path: /etc/usbmount/umount.d/70-usb-library
state: absent
when: not usb_lib_enabled when: not usb_lib_enabled
- name: Add Apache config for content directory - name: Add Apache config for content directory
template: src=content_dir.conf template:
dest=/etc/{{ apache_config_dir }} src: content_dir.conf
dest: "/etc/{{ apache_config_dir }}"
when: usb_lib_enabled when: usb_lib_enabled
- name: Create the link to enable for Debian - name: Create the link to enable (debian)
file: src=/etc/{{ apache_config_dir }}/content_dir.conf file:
dest=/etc/apache2/sites-enabled/content_dir.conf src: "/etc/{{ apache_config_dir }}/content_dir.conf"
state=link dest: /etc/apache2/sites-enabled/content_dir.conf
state: link
when: is_debuntu when: is_debuntu
- name: Remove the link that enables in Debian - name: Remove the link that enables (debian)
file: src=/etc/{{ apache_config_dir }}/content_dir.conf file:
dest=/etc/apache2/sites-enabled/content_dir.conf src: "/etc/{{ apache_config_dir }}/content_dir.conf"
state=absent dest: /etc/apache2/sites-enabled/content_dir.conf
state: absent
when: is_debuntu and not usb_lib_enabled when: is_debuntu and not usb_lib_enabled
- name: Remove Apache config for content directory - name: Remove Apache config for content directory
file: name=/etc/{{ apache_config_dir }}/content_dir.conf file:
state=absent name: "/etc/{{ apache_config_dir }}/content_dir.conf"
state: absent
when: not usb_lib_enabled when: not usb_lib_enabled
- name: Add usb-lib to service list - name: Add usb-lib to service list
ini_file: dest='{{ service_filelist }}' ini_file:
section=usb-lib dest: "{{ service_filelist }}"
option='{{ item.option }}' section: usb-lib
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: usb-lib value: usb-lib
- option: description - option: description
value: '"usb-lib automounts USB drives and can live-link /library/www/html/local_content to Teachers Content."' value: '"usb-lib automounts Teacher Content on USB drives to /library/www/html/local_content, so students can browse it almost immediately at http://box/usb"'
- option: enabled - option: enabled
value: "{{ usb_lib_enabled }}" value: "{{ usb_lib_enabled }}"

View file

@ -3,7 +3,7 @@
# Installs or upgrades to the best possible Ansible release, so iiab-install # Installs or upgrades to the best possible Ansible release, so iiab-install
# can proceed. Ensure you're online before running this script! # can proceed. Ensure you're online before running this script!
GOOD_VER="2.4.3" # Ansible version for OLPC, for pip. GOOD_VER="2.4.2" # Ansible version for OLPC, for pip.
# On other OS's we install/upgrade to the latest Ansible. # On other OS's we install/upgrade to the latest Ansible.
# Pin all to 2.4.x in future, if really/truly nec? # Pin all to 2.4.x in future, if really/truly nec?
CURR_VER="undefined" CURR_VER="undefined"
@ -20,7 +20,7 @@ if ! which ansible-playbook ; then
yum -y install ca-certificates nss epel-release yum -y install ca-certificates nss epel-release
yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python
yum -y install python-pip python-setuptools python-wheel patch yum -y install python-pip python-setuptools python-wheel patch
yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.3.0-1.el7.ans.noarch.rpm yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.2.0-1.el7.ans.noarch.rpm
# FOUND="true" # FOUND="true"
# FAMILY="redhat" # FAMILY="redhat"
# elif [ -f /etc/fedora-release ]; then # elif [ -f /etc/fedora-release ]; then
@ -80,9 +80,15 @@ else
fi fi
if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then
echo "Using apt to check for updates, then install/upgrade ansible" # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669
apt update echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb"
apt -y install ansible cd /tmp
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
# UNCOMMENT THE FOLLOWING 3 LINES IF ANSIBLE'S LATEST RELEASES IMPROVE
#echo "Using apt to check for updates, then install/upgrade ansible"
#apt update
#apt -y install ansible
fi fi
# needed? # needed?