labsync/packer/ansible/roles/lightburn/tasks/devices.yml
2023-09-14 19:22:55 +00:00

34 lines
929 B
YAML

- name: Download devices files
uri:
url: "{{ device_url }}"
return_content: true
loop: "{{ lightburn.devices }}"
loop_control:
loop_var: device_url
register: lightburn_downloaded_devices
- name: Create lightburn settings
set_fact:
lightburn_devices: "{{ lightburn_devices | default([]) + [device_settings] }}"
vars:
device_settings: "{{ (device.content | from_json)['DeviceList'][0] }}"
loop: "{{ lightburn_downloaded_devices.results }}"
loop_control:
loop_var: device
label: "{{ device_settings.DisplayName }}"
- name: Create settings directory
file:
path: "{{ item }}"
state: directory
loop:
- /etc/skel/.config
- /etc/skel/.config/LightBurn
- name: Create settings file
copy:
dest: /etc/skel/.config/LightBurn/prefs.ini
content: "{{ lightburn_settings | to_nice_json() }}"
vars:
lightburn_settings:
DeviceList: "{{ lightburn_devices }}"