diff --git a/roles/usb-lib/README.rst b/roles/usb-lib/README.rst index e3ae506cb..98eb7ceff 100644 --- a/roles/usb-lib/README.rst +++ b/roles/usb-lib/README.rst @@ -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+ diff --git a/roles/usb-lib/tasks/main.yml b/roles/usb-lib/tasks/main.yml index f0de224a8..5280440bd 100644 --- a/roles/usb-lib/tasks/main.yml +++ b/roles/usb-lib/tasks/main.yml @@ -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 }}"