Skip to content

R10k tips

Eraldo Junior edited this page Oct 16, 2018 · 8 revisions

After run your r10k script at first time:

cd /etc/puppetlabs/code/environments/module_XX

git submodule update --init --recursive

cd /etc/puppetlabs/code/environments/module_10/site/simple_grid

git remote -v

git remote set-url origin https://github.com/ejr004/simple_grid_puppet_module

git checkout -b issue_10

git pull origin issue_10

Now we create External node Classifier (ENC)

[root@puppet-server simple_grid]# touch /enc.sh
[root@puppet-server simple_grid]# chmod +x /enc.sh
[root@puppet-server simple_grid]# chown puppet /enc.sh
[root@puppet-server simple_grid]# vim /enc.sh
[root@puppet-server simple_grid]# /./enc.sh

Edit ./enc.sh

#!/bin/bash
echo "---"
echo "classes:"
if [ "$1" = "$(hostname -f)" ]
then
        echo "   - role::puppet_master"
else
        echo "   - role::cream_ce"
fi
exit 0

And add this line to /etc/puppetlabs/puppet/puppet.conf

node_terminus = exec
external_nodes = /enc.sh

[agent]
server =  puppet-server.cern.ch

Restart puppet server

systemctl restart puppetserver

ENC and ENV on git

simple_grid_puppet_module is a submodule inside simple_grid_puppet_env

vim r10k/r10k.yaml
r10k deploy environment -p
cd /etc/puppetlabs/code/environments/master/site/simple_grid/
git submodule status
vim .gitmodules
git submodule sync
git submodule update --init --recursive
git checkout master
git branch -v
git fetch origin
git fetch
git checkout -b issue_10
it pull origin issue_10
git log --oneline

Reference: https://puppet.com/docs/pe/2017.2/r_n_p_full_example.html

Clone this wiki locally