diff --git a/roles/lmn_misc/tasks/main.yml b/roles/lmn_misc/tasks/main.yml index 23dce2b..6eb1a71 100644 --- a/roles/lmn_misc/tasks/main.yml +++ b/roles/lmn_misc/tasks/main.yml @@ -190,6 +190,26 @@ tags: - baseinstall +# Updater + +- name: Provide services and timers for updater + ansible.builtin.template: + src: "{{ item }}.j2" + dest: "/etc/systemd/system/{{ item }}" + mode: '0644' + loop: + - lmn-updater.service + - lmn-updater.timer + when: misc_updater_repository | default(false) is truthy + +- name: Enable updater.timer + ansible.builtin.systemd: + name: lmn-updater.timer + enabled: true + when: + - misc_updater_repository | default(false) is truthy + - misc_updater_autostart | default(false) is truthy + # Prepare CloneScreen on Presenter PCs - name: Fix primary screen for class room PCs with projector diff --git a/roles/lmn_misc/templates/lmn-updater.service.j2 b/roles/lmn_misc/templates/lmn-updater.service.j2 new file mode 100644 index 0000000..64a65d9 --- /dev/null +++ b/roles/lmn_misc/templates/lmn-updater.service.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=Run LMN Client updates via ansible-pull + +[Service] +Type=oneshot +User=root +ExecStart=/usr/bin/ansible-pull --verbose --vault-password-file /root/.inventory-pw -l %H -d /root/lmn-client \ + -i {{ misc_updater_inventory }} --url={{ misc_updater_repository }} -C {{ misc_updater_branch }} lmn-client.yml + diff --git a/roles/lmn_misc/templates/lmn-updater.timer.j2 b/roles/lmn_misc/templates/lmn-updater.timer.j2 new file mode 100644 index 0000000..17c9d17 --- /dev/null +++ b/roles/lmn_misc/templates/lmn-updater.timer.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=Run LMN Updater every day +Requires=lmn-updater.service + +[Timer] +OnBootSec=5min + +[Install] +WantedBy=timers.target