Skip to content

Commit 75e38b4

Browse files
author
Ryan Johnson
authored
Update for 21.11 (#140)
Add updates for `21.11` release. Signed-off-by: Ryan Johnson <[email protected]>
1 parent f6a5aac commit 75e38b4

File tree

34 files changed

+1451
-9
lines changed

34 files changed

+1451
-9
lines changed

.github/ISSUE_TEMPLATE/bug.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ body:
2020
description: Please provide the version of this project.
2121
options:
2222
- main
23-
- 21.10.1 (Default)
23+
- 21.11 (Default)
24+
- 21.10.1
2425
- 21.10
2526
- 21.09.1
2627
- 21.09

.github/ISSUE_TEMPLATE/docs.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ body:
2020
description: Please provide the version of this project.
2121
options:
2222
- main
23-
- 21.10.1 (Default)
23+
- 21.11 (Default)
24+
- 21.10.1
2425
- 21.10
2526
- 21.09.1
2627
- 21.09

CHANGELOG.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
![Rainpole](icon.png)
44

5+
## Release: `v21.11`
6+
November 09, 2021
7+
* Adds support for `cloud-init` and the `[VMware]` data source introduced in cloud-init v21.3 to:
8+
* Ubuntu 20.04 LTS
9+
* Adds custom disk partitioning to:
10+
* Ubuntu 20.04 LTS
11+
* Ubuntu 18.04 LTS
12+
* Updates Ubuntu 18.04 LTS to `efi-secure`.
13+
* Updates all certificates to the PEM-encoded `.cer` format.
14+
* Adds example Terraform plans for deployment testing.
15+
* Adds an Ansible playbook example to create a custom role in vSphere for Packer.
16+
517
## Release: `v21.10.1`
618
October 20, 2021
719
* Update `LICENSE` and `NOTICE` to BSD-2.
@@ -52,7 +64,7 @@ October 11, 2021
5264
* Updated issue templates to use forms.
5365
* Various bug fixes and code cleanliness.
5466
* Bumped Packer to `>= 1.7.6`.
55-
* Thanks to the the new contributors: @sestegra, @metabsdm, and @gcblack!
67+
* Thanks to the new contributors: @sestegra, @metabsdm, and @gcblack!
5668
5769
## Release: `v21.09.1`
5870
September 16, 2021

README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The following builds are available:
4343
* Microsoft Windows Server 2022 - Standard and Datacenter
4444
* Microsoft Windows Server 2019 - Standard and Datacenter
4545
* Microsoft Windows Server 2016 - Standard and Datacenter
46-
* Microsoft Windows 11 Professional
46+
* Microsoft Windows 11 Professional (Experimental)
4747
* Microsoft Windows 10 Professional
4848

4949
> **NOTE**: Guest customization is [**not supported**](https://partnerweb.vmware.com/programs/guestOS/guest-os-customization-matrix.pdf) for AlmaLinux and Rocky Linux in vCenter Server 7.0 Update 2.
@@ -82,6 +82,14 @@ The following software packages must be installed on the Packer host:
8282
- macOS: `brew install --cask docker`
8383
* Coreutils
8484
- macOS: `brew install coreutils`
85+
* HashiCorp [Terraform][terraform-install] 1.0.10 or higher.
86+
- Ubuntu:
87+
- `sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl`
88+
- `curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -`
89+
- `sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"`
90+
- `sudo apt-get update && sudo apt-get install terraform`
91+
- macOS:
92+
- `brew install terraform`
8593

8694
**Platform**:
8795
* VMware Cloud Foundation 4.2 or higher, or
@@ -155,7 +163,8 @@ The directory structure of the repository.
155163
│ └── windows
156164
│ └── *.ps1
157165
└── terraform
158-
└── vsphere-role
166+
│── vsphere-role
167+
└── vsphere-virtual-machine
159168
```
160169
The files are distributed in the following directories.
161170
* **`ansible`** - contains the Ansible roles to initialize and prepare the machine image build.
@@ -712,6 +721,7 @@ Happy building!!!
712721
[photon-kickstart]: https://vmware.github.io/photon/docs/user-guide/kickstart-through-http/packer-template/
713722
[redhat-kickstart]: https://access.redhat.com/labs/kickstartconfig/
714723
[ssh-keygen]: https://www.ssh.com/ssh/keygen/
724+
[terraform-install]: https://www.terraform.io/docs/cli/install/apt.html
715725
[vmware-pvscsi]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.hostclient.doc/GUID-7A595885-3EA5-4F18-A6E7-5952BFC341CC.html
716726
[vmware-vmxnet3]: https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-AF9E24A8-2CFA-447B-AC83-35D563119667.html
717727
[vsphere-api]: https://code.vmware.com/apis/968

terraform/vsphere-role/terraform.tfvars.example

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# Credentials
66

77
vsphere_server = "sfo-m01-vc01.rainpole.io"
8-
vsphere_username = "administrator@vsphere.local"
9-
vsphere_password = "R@in!$aG00dThing."
8+
vsphere_username = "svc-terraform-vsphere@rainpole.io"
9+
vsphere_password = "************"
1010
vsphere_insecure = false
1111

1212
# vSphere Settings
@@ -37,7 +37,6 @@ packer_vsphere_privileges = [
3737
"VirtualMachine.Config.Memory",
3838
"VirtualMachine.Config.Resource",
3939
"VirtualMachine.Config.Settings",
40-
4140
"VirtualMachine.Interact.DeviceConnection",
4241
"VirtualMachine.Interact.PowerOff",
4342
"VirtualMachine.Interact.PowerOn",

terraform/vsphere-role/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ terraform {
99
version = ">= 2.0.2"
1010
}
1111
}
12-
required_version = ">= 1.0.8"
12+
required_version = ">= 1.0.10"
1313
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
provider "vsphere" {
2+
vsphere_server = var.vsphere_server
3+
user = var.vsphere_username
4+
password = var.vsphere_password
5+
allow_unverified_ssl = var.vsphere_insecure
6+
}
7+
8+
data "vsphere_datacenter" "datacenter" {
9+
name = var.vsphere_datacenter
10+
}
11+
12+
data "vsphere_network" "network" {
13+
name = var.vsphere_network
14+
datacenter_id = data.vsphere_datacenter.datacenter.id
15+
}
16+
17+
data "vsphere_compute_cluster" "cluster" {
18+
name = var.vsphere_cluster
19+
datacenter_id = data.vsphere_datacenter.datacenter.id
20+
}
21+
22+
data "vsphere_resource_pool" "pool" {
23+
name = format("%s%s", data.vsphere_compute_cluster.cluster.name, "/Resources")
24+
datacenter_id = data.vsphere_datacenter.datacenter.id
25+
}
26+
27+
data "vsphere_datastore" "datastore" {
28+
name = var.vsphere_datastore
29+
datacenter_id = data.vsphere_datacenter.datacenter.id
30+
}
31+
32+
data "vsphere_content_library" "content_library" {
33+
name = var.vsphere_content_library
34+
}
35+
36+
data "vsphere_content_library_item" "content_library_item" {
37+
name = var.vsphere_content_library_ovf
38+
type = "ovf"
39+
library_id = data.vsphere_content_library.content_library.id
40+
}
41+
42+
resource "vsphere_virtual_machine" "vm" {
43+
name = var.vm_name
44+
folder = var.vsphere_folder
45+
num_cpus = var.vm_cpus
46+
memory = var.vm_memory
47+
firmware = var.vm_firmware
48+
efi_secure_boot_enabled = var.vm_efi_secure_boot_enabled
49+
datastore_id = data.vsphere_datastore.datastore.id
50+
resource_pool_id = data.vsphere_resource_pool.pool.id
51+
network_interface {
52+
network_id = data.vsphere_network.network.id
53+
}
54+
disk {
55+
label = "disk0"
56+
size = var.vm_disk_size
57+
thin_provisioned = true
58+
}
59+
clone {
60+
template_uuid = data.vsphere_content_library_item.content_library_item.id
61+
}
62+
lifecycle {
63+
ignore_changes = [
64+
clone[0].template_uuid,
65+
]
66+
}
67+
extra_config = {
68+
"guestinfo.metadata" = base64encode(file("${path.module}/metadata.yml"))
69+
"guestinfo.metadata.encoding" = "base64"
70+
"guestinfo.userdata" = base64encode(file("${path.module}/userdata.yml"))
71+
"guestinfo.userdata.encoding" = "base64"
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
instance-id: ubuntu-cloud-init
2+
local-hostname: ubuntu-cloud-init
3+
network:
4+
version: 2
5+
ethernets:
6+
ens192:
7+
dhcp4: false
8+
addresses:
9+
- 172.16.100.192/24
10+
gateway4: 172.16.100.1
11+
nameservers:
12+
addresses:
13+
- 172.16.11.4
14+
- 172.16.11.5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
##################################################################################
2+
# VARIABLES
3+
##################################################################################
4+
5+
# Credentials
6+
7+
vsphere_server = "sfo-w01-vc01.rainpole.io"
8+
vsphere_username = "[email protected]"
9+
vsphere_password = "************"
10+
vsphere_insecure = false
11+
12+
# vSphere Settings
13+
14+
vsphere_datacenter = "sfo-w01-dc01"
15+
vsphere_cluster = "sfo-w01-cl01"
16+
vsphere_datastore = "sfo-w01-cl01-ds-vsan01"
17+
vsphere_folder = "workloads"
18+
vsphere_network = "w01-172.16.100.0"
19+
vsphere_content_library = "sfo-w01-lib01"
20+
vsphere_content_library_ovf = "linux-ubuntu-server-20-04-lts"
21+
22+
# Virtual Machines Settings
23+
24+
vm_name = "ubuntu-cloud-init"
25+
vm_cpus = 2
26+
vm_memory = 4096
27+
vm_disk_size = 60
28+
vm_firmware = "efi"
29+
vm_efi_secure_boot_enabled = true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#cloud-config
2+
3+
users:
4+
- default
5+
- name: terraform
6+
primary_group: terraform
7+
sudo: ALL=(ALL) NOPASSWD:ALL
8+
groups: sudo, wheel
9+
ssh_import_id: None
10+
lock_passwd: true
11+
ssh_authorized_keys:
12+
- <public_key>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
##################################################################################
2+
# VARIABLES
3+
##################################################################################
4+
5+
# Credentials
6+
7+
variable "vsphere_server" {
8+
type = string
9+
}
10+
11+
variable "vsphere_username" {
12+
type = string
13+
}
14+
15+
variable "vsphere_password" {
16+
type = string
17+
}
18+
19+
variable "vsphere_insecure" {
20+
type = bool
21+
default = false
22+
}
23+
24+
# vSphere Settings
25+
26+
variable "vsphere_datacenter" {
27+
type = string
28+
}
29+
30+
variable "vsphere_cluster" {
31+
type = string
32+
}
33+
34+
variable "vsphere_datastore" {
35+
type = string
36+
}
37+
38+
variable "vsphere_folder" {
39+
type = string
40+
}
41+
42+
variable "vsphere_network" {
43+
type = string
44+
}
45+
46+
variable "vsphere_content_library" {
47+
type = string
48+
}
49+
50+
variable "vsphere_content_library_ovf" {
51+
type = string
52+
}
53+
54+
# Virtual Machine Settings
55+
56+
variable "vm_name" {
57+
type = string
58+
}
59+
60+
variable "vm_cpus" {
61+
type = number
62+
}
63+
64+
variable "vm_memory" {
65+
type = number
66+
}
67+
68+
variable "vm_disk_size" {
69+
type = number
70+
}
71+
72+
variable "vm_firmware" {
73+
type = string
74+
}
75+
76+
variable "vm_efi_secure_boot_enabled" {
77+
type = bool
78+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
##################################################################################
2+
# VERSIONS
3+
##################################################################################
4+
5+
terraform {
6+
required_providers {
7+
vsphere = {
8+
source = "hashicorp/vsphere"
9+
version = ">= 2.0.2"
10+
}
11+
}
12+
required_version = ">= 1.0.10"
13+
}

0 commit comments

Comments
 (0)