5.2.6. HOWTO Generate a Puppetfile¶
This section describes how to create a Puppetfile to be used by r10k or code manager to deploy SIMP and site modules. It assumes the user is on the puppetserver. It covers building from Local Repositories or using the Internet repositories
Any module not listed in the
Puppetfile will be deleted from the
modules directory, when you use r10k to
deploy the modules.
simp puppetfile generate -s > Puppetfile
Make sure the
Puppetfileused to deploy from includes the following:
A line that includes the
Puppetfile.simpwhich should look like:instance_eval(File.read(File.join(__dir__,"Puppetfile.simp")))
A line for each of your own modules.
The SIMP CLI can help identify local modules in an environment that need to be listed in the
Puppetfile, because they may not be under Git source control and, when removed by r10k, may not be able to be readily restored.
To generate a list of local modules in an environment (
productionin this example) do the following:simp puppetfile generate --skeleton --local-modules production > /tmp/Puppetfile
This will generate
a directive to include the file
a local entry for each module presently in the
productionenvironment, that does not have a local, SIMP-managed Git repository and does not appear to be managed by Git.
The local entries will look like the following:mod 'module name', :local => true
Verify that all modules with a local entry in
/tmp/Puppetfileare in your environment’s
Puppetfilein one of the following forms:# a module that is not a Git repository and resides in the ``modules`` directory mod 'site', :local => true # a Git repository that resides in a directory on the Puppet server mod 'mymodule', :git => 'file:///usr/share/mymodules/mymodule', :tag => '1.1.1' # a Git repository on a remote server mod 'mysrvmod', :git => 'https://gitserver.my.domain/mygitproject/mysrvmod.git', :tag => '1.0.1'
Any modules on the local system (ones that use the
:local => truedirective), should be converted to a Git repository. This will ensure that if r10k removes them because of an error in the
Puppetfilethey can easily be restored from the Git repository.
Make sure all the SIMP module RPMs are installed using yum that you want to use and then run:simp puppetfile generate > Puppetfile.simp
Puppetfileused to create a SIMP ISO for a specific release from the SIMP simp-core repository. This example uses the SIMP
6.4.0-0release.curl -o Puppetfile.simp https://github.com/simp/simp-core/blob/6.4.0-0/Puppetfile.pinned
Manually edit the
Puppetfile.simpto remove components that are not Puppet modules, by deleting all lines up to and including
Optionally, edit the
Puppetfile.simpto remove any non-core SIMP modules that are packaged with the
simp-extrasRPM, that are not needed. The list of the SIMP extra modules can be obtained by examining the RPM requirements of the
simp-extrasRPM as follows:yum deplist simp-extras
Puppetfile.simp to top level of the environment
directory or the top level of the control repo.