diff options
Diffstat (limited to 'mattertimectl/controller/tasks/main.yaml')
| -rw-r--r-- | mattertimectl/controller/tasks/main.yaml | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mattertimectl/controller/tasks/main.yaml b/mattertimectl/controller/tasks/main.yaml new file mode 100644 index 0000000..a77145c --- /dev/null +++ b/mattertimectl/controller/tasks/main.yaml @@ -0,0 +1,80 @@ +--- + +- name: add mattertimectl user + become: yes + user: + name: "{{mattertimectl_user}}" + system: "yes" + shell: "/usr/sbin/nologin" + home: "{{mattertimectl_storage_path}}" + create_home: "no" + +- name: create mattertimectl directories + become: yes + file: + path: "{{item.path}}" + state: "directory" + owner: "{{item.owner}}" + group: "{{item.owner}}" + mode: "{{item.mode}}" + loop: + - { path: "{{mattertimectl_install_dir}}", owner: "root", mode: "0755" } + - { path: "{{mattertimectl_config_dir}}", owner: "root", mode: "0755" } + - { path: "{{mattertimectl_storage_path}}", owner: "{{mattertimectl_user}}", mode: "0700" } + +- name: check installed mattertimectl version + become: yes + stat: + path: "{{mattertimectl_install_dir}}/.installed-{{mattertimectl_version}}" + register: mattertimectl_installed + +- name: install mattertimectl bundle + become: yes + unarchive: + remote_src: yes + src: "{{mattertimectl_bin_url}}" + dest: "{{mattertimectl_install_dir}}/" + owner: "root" + group: "root" + when: not mattertimectl_installed.stat.exists + +- name: stamp installed mattertimectl version + become: yes + copy: + dest: "{{mattertimectl_install_dir}}/.installed-{{mattertimectl_version}}" + content: "{{mattertimectl_version}}\n" + mode: "0644" + when: not mattertimectl_installed.stat.exists + +- name: configure mattertimectl + become: yes + template: + src: "config.json.j2" + dest: "{{mattertimectl_config_dir}}/config.json" + owner: "root" + group: "{{mattertimectl_user}}" + mode: "0640" + +- name: install mattertimectl systemd service + become: yes + template: + src: "mattertimectl.service.j2" + dest: "/etc/systemd/system/mattertimectl.service" + mode: "0644" + notify: reload systemd + +- name: install mattertimectl systemd timer + become: yes + template: + src: "mattertimectl.timer.j2" + dest: "/etc/systemd/system/mattertimectl.timer" + mode: "0644" + notify: reload systemd + +- name: enable mattertimectl timer + become: yes + systemd: + name: "mattertimectl.timer" + enabled: "yes" + state: "started" + daemon_reload: "yes" |
