eirikur-ari / puppet-dotfiles

A Puppet module for provisioning my dotfiles setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

puppet-dotfiles

Build Status Puppet Forge

Description

This module installs the latest version of my dotfiles to a Linux machine (Puppet agent). By default the repository will be cloned via HTTPS into the directory /usr/local/share/dotfiles.

Usage

To install the dotfiles package with default values:

include dotfiles

Install via ssh key:

class { 'dotfiles':
  dotfiles_repository_url => 'git@github.com:eirikur-ari/dotfiles.git',
  use_ssh_key             => true,
}

Example using all available custom options:

class { 'dotfiles':
  github_ssh_key            => 'example_rsa_key',
  ssh_known_hosts_file_path => 'example/ssh_known_hosts',
  ssh_config_dir            => 'example/.ssh',
  dotfiles_install_path     => 'example/dotfiles',
  dotfiles_repository_url   => 'git@some.repo:example/dotfiles.git',
  dotfiles_install_script   => 'example.sh',
  use_ssh_key               => true
}

Development

Requirements

Puppet version: 4.10 or later
Ruby version: 2.5.7

Install dependencies

Create Gemset (Optional)

It is considered a good practice to keep the product Gem dependencies separated from the local Gems. One of the options is to create a new Gem collection (GemSet) using tool such as RVM. See the following command for an example:

rvm use 2.5.7@dotfiles --create

Install Gems

The following command will install all the product Gem dependencies listed in the Gemfile.

bundle install

Alternative option

There is a second option and that is using the make tool. Execute the following to create a new Gem collection and install the Gem dependencies:

make prep

Unit Testing

Run Unit Tests

The following command will install the dependant Puppet Modules as well as create a symlink to the module under development, execute the unit tests and report on the test coverage.

In order to execute the tests, run the following command:

rake test

By default the repository will be cloned via HTTPS into the directory /usr/local/share/dotfiles. Note: After the tests have been executed the command will remove the Puppet Modules from spec/fixtures/modules

Alternative option

As an alternative that will install the dependencies and execute the unit tests by using the make tool. Execute the following:

make test

Acceptance Testing

The project provides Beaker setup to run acceptance tests via Docker. Tests are automatically executed by Travis CI for the following OS:

  • Ubuntu
  • CentOs
  • Fedora

Run manually

The following command will execute acceptance test using the default beaker configuration:

make acceptance

Smoke Testing

The Vagrant configuration provides a multi-machine setup. By default a version of CentOS is started when vagrant up is executed, the configuration makes sure that no other machine is started along with the primary machine (CentOS).

Install the Puppet Module dependencies

In case the dependent Puppet modules are not available in the directory spec/fixtures/modules we need to run the following:

rake spec_prep

Start a Vagrant box

In order to start any Vagrant box other than the primary (CentOS) it is required to add the name of the box configuration as an addition to the vagrant up command. See the following example:

vagrant up ubuntu

The current machine offering is the following:

  • centos
  • fedora
  • archlinux
  • ubuntu

Alternative option

There is a alternative option available that will prepare the required Puppet Module setup and launch the default vagrant box using the make tool. See the following:

make smoke

Apply the Puppet Module

The following command will apply the Puppet Module and refresh the shell.

puppet apply --modulepath=/vagrant/spec/fixtures/modules /vagrant/tests/init.pp && exec $SHELL -l

Note: If installed using default configuration, it is required to be use the root user to apply the Puppet Module

About

A Puppet module for provisioning my dotfiles setup

License:Other


Languages

Language:Ruby 71.4%Language:Puppet 23.5%Language:Pascal 2.9%Language:Makefile 1.6%Language:HTML 0.5%