Skip to content

h0tw1r3/bolt-terraform-docker-environment

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tmp
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Bolt Terraform Docker Environment (btde)

Puppet Bolt project using Terraform and Docker to create and manage full system containers for local development and testing.

This project is geared towards deploying a Puppet server and agents, but anything's possible.

Requirements

  1. Only tested on Linux. Welcome contributions to support other OS's!
  2. Recent version of Puppet Bolt. Tested with 3.26.2.
  3. Working local docker, recent version, usable by your unprivileged user. Tested with 20.10.17.

Usage

Configuration

  • Docker containers are defined in containers.yaml. See local.tf for a list of supported images. Currently only Ubuntu, see [OS Support].
  • Terraform variables may be set in inventory.yaml under vars.terraform. See variables.tf for possible variables and default values.

OS Support

Currently, only Ubuntu LTS 14.04 through 20.04 are supported. Additional images will be added as I need them, or through contributions.

Adding support is relatively straightforward if you're familiar with Dockerfiles.

Relative to the terraform/docker folder:

  1. Create a folder under images for the OS name or family. Example: centos

  2. Create a Dockerfile in the OS folder.

  3. Add the image to the images map in local.tf. Example:

    "centos-9" = {
      name = "btde.local/centos:stream9"
      dockerfile = "images/centos/Dockerfile"
      repo = "centos"
      tag = "stream9"
    }
    
  4. Add an os bootstrap class for the os family if it doesn't exist. See the bootstrap/os/debian class for an example.

Infrastructure

Create

bolt plan run btde::terraform
bolt plan run btde::bootstrap

Destroy

bolt plan run btde::terraform destroy=true

View

bolt inventory show

Nodes

Connect

In addition to basic container setup, the btde::bootstrap plan configures your local ssh client for easy access to the container infrastructure using just the container name. See ~/.ssh/btde_config and the ssh_config plan for details.

ssh puppet-server

Provision

Provision the puppet primary first

ssh puppet-server
puppet apply /etc/puppetlabs/code/environment/production/manifests/site.pp

Then any agents can connect to the primary:

ssh puppet-agent
puppet agent -t

About

Example using puppet bolt and terraform to manage a test environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published