As we have already seen in the decentralized model, Git can be used to transfer files between machines using a combination of ssh
and ssh
keys. It can also be useful to have a Git hook do the same on each successful commit to the repository.
There exists a hook called post-commit that can be run after a successful commit to the repository. In this recipe, we'll create a hook that updates the code on our Puppet master with code from our Git repository on the Git server.
Follow these steps to get started:
Create an
ssh
key that can access your Puppet user on your Puppet master and install this key into the Git user's account ongit.example.com
:[git@git ~]$ ssh-keygen -f ~/.ssh/puppet_rsa Generating public/private rsa key pair. Your identification has been saved in /home/git/.ssh/puppet_rsa. Your public key has been saved in /home/git/.ssh/puppet_rsa.pub. Copy the public key into the authorized_keys file of the puppet user on your puppetmaster puppet...