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

View file

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

View file

@ -1,67 +1,77 @@
- name: Add a content directory for links to be located
file: dest={{ doc_root }}/local_content
state=directory
owner={{ apache_user }}
group={{ iiab_admin_user }}
mode=0775
file:
dest: "{{ doc_root }}/local_content"
state: directory
owner: "{{ apache_user }}"
group: "{{ iiab_admin_user }}"
mode: 0775
- name: Copy mount file to usbmount when enabled
template: src=mount.d/70-usb-library
dest=/etc/usbmount/mount.d/
owner=root
group=root
mode=0751
template:
src: mount.d/70-usb-library
dest: /etc/usbmount/mount.d/
owner: root
group: root
mode: 0751
when: usb_lib_enabled
- name: Copy umount file to usbmount when enabled
template: src=umount.d/70-usb-library
dest=/etc/usbmount/umount.d
owner=root
group=root
mode=0751
template:
src: umount.d/70-usb-library
dest: /etc/usbmount/umount.d
owner: root
group: root
mode: 0751
when: usb_lib_enabled
- name: Remove mount file to usbmount when not enabled
file: path=/etc/usbmount/mount.d/70-usb-library
state=absent
file:
path: /etc/usbmount/mount.d/70-usb-library
state: absent
when: not usb_lib_enabled
- name: Remove umount file to usbmount when not enabled
file: path=/etc/usbmount/umount.d/70-usb-library
state=absent
file:
path: /etc/usbmount/umount.d/70-usb-library
state: absent
when: not usb_lib_enabled
- name: Add Apache config for content directory
template: src=content_dir.conf
dest=/etc/{{ apache_config_dir }}
template:
src: content_dir.conf
dest: "/etc/{{ apache_config_dir }}"
when: usb_lib_enabled
- name: Create the link to enable for Debian
file: src=/etc/{{ apache_config_dir }}/content_dir.conf
dest=/etc/apache2/sites-enabled/content_dir.conf
state=link
- name: Create the link to enable (debian)
file:
src: "/etc/{{ apache_config_dir }}/content_dir.conf"
dest: /etc/apache2/sites-enabled/content_dir.conf
state: link
when: is_debuntu
- name: Remove the link that enables in Debian
file: src=/etc/{{ apache_config_dir }}/content_dir.conf
dest=/etc/apache2/sites-enabled/content_dir.conf
state=absent
- name: Remove the link that enables (debian)
file:
src: "/etc/{{ apache_config_dir }}/content_dir.conf"
dest: /etc/apache2/sites-enabled/content_dir.conf
state: absent
when: is_debuntu and not usb_lib_enabled
- name: Remove Apache config for content directory
file: name=/etc/{{ apache_config_dir }}/content_dir.conf
state=absent
file:
name: "/etc/{{ apache_config_dir }}/content_dir.conf"
state: absent
when: not usb_lib_enabled
- name: Add usb-lib to service list
ini_file: dest='{{ service_filelist }}'
section=usb-lib
option='{{ item.option }}'
value='{{ item.value }}'
ini_file:
dest: "{{ service_filelist }}"
section: usb-lib
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: usb-lib
- 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
value: "{{ usb_lib_enabled }}"

View file

@ -3,7 +3,7 @@
# Installs or upgrades to the best possible Ansible release, so iiab-install
# 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.
# Pin all to 2.4.x in future, if really/truly nec?
CURR_VER="undefined"
@ -20,7 +20,7 @@ if ! which ansible-playbook ; then
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 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"
# FAMILY="redhat"
# elif [ -f /etc/fedora-release ]; then
@ -80,9 +80,15 @@ else
fi
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"
apt update
apt -y install ansible
# TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669
echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb"
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
# needed?