7.5 KiB
A Puppet Control Repository
- What You Get From This control-repo
- Copy This Repo Into Your Own Git Server
- Where Did All The Previous Code Go?
What You Get From This control-repo
This is a template control repository that has the minimum amount of scaffolding to make it easy to get started with r10k or Puppet Enterprise's Code Manager.
The important files and items in this template are as follows:
- Basic example of roles and profiles.
- An example Puppetfile with various module references.
- An example Hiera configuration file and data directory with pre-created common.yaml and nodes directory.
- These match the default hierarchy that ships with PE.
- An environment.conf that correctly implements:
- A site directory for roles, profiles, and any custom modules for your organization.
- A config_version script.
- An example config_version script that outputs the git commit ID of the code that was used during a Puppet run.
Here's a visual representation of the structure of this repository:
control-repo/
├── data/ # Hiera data directory.
│ ├── nodes/ # Node-specific data goes here.
│ └── common.yaml # Common data goes here.
├── manifests/
│ └── site.pp # The "main" manifest that contains a default node definition.
├── scripts/
│ ├── code_manager_config_version.rb # A config_version script for Code Manager.
│ ├── config_version.rb # A config_version script for r10k.
│ └── config_version.sh # A wrapper that chooses the appropriate config_version script.
├── site/ # This directory contains site-specific modules and is added to $modulepath.
│ ├── profile/ # The profile module.
│ └── role/ # The role module.
├── LICENSE
├── Puppetfile # A list of external Puppet modules to deploy with an environment.
├── README.md
├── environment.conf # Environment-specific settings. Configures the moduelpath and config_version.
└── hiera.yaml # Hiera's configuration file. The Hiera hierarchy is defined here.
Copy This Repo Into Your Own Git Server
To get started with using the control-repo template in your own environment and git server, we've provided steps for the three most common servers we see: GitLab, BitBucket, and GitHub.
GitLab
- Install GitLab.
- After GitLab is installed you may sign in with the
root
user and password5iveL!fe
. - Make a user for yourself.
- Make an SSH key to link with your user. You’ll want to do this on the machine you intend to edit code from (most likely not your Puppet master, but your local workstation or laptop).
- Create a group called
puppet
(this is case sensitive). - Add your user to the
puppet
group as well. - Create a project called
control-repo
, and set the Namespace to be thepuppet
group. - Clone this control repository to your laptop/workstation:
git clone <repository url>
cd control-repo
- Remove this repository as the origin remote:
git remote remove origin
- Add your internal repository as the origin remote:
git remote add origin <url of your gitlab repository>
- Push the production branch of the repository from your machine up to your git server
git push origin production
Bitbucket/Stash
- Install Bitbucket
- Make a
Project
calledpuppet
(with a short name ofPUP
) - Create a repository called
control-repo
- Create a user called
r10k
with a password ofpuppet
.- Make the r10k user an admin of the
PUP
project.
- Make the r10k user an admin of the
- Either use the admin user to test pushing code, or create a user for yourself and add your SSH key to that user.
- If making a user for yourself, give your user account read/write or admin privilege to the
PUP
project.
- If making a user for yourself, give your user account read/write or admin privilege to the
- Clone this control repository to your laptop/workstation
git clone <repository url>
cd control-repo
- Remove this repository as the origin remote
git remote remove origin
- Add your internal repository as the origin remote
git remote add origin <url of your bitbucket repository>
- Push the production branch of the repository from your machine up to your git server
git push origin production
GitHub
- Prepare your local git client to authenticate with GitHub.com or a local GitHub Enterprise instance.
- Create a repository called
control-repo
in your user account or organization. Ensure that "Initialize this repository with a README" is not selected. - Make a note of your repository URL (HTTPS or SSH, depending on your security configuration).
- Clone this control repository to your laptop/workstation:
git clone <repository url>
cd control-repo
- Remove this repository as the origin remote:
git remote remove origin
- Add your internal repository as the origin remote:
git remote add origin <url of your github repository>
- Push the production branch of the repository from your machine up to your git server
git push origin production
Where Did All The Previous Code Go?
Initially, the control-repo project began as a 'starter' template for anyone who wanted to get started with r10k. As time passed and Code Manager was integrated into Puppet Enterprise, the scope of this project grew to include opinionated Puppet profiles to set up many Puppet Enterprise components. As the code increased, so did the complexity of the control-repo project. To reduce that complexity, as well as continuing to meet the needs of individuals who would like a more minimal template, this repository was stripped of anything other than the bare minimum files necessary to get started with a functioning control-repo.
All of the code that was previously in this repository still exists in separate repositories under the Puppet Ramp Up Program namespace within Github and can be re-connected to an existing control-repo if that is required by adding the modules to the Puppetfile. Alternatively, if that previously opinionated control-repo is desired, it still exists on Github under the Puppet Ramp Up Program namespace. This control-repo project will remain a template for anyone who would like a minimal 'starter' template.