Skip to content
Snippets Groups Projects
Commit eada20a0 authored by Elena Grandi's avatar Elena Grandi
Browse files

Use a systemd timer to run ocsinventory-agent at a randomized time after boot.

parent 2548720b
No related branches found
No related tags found
No related merge requests found
Pipeline #721 failed with stage
in 33 seconds
......@@ -64,14 +64,21 @@
src: ocsinventory-agent.cfg
dest: /etc/ocsinventory/ocsinventory-agent.cfg
# TODO: make this a systemd timer
- name: Install esecution in cron.d
cron:
name: "Run ocsinventory agent"
cron_file: ocsinventory-agent
job: ocsinventory-agent --lazy
user: root
hour: "{{ 24 | random(seed=inventory_hostname) }}"
minute: "{{ 60 | random(seed=inventory_hostname) }}"
- name: Service unit to execute ocsinventory-agent
template:
src: ocsinventory-agent.service
dest: /etc/systemd/system/ocsinventory-agent.service
- name: Timer unit to execute ocsinventory-agent
template:
src: ocsinventory-agent.timer
dest: /etc/systemd/system/ocsinventory-agent.timer
- name: Enable timer to execute ocsinventory-agent
systemd:
name: ocsinventory-agent.timer
state: started
enabled: true
when: '"OK" in result.msg'
[Unit]
Description=Run ocsinventory agent
[Service]
Type=oneshot
ExecStart=/usr/bin/ocsinventory-agent --lazy
[Unit]
Description=Run ocsinventory agent some time after boot
[Timer]
OnBootSec=5min
RandomizedDelaySec=15m
[Install]
WantedBy=timers.target
......@@ -2,6 +2,8 @@ fuss-client (12.0.7) UNRELEASED; urgency=medium
* Remove fuss-client -r, confusing and no longer needed.
* Fix mounting homes after running fuss-client with -H.
* Use a systemd timer to run ocsinventory-agent at a randomized time after
boot.
-- Elena Grandi <valhalla@debian.org> Fri, 17 Mar 2023 13:54:06 +0100
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment