Install etckeeper via ansible, and perform first commit at end of playbook

I’m using ansible to provision a server. One of the roles installs etckeeper, which automatically creates the git repo and makes the first commit.

If many tasks run after that (which install via apt or perform configuration changes), then the repo is a mess of commits – before I even start using the server.

I want one commit at the end of the ansible playbook, triggered via notify: etckeeper commit.

Is that possible?

Answer

From the manual:

Here’s how to disable the automatic commits after each apt run, while still
letting it git add new files:

rm /etc/etckeeper/commit.d/50vcs-commit

Once the auto commit feature is disabled you can trigger the script via Ansible at the end of the play.

Attribution
Source : Link , Question Author : lonix , Answer Author : Henrik Pingel

Leave a Comment