- Notifications
You must be signed in to change notification settings - Fork4
terraform puppet masterless provisioner
License
pyToshka/terraform-provisioner-puppet-masterless
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Provision terraform resources with puppet-masterlessThis module create just for fun :)
Terraform is a tool for automating infrastructure. Terraform includes the ability to provision resources at creation time through a plugin api. Currently, some builtinprovisioners such aschef and standard scripts are provided; this provisioner introduces the ability to provision an instance at creation time withpuppet-masterless.
This provisioner provides the ability to install puppet agent and try to configure instance.
terraform-provisioner-puppet-masterless is shipped as aTerraformmodule. To include it, simply download the binary and enable it as a terraform module in yourterraformrc.
go get github.com/pyToshka/terraform-provisioner-puppet-masterless
terraform-provisioner-puppet-masterless ships as a single binary and is compatible withterraform's plugin interface. Behind the scenes, terraform plugins usehttps://github.com/hashicorp/go-plugin and communicate with the parent terraform process via RPC.
Once installed, a~/.terraformrc
file is used toenable the plugin.
providers { puppet-masterless ="/usr/local/bin/terraform-puppet-masterless"}
Once installed, you can provision resources by including anpuppet-masterless
provisioner block.
The following example demonstrates a configuration block to install and running puppet agent to new instances and simple provisioning.
provider "aws" { access_key = "${var.access_key}" secret_key = "${var.secret_key}" region = "${var.region}"}resource "aws_instance" "puppetagent" { ami = "${var.ami_id}" instance_type = "${var.instance_type}" count = 1 tags { Name = "test-instance.local" } root_block_device { volume_size = 8 delete_on_termination = true } key_name = "${var.aws_key_name}" subnet_id = "${var.subnet_id}" security_groups = [ "${var.security_group}"] vpc_security_group_ids = [ "${var.security_group}"] provisioner "puppet-masterless" { connection { user = "ubuntu" private_key = "${file("id_rsa")}" } manifest_file = "puppet/environments/manifests/site.pp" prevent_sudo = true manifest_dir = "puppet/environments" module_paths = "puppet/modules" }}
Provisioner options
module_paths - This is an array of paths to module directories on your local filesystem. These will be uploaded to the remote machine. By default, this is empty.manifest_file - This is either a path to a puppet manifest (.pp file) or a directory containing multiple manifests that puppet will apply this manifest must exist on your local system and will be uploaded to the remote machine.manifest_dir - The path to a local directory with manifests to be uploaded to the remote machine. This is useful if your main manifest file uses imports.prevent_sudo - By default, the configured commands that are executed to run Puppet are executed with sudostaging_directory - By default this is /tmp/terraform-puppet-masterless.
example
git https://github.com/pyToshka/terraform-provisioner-puppet-masterlesscd terraform-provisioner-puppet-masterless/puppetmv variables.tf_example variables.tfdo some changes and setup your varsterraform planterrafrom apply
Sample site.pp from my example below
exec{"apt-get update":command=>"/usr/bin/apt-get update",}package{"git":require=>Exec["apt-get update"],}package{"docker":require=>Exec["apt-get update"],}package{"docker.io":require=>Exec["apt-get update"],}
Possible structure for Puppet environment
puppet|-- environments| `-- manifests| `-- site.pp`-- modules |-- apt |-- puppi |-- stdlib
About
terraform puppet masterless provisioner
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.