mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 19:52:06 +00:00
109 lines
3.6 KiB
YAML
109 lines
3.6 KiB
YAML
# TO DO:
|
|
# - validate input vars + prereqs
|
|
# - move 6 top stanzas into install.yml
|
|
# - move 6 mid/lower stanzas into enable-or-disable.yml
|
|
# - verify analogous NGINX logic from roles/nginx/* -- then integrate as nec?
|
|
|
|
- name: Add dir {{ doc_root }}/local_content, where USB drive links can appear
|
|
file:
|
|
state: directory
|
|
path: "{{ doc_root }}/local_content"
|
|
owner: "{{ apache_user }}"
|
|
group: "{{ iiab_admin_user }}" # ISN'T "{{ apache_user }}" MORE APPROPRIATE?
|
|
mode: '0775'
|
|
|
|
- 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 }}"
|
|
mode: "{{ item.mode }}"
|
|
with_items:
|
|
- { 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' }
|
|
|
|
- name: Enable exFAT and NTFS in /etc/usbmount/usbmount.conf
|
|
lineinfile:
|
|
regexp: '^FILESYSTEMS.*'
|
|
line: 'FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus exfat fuseblk ntfs"'
|
|
path: /etc/usbmount/usbmount.conf
|
|
|
|
- name: Install /etc/{{ apache_conf_dir }}/content_dir.conf from template
|
|
template:
|
|
src: content_dir.conf
|
|
dest: "/etc/{{ apache_conf_dir }}"
|
|
when: apache_install
|
|
|
|
|
|
# RECORD usb_lib AS INSTALLED
|
|
|
|
- name: "Set 'usb_lib_installed: True'"
|
|
set_fact:
|
|
usb_lib_installed: True
|
|
|
|
- name: "Add 'usb_lib_installed: True' to {{ iiab_state_file }}"
|
|
lineinfile:
|
|
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
|
regexp: '^usb_lib_installed'
|
|
line: 'usb_lib_installed: True'
|
|
|
|
|
|
- name: Install /etc/usbmount/mount.d/70-usb-library from template, if usb_lib_enabled
|
|
template:
|
|
src: mount.d/70-usb-library
|
|
dest: /etc/usbmount/mount.d/
|
|
owner: root
|
|
group: root
|
|
mode: '0751'
|
|
when: usb_lib_enabled | bool
|
|
|
|
- name: Install /etc/usbmount/umount.d/70-usb-library from template, if usb_lib_enabled
|
|
template:
|
|
src: umount.d/70-usb-library
|
|
dest: /etc/usbmount/umount.d
|
|
owner: root
|
|
group: root
|
|
mode: '0751'
|
|
when: usb_lib_enabled | bool
|
|
|
|
- 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
|
|
when: not usb_lib_enabled
|
|
|
|
- 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
|
|
when: not usb_lib_enabled
|
|
|
|
- name: Enable http://box/usb via Apache, if usb_lib_enabled
|
|
command: a2ensite content_dir.conf
|
|
when: apache_install and usb_lib_enabled
|
|
|
|
- name: Disable http://box/usb via Apache, if not usb_lib_enabled
|
|
command: a2dissite content_dir.conf
|
|
when: apache_install and not usb_lib_enabled
|
|
|
|
|
|
- name: Put variable in iiab.env that enables display of content at root of USB
|
|
lineinfile:
|
|
path: "{{ iiab_env_file }}"
|
|
regexp: "^IIAB_USB_LIB_SHOW_ALL.*"
|
|
line: "IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }}"
|
|
|
|
- name: Add 'usb_lib' variable values to {{ iiab_ini_file }}
|
|
ini_file:
|
|
path: "{{ iiab_ini_file }}"
|
|
section: usb_lib
|
|
option: "{{ item.option }}"
|
|
value: "{{ item.value | string }}"
|
|
with_items:
|
|
- option: name
|
|
value: usb_lib
|
|
- option: description
|
|
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 }}"
|