Last active
October 7, 2019 15:16
-
-
Save martezr/22c17961ee57e9fe2c989628107cbb74 to your computer and use it in GitHub Desktop.
Puppet Bolt Terraform Inventory Plugin Basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bolt plan run facts -i inventory.yaml nodes=boltservers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
groups: | |
- name: boltservers | |
targets: | |
- _plugin: terraform | |
resource_type: vsphere_virtual_machine.boltserver | |
uri: default_ip_address | |
dir: . | |
name: name | |
backend: remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
backend "consul" { | |
address = "10.0.0.6:8500" | |
scheme = "http" | |
path = "terraform/bolt/boltserver/terraform.tfstate" | |
datacenter = "puppet-bolt" | |
} | |
} | |
resource "vsphere_virtual_machine" "boltserver" { | |
name = "boltserver" | |
num_cpus = 2 | |
memory = 4096 | |
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}" | |
datastore_id = "${data.vsphere_datastore.datastore.id}" | |
guest_id = "${data.vsphere_virtual_machine.template.guest_id}" | |
scsi_type = "${data.vsphere_virtual_machine.template.scsi_type}" | |
network_interface { | |
network_id = "${data.vsphere_network.network.id}" | |
adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}" | |
} | |
disk { | |
label = "disk0" | |
size = "${data.vsphere_virtual_machine.template.disks.0.size}" | |
eagerly_scrub = "${data.vsphere_virtual_machine.template.disks.0.eagerly_scrub}" | |
thin_provisioned = "${data.vsphere_virtual_machine.template.disks.0.thin_provisioned}" | |
} | |
clone { | |
template_uuid = "${data.vsphere_virtual_machine.template.id}" | |
customize { | |
linux_options { | |
host_name = "boltserver" | |
domain = "grt.local" | |
} | |
network_interface {} | |
dns_server_list = ["10.0.0.200"] | |
ipv4_gateway = "10.0.0.1" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plan bolt_hashi::nomad( | |
TargetSpec $nodes, | |
Optional[String] $version = '0.9.5', | |
) { | |
# Ensure puppet tools are installed and gather facts for the apply | |
apply_prep([$nodes]) | |
apply($nodes) { | |
package { 'unzip': | |
ensure => present, | |
} | |
class { '::nomad': | |
version => $version, | |
config_hash => { | |
'region' => 'us-west', | |
'datacenter' => 'ptk', | |
'log_level' => 'INFO', | |
'bind_addr' => '0.0.0.0', | |
'data_dir' => '/opt/nomad', | |
'server' => { | |
'enabled' => true, | |
'bootstrap_expect' => 1, | |
} | |
} | |
} | |
$puppet_packages = [ 'puppet-agent', 'puppet-release' ] | |
package { $puppet_packages: | |
ensure => absent, | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment