2020-10-30 09:06:30 +00:00
|
|
|
- name: Does systemd-udevd.service exist
|
|
|
|
stat:
|
|
|
|
path: "{{ systemd_location }}/systemd-udevd.service"
|
|
|
|
register: udev_unit
|
|
|
|
|
|
|
|
- name: Copy udevd service to /etc/systemd/system to modify
|
|
|
|
copy:
|
|
|
|
src: "{{ systemd_location }}/systemd-udevd.service"
|
|
|
|
dest: /etc/systemd/system/systemd-udevd.service
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
when: udev_unit.stat.exists is defined and udev_unit.stat.exists
|
|
|
|
|
|
|
|
- name: Change MountFlags from slave to shared
|
|
|
|
lineinfile:
|
|
|
|
backup: no
|
|
|
|
dest: /etc/systemd/system/systemd-udevd.service
|
|
|
|
regexp: '^MountFlags'
|
|
|
|
line: 'MountFlags=shared'
|
|
|
|
state: present
|
|
|
|
when: udev_unit.stat.exists is defined and udev_unit.stat.exists
|
|
|
|
|
|
|
|
- name: Ask systemd to reread unit files (daemon-reload) and restart so systemd recognizes the changes
|
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
|
|
|
name: systemd-udevd
|
|
|
|
state: restarted
|
|
|
|
when: udev_unit.stat.exists is defined and udev_unit.stat.exists
|
|
|
|
|
2020-08-25 16:06:26 +00:00
|
|
|
#http://raspbian.raspberrypi.org/raspbian/pool/main/u/usbmount/usbmount_0.0.22_all.deb
|
|
|
|
- name: Install {{ iiab_download_url }}/usbmount_0.0.22_all.deb, missing from Debian
|
|
|
|
apt:
|
|
|
|
deb: "{{ iiab_download_url }}/usbmount_0.0.22_all.deb"
|
|
|
|
when: is_debian
|
|
|
|
|
|
|
|
# check status of usbmount on mintlinux - should be ok Ubuntu variant
|
2020-08-25 18:25:04 +00:00
|
|
|
- name: Install usbmount from OS repo for Ubuntu variants
|
2020-08-25 16:06:26 +00:00
|
|
|
package:
|
|
|
|
name: usbmount
|
|
|
|
state: present
|
|
|
|
when: is_ubuntu
|
|
|
|
|
2020-02-13 20:11:35 +00:00
|
|
|
- name: Add dir {{ doc_root }}/local_content, where USB drive links can appear
|
|
|
|
file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ doc_root }}/local_content"
|
|
|
|
owner: "{{ apache_user }}"
|
2020-02-13 22:11:04 +00:00
|
|
|
group: "{{ apache_user }}" # 2020-02-13: changed from iiab_admin_user, after discussion on weekly call (#1228, #2222)
|
2020-02-13 20:11:35 +00:00
|
|
|
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:
|
2020-02-13 22:11:04 +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' }
|
2020-04-07 16:52:05 +00:00
|
|
|
- { src: 'iiab-clean-usb.sh', dest: '/usr/sbin/', mode: '0755' }
|
2020-02-13 20:11:35 +00:00
|
|
|
|
|
|
|
- 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
|
2020-02-13 22:11:04 +00:00
|
|
|
dest: "/etc/{{ apache_conf_dir }}" # apache2/sites-available on debuntu
|
2020-05-17 02:48:52 +00:00
|
|
|
when: apache_installed is defined
|
2020-02-13 20:11:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
# 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'
|