Presuming OSP (Open Source Puppet) has already been installed, as has git.
Install the r10k gem: /opt/puppetlabs/puppet/bin/gem install r10k
Check the installation /opt/puppetlabs/puppet/bin/r10k
Create an ssh key pair
1
2
3
4
5
6
mkdir /opt/puppetlabs/server/data/puppetserver/.ssh
ssh-keygen -m PEM -t rsa -b 2048 -P '' -f /opt/puppetlabs/server/data/puppetserver/.ssh/id-control_repo.rsa
chown puppet:puppet /opt/puppetlabs/server/data/puppetserver/.ssh/id-control_repo.rsa*
chown puppet:puppet -R /opt/puppetlabs/server/data/puppetserver/
chmod 755 /opt/puppetlabs/server/data/puppetserver/.ssh
chmod 600 /opt/puppetlabs/server/data/puppetserver/.ssh/id-control_repo.rsa*
Create a directory for the r10k config mkdir /etc/puppetlabs/r10k
Create a file for the config vi /etc/puppetlabs/r10k/r10k.yaml
With the contents
1
2
3
4
5
6
cachedir: '/var/cache/r10k'
sources:
control-repo:
remote: 'git@<PATH TO CONTROL-REPO>.git'
basedir: '/etc/puppetlabs/code/environments'
Setup the r10k directories
1
2
3
chown puppet:puppet -R /etc/puppetlabs/code/
mkdir /var/cache/r10k
chown puppet:puppet -R /var/cache/r10k/
Create an ssh config file vi /opt/puppetlabs/server/data/puppetserver/.ssh/config
With the contents
1
2
3
4
host github.com
HostName github.com
IdentityFile /opt/puppetlabs/server/data/puppetserver/.ssh/id-control_repo.rsa
User git
Test a deployment sudo -n -H -u puppet bash -c "/opt/puppetlabs/puppet/bin/r10k deploy environment production --verbose --puppetfile"