A code management tool known that helps in managing environment configurations related to different kind of environments that we can configure in Puppet such as development, testing, and production. This helps in storing environment-related configuration in the source code repository. Using the source control repo branches, r10k creates (install and update) environments on Puppet Server machine using modules present in local / repository.
/opt/puppetlabs/puppet/bin/gem install r10k
Create file /etc/puppetlabs/r10k/r10k.yaml
:cachedir: '/var/puppet/r10k/cache'
:sources:
:code:
remote: 'https://git.fligno.com/reth.bagares/puppet-test.git'
basedir: '/etc/puppetlabs/code/environments'
remote - control repo
basedir - control repo destination
/opt/puppetlabs/puppet/bin/r10k deploy environment production --verbose --puppetfile
Where production is a branch for control repo to be deployed as an environment
Change directory to {basedir}/{branch}, e.g /etc/puppetlabs/code/environments/production
/opt/puppetlabs/puppet/bin/r10k puppetfile install
Access Puppet Agent
/opt/puppetlabs/bin/puppet agent --test
Puppetfile
Sources of modules
puppetforge
mod 'puppetlabs/apache', :latest
local
mod 'nginx', local: true
mod 'php-fpm', local: true
mod 'mysql', local: true
git
git: 'https://github.com/puppetlabs/puppetlabs-apache',
branch: 'docs_experiment'
environment.conf
Add custom modules directory
modulepath = site-modules:modules:custom-modules:$basemodulepath
manifests/site.pp
Main manifest file to be executed during installation of puppetfile
site-modules/profile
Wrapper classes that use multiple component modules to configure a layered technology stack
site-modules/role
Wrapper classes that use multiple profiles to build a complete system configuration