Workstation Setup
Learn Puppet
There are many ways to learn the Puppet language.
- Learn from sites on the Internet
- Find a mentor on campus
- Take a class
- Browse other People’s Puppet manifests
Set up a workstation for Puppet Development
1) Install git
1) For systems that use yum
to install packages (Fedora,RedHat,SuSE…):
# sudo yum install git
For systems that use ‘apt’ to install packages (Ubuntu,Debian,Mint,…):
# sudo apt install git
2) Configure Git. These values will be stored locally in your ~/.gitconfig file.
# git config --global user.name "your first and last name"
# git config --global user.email "your_email@ncsu.edu"
1) Download Putty (optional, required if you want to connect to Git via SSH)
Make sure you download the “.msi” version of the installer so that you get all of the tools.
2) Run the installer you just downloaded and use all the proviced defaults.
3) Download Git from [git-scm.com]
4) Run the installer you just downloaded.
5) By default, the installer will install both the command line tool (Git Bash) as well as the GUI tool (Git GUI).
6) Make sure you click “Use Git from Git Bash Only”
7)Select “Use (Tortoise) PLink”
8)Select “Use the OpenSSL library”
9)Select “Checkout Windows-style, commit Unit-style line endings”
10)Select “Use MinTTY (the default terminal of MSYS2)”
11)Select any extra options, and click Install
2) Install the Puppet Agent
If you’ve built the box using our build system, the correct version of puppet will already be installed. Otherwise you’ll need to install the puppet agent manually. Exactly which version you install will vary depending on your platform. Note that we currently run Puppet 4 so you’ll want to stick to the pc1 releases. Full instructions for installing the agent are on the Puppet site
3) Install the Puppet Development Kit
Download and install the Puppet Development Kit for your operating system from here
4) (optional) Install puppet-lint
The puppet-lint tool will make it easier for you to check your puppet code for errors. It’s a ruby gem so once you have the Puppet agent installed you can install it with gem install puppet-lint
. Once installed you can check your code with puppet-lint /path/to/module
. Read more at puppet-lint.com.
5) (optional) You’ll need a good text editor to work with. CSI has been using Atom. Available to most platforms, it supports syntax highlighting and puppet lint, plus a whole bunch of other features to make editing easier.
If you choose to go with Atom, we recommend you also install several plugins:
# apm install open-recent
# apm install markdown-preview-plus
# apm install language-puppet
You may also find it useful to run puppet-lint through atom.
Get access to Repositories on github
1) Sign on to github.ncsu.edu with your Unity ID.
2) Add your public SSH key to your profile (optional).
- Create an SSL public/private key pair to use for GitHub. If you already have a key pair you would like to use, you can skip this step. When prompted for information, you can just press return and go with the defaults.
# ssh-keygen -t rsa -b 4096 -C "your_email@ncsu.edu"
- Open the newly generated file (the one that ends with .pub) in your favorite editor and copy the entire file into the clipboard/paste buffer. You’ll be pasting it into a field on a web page in the next step.
- Edit your profile by clicking the right-most icon on the black toolbar and then choosing “Settings”. Everyone’s icon looks different because Github assigns you one randomly.
- Click “SSH and GPG Keys” from the menu on the left side of the screen.
- Click the green “New SSH key” button.
- Enter a title for the key.
- Paste your public key (from the previous step) into the “Key” field.
- Click the green “Add SSH Key” button.
- Test your key. If it says “You’ve successfully authenticated”, you’re good to go!
# ssh -T git@github.ncsu.edu
Cloning the repositories
Before you can edit any Puppet code, you’ll need to download a copy of it. This is called “cloning”. If you plan on never writing your own Puppet code, you can skip this step.
# cd $WHERE_YOUR_SOURCE_CODE_IS
# git clone git@github.ncsu.edu:oit-csi/ncsu.git
# git clone git@github.ncsu.edu:oit-csi/oit_linux.git
# git clone git@github.ncsu.edu:oit-csi/OIT-Linux_Control.git
Creating a New Puppet Module
1) Open a shell window and navigate to where you keep your source code. This will be something like …./oit-csi/oit_pcs_puppet
# cd $WHERE_YOUR_SOURCE_CODE_IS
2) Make sure we have an updated copy of production
# git checkout production
# git pull
3) Create a new branch for your new module
# git checkout -b $BRANCH_NAME
4) Create your new module
If you want to create the new role
# pdk new class $ORG_NAME::role::$MODULE_NAME
If you want to create a new profile
# pdk new class $ORG_NAME::profile::$MODULE_NAME