Skip to content

Instantly share code, notes, and snippets.

@jjasghar
Last active April 5, 2019 20:32
Show Gist options
  • Save jjasghar/dbd7348240f23a26a31cd7a02dcb4267 to your computer and use it in GitHub Desktop.
Save jjasghar/dbd7348240f23a26a31cd7a02dcb4267 to your computer and use it in GitHub Desktop.
One Machine Diff between Linux and Windows
--- one_machine_chef/one_machine_chef_vcenter.tf 2017-10-23 16:07:25.000000000 -0500
+++ one_machine_chef_win/one_machine_chef_vcenter_windows.tf 2017-10-25 16:42:21.000000000 -0500
@@ -25,6 +25,8 @@
resource_pool = "terraform"
# Linked clones are the best clones, don't forget to create the snapshot
linked_clone = true
+ # This is to skip the customization spec, this is required for me, probably not you
+ skip_customization = true
network_interface {
# What network you want to connect to
@@ -33,28 +35,11 @@
disk {
# What template to clone
- template = "template-ubuntu1604"
+ template = "template-windows2012R2"
# What datastore to create it in
datastore = "vsanDatastore"
}
- # my template is broken, but as you can see here's some pre-chef work done :)
- provisioner "remote-exec" {
- inline = [
- "sudo rm /var/lib/dpkg/lock",
- "sudo dpkg --configure -a",
- "sudo apt-get install -f",
- "sudo apt autoremove -y",
- # This was interesting here, i needed to add a host to /etc/hosts, this injects the sudo password, then tee's the /etc/hosts
- "echo admini | sudo -S echo '10.0.0.15 chef chef.tirefi.re' | sudo tee -a /etc/hosts"
- ]
- connection {
- type = "${var.connection_thingys.["connection_type"]}"
- user = "${var.connection_thingys.["connection_user"]}"
- password = "${var.connection_thingys.["connection_password"]}"
- }
- }
-
provisioner "chef" {
server_url = "${var.chef_provision.["server_url"]}"
user_name = "${var.chef_provision.["user_name"]}"
@@ -62,7 +47,7 @@
user_key = "${file("/Users/jjasghar/repo/vmware_playground/pems/admini.pem")}"
node_name = "${var.chef_provision.["node_name_default"]}"
# Here's a inital run_list :)
- run_list = ["recipe[base]"]
+ run_list = ["recipe[chef-client]"]
recreate_client = "${var.chef_provision.["recreate_client"]}"
on_failure = "continue"
ssl_verify_mode = "${var.chef_provision.["ssl_verify_mode_setting"]}"
@@ -71,6 +56,7 @@
type = "${var.connection_thingys.["connection_type"]}"
user = "${var.connection_thingys.["connection_user"]}"
password = "${var.connection_thingys.["connection_password"]}"
+ https = false
}
}
}
--- one_machine_chef/variables.tf 2017-10-20 10:49:22.000000000 -0500
+++ one_machine_chef_win/variables.tf 2017-10-24 13:15:50.000000000 -0500
@@ -20,7 +20,7 @@
default = {
# A default node name
- node_name_default = "terraform-1"
+ node_name_default = "terraform-windows"
# Run it again? You probably need to recreate the client
recreate_client = true
# Chef server :)
@@ -37,11 +37,11 @@
description = "Configuration details for connecting to the remote machine"
default = {
- # Default to SSH
- connection_type = "ssh"
+ # Default to winrm
+ connection_type = "winrm"
# User to connect to the server
- connection_user = "admini"
+ connection_user = "Administrator"
# Password to connect to the server
- connection_password = "admini"
+ connection_password = "Admini@"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment