fix: replace ini_file with lineinfile for reliable work_place substitution

This commit is contained in:
ske087
2026-04-24 16:33:51 +03:00
parent 187c59d6b9
commit 012c1b0e55

View File

@@ -57,24 +57,28 @@
- name: Decode idmasa value
set_fact:
work_place_value: "{{ (idmasa_raw.content | b64decode).strip() }}"
work_place_value: "{{ idmasa_raw.content | b64decode | trim }}"
- name: Show detected work_place value
debug:
msg: "work_place will be set to: '{{ work_place_value }}'"
# ── 5. Ensure config.txt has a [device] section with work_place ───────
- name: Ensure [device] section exists in config.txt
ini_file:
# ── 5. Replace work_place value in WMT/data/config.txt ───────────────
- name: Replace work_place in WMT config.txt
lineinfile:
path: /home/pi/Desktop/WMT/data/config.txt
section: device
option: work_place
value: "{{ work_place_value }}"
regexp: '^work_place\s*=.*'
line: "work_place={{ work_place_value }}"
backup: true
create: true
owner: pi
group: pi
mode: '0644'
- name: Confirm work_place change
command: grep 'work_place' /home/pi/Desktop/WMT/data/config.txt
register: wp_check
changed_when: false
- name: Show work_place line in config.txt
debug:
msg: "{{ wp_check.stdout }}"
# ── 6. Update wayfire.ini autostart to launch from WMT ───────────────
- name: Update wayfire.ini start_python path from Prezenta to WMT