feat: fix migrate_to_wmt playbook; restructure sidebar nav; add Client Name column to WMT dashboard
This commit is contained in:
@@ -97,13 +97,39 @@
|
||||
debug:
|
||||
msg: "work_place will be set to: '{{ work_place_value }}'"
|
||||
|
||||
# ── 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
|
||||
regexp: '^work_place\s*=.*'
|
||||
line: "work_place={{ work_place_value }}"
|
||||
backup: true
|
||||
# ── 5. Write work_place into WMT/data/config.txt ──────────────────────
|
||||
# Uses Python (always available on Raspberry Pi) to correctly
|
||||
# read/write the INI file and set work_place inside [device].
|
||||
# Also resets last_synced to epoch so first startup does NOT
|
||||
# overwrite work_place with a potentially empty server value.
|
||||
- name: Set work_place in WMT config.txt via Python
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
python3 - <<'PYEOF'
|
||||
import configparser, os
|
||||
path = '/home/pi/Desktop/WMT/data/config.txt'
|
||||
p = configparser.ConfigParser()
|
||||
p.read(path)
|
||||
if not p.has_section('chrome'):
|
||||
p.add_section('chrome')
|
||||
if not p.has_section('card_api'):
|
||||
p.add_section('card_api')
|
||||
if not p.has_section('server'):
|
||||
p.add_section('server')
|
||||
if not p.has_section('device'):
|
||||
p.add_section('device')
|
||||
if not p.has_section('meta'):
|
||||
p.add_section('meta')
|
||||
p.set('device', 'work_place', '{{ work_place_value }}')
|
||||
# Reset last_synced so first startup pull from server does not
|
||||
# overwrite the work_place we just set (server will return the
|
||||
# correct device_name once this device checks in).
|
||||
p.set('meta', 'last_synced', '1970-01-01T00:00:00')
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
with open(path, 'w') as f:
|
||||
p.write(f)
|
||||
print('work_place set to: {{ work_place_value }}')
|
||||
PYEOF
|
||||
|
||||
- name: Confirm work_place change
|
||||
command: grep 'work_place' /home/pi/Desktop/WMT/data/config.txt
|
||||
|
||||
Reference in New Issue
Block a user