1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/usb-lib/tasks/main.yml

100 lines
3.4 KiB
YAML
Raw Normal View History

2018-10-31 04:20:01 +00:00
- name: Add dir {{ doc_root }}/local_content, where USB drive links can appear
file:
2018-10-31 04:20:01 +00:00
path: "{{ doc_root }}/local_content"
state: directory
owner: "{{ apache_user }}"
2018-10-15 08:06:01 +00:00
group: "{{ iiab_admin_user }}" # ISN'T "{{ apache_user }}" MORE APPROPRIATE?
mode: 0775
2017-05-27 18:09:50 +00:00
2018-10-31 04:20:01 +00:00
- name: Install /etc/usbmount/mount.d/70-usb-library from template
template:
src: mount.d/70-usb-library
dest: /etc/usbmount/mount.d/
owner: root
group: root
mode: 0751
when: usb_lib_enabled | bool
2017-05-27 18:09:50 +00:00
2018-10-31 04:20:01 +00:00
- name: 'Install from template: /etc/udev/rules.d/usbmount.rules, /etc/systemd/system/usbmount@.service, /usr/bin/iiab-usb-lib-show-all-on, /usr/bin/iiab-usb-lib-show-all-off'
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
2018-03-13 19:06:12 +00:00
mode: "{{ item.mode }}"
with_items:
2018-03-13 19:06:12 +00:00
- { src: 'usbmount@.service.j2' , dest: '/etc/systemd/system/usbmount@.service', mode: '0644' }
- { src: 'usbmount.rules.j2' , dest: '/etc/udev/rules.d/usbmount.rules', mode: '0644' }
- { src: 'iiab-usb-lib-show-all-on' , dest: '/usr/bin/', mode: '0755' }
- { src: 'iiab-usb-lib-show-all-off' , dest: '/usr/bin/', mode: '0755' }
2018-10-31 04:20:01 +00:00
- name: Enable exFAT and NTFS in /etc/usbmount/usbmount.conf
2018-02-15 00:47:38 +00:00
lineinfile:
regexp: '^FILESYSTEMS.*'
line: 'FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus exfat fuseblk ntfs"'
2018-10-31 04:20:01 +00:00
path: /etc/usbmount/usbmount.conf
2018-02-15 00:47:38 +00:00
2018-10-31 04:20:01 +00:00
- name: Install /etc/usbmount/umount.d/70-usb-library from template
template:
src: umount.d/70-usb-library
dest: /etc/usbmount/umount.d
owner: root
group: root
mode: 0751
when: usb_lib_enabled | bool
2017-05-27 18:09:50 +00:00
2018-10-31 04:20:01 +00:00
- name: Remove /etc/usbmount/mount.d/70-usb-library if not usb_lib_enabled
file:
path: /etc/usbmount/mount.d/70-usb-library
state: absent
2017-05-27 18:09:50 +00:00
when: not usb_lib_enabled
2018-10-31 04:20:01 +00:00
- name: Remove /etc/usbmount/umount.d/70-usb-library if not usb_lib_enabled
file:
path: /etc/usbmount/umount.d/70-usb-library
state: absent
2017-05-27 18:09:50 +00:00
when: not usb_lib_enabled
2018-07-19 03:25:32 +00:00
- name: Put variable in iiab.env that enables display of content at root of USB
lineinfile:
2018-10-31 04:20:01 +00:00
path: "{{ iiab_env_file }}"
regexp: "^IIAB_USB_LIB_SHOW_ALL.*"
line: "IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }}"
2018-10-31 04:20:01 +00:00
- name: Install /etc/{{ apache_config_dir }}/content_dir.conf from template
template:
src: content_dir.conf
dest: "/etc/{{ apache_config_dir }}"
when: usb_lib_enabled | bool
2017-05-27 18:09:50 +00:00
2018-10-31 04:20:01 +00:00
- name: Create symlink content_dir.conf from sites-enabled to sites-available (debuntu)
file:
src: "/etc/{{ apache_config_dir }}/content_dir.conf"
dest: /etc/apache2/sites-enabled/content_dir.conf
state: link
when: is_debuntu | bool
2018-10-31 04:20:01 +00:00
- name: Remove symlink content_dir.conf from /etc/apache2/sites-enabled (debuntu)
file:
dest: /etc/apache2/sites-enabled/content_dir.conf
state: absent
2017-05-27 23:10:45 +00:00
when: is_debuntu and not usb_lib_enabled
2018-10-31 04:20:01 +00:00
- name: Remove content_dir.conf from /etc/{{ apache_config_dir }}
file:
name: "/etc/{{ apache_config_dir }}/content_dir.conf"
state: absent
when: not usb_lib_enabled
2017-05-27 18:09:50 +00:00
2018-10-31 04:20:01 +00:00
- name: Add 'usb-lib' variable values to {{ iiab_ini_file }}
ini_file:
2018-10-31 04:43:24 +00:00
path: "{{ iiab_ini_file }}"
section: usb-lib
option: "{{ item.option }}"
value: "{{ item.value | string }}"
2017-05-27 18:09:50 +00:00
with_items:
- option: name
value: usb-lib
- option: description
2018-02-12 17:37:03 +00:00
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"'
2017-05-27 18:09:50 +00:00
- option: enabled
value: "{{ usb_lib_enabled }}"