A control repository template
Go to file
Jeff McCune de08460ef6 Add Gitlab CI jobs
Without this patch the control repository does not contain any scripts
to execute CI jobs for Puppet code deployment.  This patch addresses the
problem by adding a Gitlab CI job configuration with three jobs defined
across two stages.  The test stage executes first with a Syntax and a
Lint job executing in parallel.  If an environment branch has been
pushed, one matching `developemnt`, `testing`, `production` or starting
with the prefix `playground`, the deploy stage is executed.

The deploy stage requires a Gitlab secret environment variable,
PUPPET_TOKEN.  This environment variable is the puppet access token
configured with Code Manager.

The test stage runs the following syntax checks:

 * yaml files (*.yml, *.yaml)
 * json files (*.json)
 * bash scripts (*.sh)
 * ruby scripts (*.rb)
 * puppet manifests (*.pp)
 * erb files (*.erb)

The behavior of the checks are to check only files modified relative to
a base branch, defaulting to `production`.  This avoids running syntax
checks against files which have not been modified by the merge request.
The check uses `git diff --name-status` to identify changed files across
multiple commits in a topic branch.

The lint checks rely on bundler and the Gemfile to install numerous lint
checks.

Gem libraries are installed in a per-job location in $HOME.  This is an
intentional compromise between installing into a system GEM_PATH
element, which would create library conflicts with other jobs, and the
job workspace, which would cause gem libraries to be installed from the
network on each job invocation.
2017-06-14 16:50:17 -04:00
hieradata Remove max_requests_per_instance since hiera-eyaml is fixed 2016-08-04 15:51:07 -07:00
manifests Provide permalink for filebucket deprecation (#43) 2016-10-26 07:46:56 -07:00
scripts Add Gitlab CI jobs 2017-06-14 16:50:17 -04:00
site Removed old role 2016-06-14 14:37:43 +10:00
.gitignore add .gitignore to ignore my example hiera file 2015-10-22 15:48:06 -07:00
.gitlab-ci.yml Add Gitlab CI jobs 2017-06-14 16:50:17 -04:00
environment.conf Put local site modules first in modulepath 2016-11-08 12:57:46 -05:00
Gemfile Add Gitlab CI jobs 2017-06-14 16:50:17 -04:00
LICENSE Initial commit 2015-08-11 10:07:49 -07:00
Puppetfile Reduce the scope of the control-repo to mostly an example 2016-03-29 15:53:10 -07:00
README.md Add GitHub instructions 2016-11-08 13:47:29 -05:00

Table of Contents

Created by gh-md-toc

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.

What You Get From This control-repo

This repository is a template control-repo that can be used with r10k or Puppet Enterprise Code Manager.

The major points are:

  • An environment.conf that correctly implements:
    • A site directory for roles, profiles, and any custom modules for your organization.
    • A config_version script.
  • Provided config_version scripts to output the commit of code that your agent just applied.
  • Basic example of roles/profiles code.
  • Example hieradata directory with pre-created common.yaml and nodes directory.
    • These match the default hierarchy that ships with PE.

Copy This Repo Into Your Own Git Server

GitLab

  1. Install GitLab.
  1. After GitLab is installed you may sign if with the root user and password 5iveL!fe.

  2. Make a user for yourself.

  3. Make an SSH key to link with your user. Youll 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).

  1. Create a group called puppet (this is case sensitive).
  1. Add your user to the puppet group as well.

  2. Create a project called control-repo, and set the Namespace to be the puppet group.

  3. Clone this control repository to your laptop/workstation:

  • git clone <repository url>
  • cd control-repo
  1. Remove this repository as the origin remote:
  • git remote remove origin
  1. Add your internal repository as the origin remote:
  • git remote add origin <url of your gitlab repository>
  1. Push the production branch of the repository from your machine up to your git server
  • git push origin production

Stash

Coming soon!

GitHub

  1. Prepare your local git client to authenticate with GitHub.com or a local GitHub Enterprise instance.
  1. Create a repository called control-repo in your user account or organization. Ensure that "Initialize this repository with a README" is not selected.
  1. Make a note of your repository URL (HTTPS or SSH, depending on your security configuration).

  2. Clone this control repository to your laptop/workstation:

  • git clone <repository url>
  • cd control-repo
  1. Remove this repository as the origin remote:
  • git remote remove origin
  1. Add your internal repository as the origin remote:
  • git remote add origin <url of your github repository>
  1. Push the production branch of the repository from your machine up to your git server
  • git push origin production