churn/ansible/install-usb-viewer.yml

55 lines
1.6 KiB
YAML
Raw Normal View History

2025-09-30 13:27:57 +01:00
---
- name: Install usb viewer
hosts: all
become: true
tasks:
- name: Copy systemd services
copy:
src: "{{ vmdb2_config_base_dir }}/{{ item }}"
dest: "/etc/systemd/system/{{ item }}"
loop:
- udisks2-mount@.service
- serve-usb@.service
- name: Enable services by symlink
file:
src: "/etc/systemd/system/{{ item }}"
dest: "/etc/systemd/system/multi-user.target.wants/{{ item }}"
state: link
loop:
- udisks2-mount@.service
- serve-usb@.service
- name: Copy web UI assets (remote to remote)
copy:
src: "/var/www/html/assets/{{ item.src }}"
dest: "/var/www/html/{{ item.dest }}"
remote_src: true
loop:
- { src: "css/butter-dir-listing.css", dest: "butter-dir-listing.css" }
- { src: "js/butter-dir-listing.js", dest: "butter-dir-listing.js" }
- name: Install Lighttpd USB config
copy:
src: "{{ vmdb2_config_base_dir }}/50-usb-butter.conf"
dest: "/etc/lighttpd/conf-available/50-usb-butter.conf"
- name: Install udev rule
copy:
src: "{{ vmdb2_config_base_dir }}/99-usb-butter.rules"
dest: "/etc/udev/rules.d/99-usb-butter.rules"
- name: Install udev trigger script
copy:
src: "{{ vmdb2_script_base_dir }}/on-usb-drive-mounted.sh"
dest: /usr/bin/on-usb-drive-mounted.sh
mode: '0755'
- name: Reload udev rules
command: udevadm control --reload-rules
when: not (is_vmdb2 | bool)
- name: Reload systemd daemon
command: systemctl daemon-reload
when: not (is_vmdb2 | bool)