Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants