diff options
| author | Luke Hoersten <[email protected]> | 2026-07-26 11:49:11 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-07-26 11:49:11 -0500 |
| commit | 1566ed593907c829827237aad924c3f527723218 (patch) | |
| tree | 931230eb48dda06b86ddea2f91d4e7e6765ccb4c /mattertimesync/server/tasks | |
| parent | 38323823b85b2ae8deef788a0f49e36c789c12f4 (diff) | |
mattertimesync: add build + server roles
Build role compiles the tagged source on the build host (npm ci + npm run
bundle) into a versioned mattertimesync-<ver>.tar.gz in build_srv_dir. Server
role installs the single bundled .mjs, creates the mattertimesync service user
and a 0700 storage dir for the Matter fabric keys, templates config.json, and
runs a hardened oneshot sync via a systemd timer. Both roles depend on the
nodejs role for Node >=20.
Diffstat (limited to 'mattertimesync/server/tasks')
| -rw-r--r-- | mattertimesync/server/tasks/main.yaml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mattertimesync/server/tasks/main.yaml b/mattertimesync/server/tasks/main.yaml new file mode 100644 index 0000000..7be2392 --- /dev/null +++ b/mattertimesync/server/tasks/main.yaml @@ -0,0 +1,80 @@ +--- + +- name: add mattertimesync user + become: yes + user: + name: "{{mattertimesync_user}}" + system: "yes" + shell: "/usr/sbin/nologin" + home: "{{mattertimesync_storage_path}}" + create_home: "no" + +- name: create mattertimesync directories + become: yes + file: + path: "{{item.path}}" + state: "directory" + owner: "{{item.owner}}" + group: "{{item.owner}}" + mode: "{{item.mode}}" + loop: + - { path: "{{mattertimesync_install_dir}}", owner: "root", mode: "0755" } + - { path: "{{mattertimesync_config_dir}}", owner: "root", mode: "0755" } + - { path: "{{mattertimesync_storage_path}}", owner: "{{mattertimesync_user}}", mode: "0700" } + +- name: check installed mattertimesync version + become: yes + stat: + path: "{{mattertimesync_install_dir}}/.installed-{{mattertimesync_version}}" + register: mattertimesync_installed + +- name: install mattertimesync bundle + become: yes + unarchive: + remote_src: yes + src: "{{mattertimesync_bin_url}}" + dest: "{{mattertimesync_install_dir}}/" + owner: "root" + group: "root" + when: not mattertimesync_installed.stat.exists + +- name: stamp installed mattertimesync version + become: yes + copy: + dest: "{{mattertimesync_install_dir}}/.installed-{{mattertimesync_version}}" + content: "{{mattertimesync_version}}\n" + mode: "0644" + when: not mattertimesync_installed.stat.exists + +- name: configure mattertimesync + become: yes + template: + src: "config.json.j2" + dest: "{{mattertimesync_config_dir}}/config.json" + owner: "root" + group: "{{mattertimesync_user}}" + mode: "0640" + +- name: install mattertimesync systemd service + become: yes + template: + src: "mattertimesync.service.j2" + dest: "/etc/systemd/system/mattertimesync.service" + mode: "0644" + notify: reload systemd + +- name: install mattertimesync systemd timer + become: yes + template: + src: "mattertimesync.timer.j2" + dest: "/etc/systemd/system/mattertimesync.timer" + mode: "0644" + notify: reload systemd + +- name: enable mattertimesync timer + become: yes + systemd: + name: "mattertimesync.timer" + enabled: "yes" + state: "started" + daemon_reload: "yes" |
