A puppet project skeleton including librarian-puppet, vagrant and roles / profiles pattern.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.librarian/puppet
doc
manifests
private
profile/manifests
role/manifests
scripts
spec
.gitignore
.ruby-gemset
.ruby-version
Gemfile
Gemfile.lock
Puppetfile
Puppetfile.lock
README.md
Rakefile
Vagrantfile
hiera.yaml

README.md

puppet-skeleton

A puppet project skeleton uses Librarian-Puppet and Vagrant.

Development

  • Install VirtualBox.
  • Use Vagrant for development, please install Vagrant according to the official instruction.
  • Install RVM.
  • Switch to project directory and the correct ruby version should be installed according to .ruby-version.
  • Install bundler by running $ gem install bundler
  • Run $ bundle install to install required rubygems.
  • Run $ librarian-puppet install to install required puppet modules. Community modules and private modules will be installed in modules folder. See Librarian-Puppet for further info.

Usage

  • Define your node in vagrant.pp:
  • Add community modules using librarian-puppet, edit Puppetfile and run $ librarian-puppet install
  • Add private modules under private folder, don't forget to edit Puppetfile as well. Run $ rake module:sync or $ librarian-puppet install to install them.
  • Roles and Profiles located at top level of the project, for further information see Roles and Profiles Pattern in Puppet.
  • Use rake tasks to speed up your puppet development.

You can now run $ vagrant up to bootstrap all of them at the same time in VirtualBox.

Other commands:

$ rake -T                                  # List all tasks.
$ rake -D                                  # List all tasks with descriptions.
$ rake module:lint                         # Puppet lint.
$ rake module:reinstall                    # Clean and reinstall modules.
$ rake module:sync                         # Sync private modules.
$ rake syntax                              # Syntax check Puppet manifests and templates
$ rake syntax:hiera                        # Syntax check Hiera config files
$ rake syntax:manifests                    # Syntax check Puppet manifests
$ rake syntax:templates                    # Syntax check Puppet templates
$ rake vagrant:provision[name,provisioner] # Provision vagrant VM.
$ rake vagrant:rebuild[name]               # Rebuild vagrant VM.

Structure

.
├── Gemfile             # Required rubygems, use bundler to install.
├── Puppetfile          # Required puppet modules, use librarian-puppet to install.
├── README.md
├── Rakefile            # Some predefined tasks, to speed up development.
├── Vagrantfile         # Vagrant configuration.
├── hiera.yaml          # Puppet hiera config, only define hierarchy and datadir in this file.
├── docs                # Some documents
├── manifests
│   ├── hieradata         # The actual heirdata stored in this folder.
│   ├── site.pp           # Node definition for production.
│   └── vagrant.pp        # Node definition for local development.
├── private             # Private modules, will be sync into `modules` folder by `librarian-puppet`.
│   ├── common
│   └── users
├── profile             # Profile, abstraction of "Technology stack"
│   ├── files
│   └── manifests
├── role                # Role, abstraction of "What does this server do?"
│   └── manifests
├── spec                # Put test files
└── scripts
    └── upgrade_puppet.sh # Script of upgrading puppet to version 3 on Ubuntu

Bootstrap on Amazon Web Services

You can bootstrap AWS instance in these 2 ways to test:

Manually

  • Create an Ubuntu instance, copy this repo into instance and run scripts/upgrade_puppet.sh to install the latest puppet.
  • Setup the correct hostname.
  • Apply masterless puppet by running $ puppet apply --parser future --modulepath './modules' --hiera_config=./hiera.yaml --manifestdir ./manifests

Vagrant-AWS

  • Install Vagrant-AWS plugin: $ vagrant plugin install vagrant-aws.
  • Add a dummy box for AWS: $ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box.
  • Uncomment AWS related section in Vagrantfile.
  • Fill AWS credentials and other info.
  • Run $ vagrant up aws-web --provider=aws to bootstrape machine aws-web.
  • Or create other machine according to the aws-web example.

TODO

  • Move AWS credentials into config file.
  • Add acceptence tests using Beaker