1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/usb-lib/tasks/main.yml
2018-02-14 23:49:53 +00:00

85 lines
2.4 KiB
YAML

- 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
- 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
when: usb_lib_enabled
- name: Install udev to systemd link -> usbmount
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { src: 'usbmount@.service.j2' , dest: '/etc/systemd/system/usbmount@.service' }
- { src: 'usbmount.rules.j2' , dest: '/etc/udev/rules.d/usbmount.rules' }
- 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
when: usb_lib_enabled
- name: Remove mount file to usbmount when not enabled
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
when: not usb_lib_enabled
- name: Add Apache config for content directory
template:
src: content_dir.conf
dest: "/etc/{{ apache_config_dir }}"
when: usb_lib_enabled
- 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 (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
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 }}"
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 }}"