Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Convert ansible-pull example to run with systemd .timer + .service #266

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

keszybz
Copy link

@keszybz keszybz commented Dec 22, 2019

No description provided.

It might still be useful as a reference for old systems, so let's keep
it.
A bit simpler, and self-contained solution with no extra files.

This is based on systemd timers and services, so it is has a smaller
footprint on systems which already have systemd installed (cron and
logrotate dependencies are gone). I assume that ansible is mostly used
with modern systems which have systemd available.

Systemd will restart the service every OnUnitInactiveSec=, while
making sure to not schedule overlapping runs. In practice, it is
convenient to change the timer to something as low as one minute when
quick updates are needed. With --only-if-changed the load on the
system is not even noticable because all that happens is a noop git
pull if no changes were made to the repo.

The logs end up in the journal, so no logging configuration is necessary.
@bcoca
Copy link
Member

bcoca commented Jan 2, 2020

instead of 'convert', add this as another example

@keszybz
Copy link
Author

keszybz commented Jan 2, 2020

I wrote "convert", but the PR really doesn't remove the old example. The old file is renamed, and a new one is added, i.e. both examples are still in tree. I think it is appropriate to make the new example "the default" because it is more lightweight and appropriate for modern systems.

@bcoca
Copy link
Member

bcoca commented Jan 2, 2020

Ah, fair enough, missed the 2nd file was preserving the cron version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants