-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathsource.nutanix.pkr.hcl
151 lines (123 loc) · 3.71 KB
/
source.nutanix.pkr.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
source "nutanix" "centos" {
nutanix_username = var.nutanix_username
nutanix_password = var.nutanix_password
nutanix_endpoint = var.nutanix_endpoint
nutanix_port = var.nutanix_port
nutanix_insecure = var.nutanix_insecure
cluster_name = var.nutanix_cluster
os_type = "Linux"
vm_disks {
image_type = "DISK_IMAGE"
source_image_name = var.centos_disk_image_name
disk_size_gb = 40
}
vm_nics {
subnet_name = var.nutanix_subnet
}
image_categories {
key = "TemplateType"
value = "Vm"
}
vm_categories {
key = "Environment"
value = "Dev"
}
// project = "myproject"
image_name = "centos-packer-image"
image_export = false
force_deregister = true
user_data = base64encode(file("scripts/cloud-init/cloud-config-centos.yaml"))
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
shutdown_timeout = "2m"
ssh_password = "packer"
ssh_username = "centos"
}
source "nutanix" "ubuntu" {
nutanix_username = var.nutanix_username
nutanix_password = var.nutanix_password
nutanix_endpoint = var.nutanix_endpoint
nutanix_port = var.nutanix_port
nutanix_insecure = var.nutanix_insecure
cluster_name = var.nutanix_cluster
os_type = "Linux"
vm_disks {
image_type = "DISK_IMAGE"
source_image_name = var.ubuntu_disk_image_name
disk_size_gb = 40
}
vm_nics {
subnet_name = var.nutanix_subnet
}
image_name = "ubuntu-packer-image"
force_deregister = true
user_data = base64encode(file("scripts/cloud-init/cloud-config-ubuntu.yaml"))
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
shutdown_timeout = "2m"
ssh_password = "packer"
ssh_username = "builder"
}
source "nutanix" "centos-kickstart" {
nutanix_username = var.nutanix_username
nutanix_password = var.nutanix_password
nutanix_endpoint = var.nutanix_endpoint
nutanix_port = var.nutanix_port
nutanix_insecure = var.nutanix_insecure
cluster_name = var.nutanix_cluster
os_type = "Linux"
vm_disks {
image_type = "ISO_IMAGE"
source_image_name = var.centos_iso_image_name
}
vm_disks {
image_type = "DISK"
disk_size_gb = 40
}
vm_nics {
subnet_name = var.nutanix_subnet
}
cd_files = ["scripts/ks.cfg"]
cd_label = "OEMDRV"
boot_priority = "disk"
image_name ="centos8-{{isotime `Jan-_2-15:04:05`}}"
shutdown_command = "echo 'packer' | sudo -S shutdown -P now"
shutdown_timeout = "2m"
ssh_password = "packer"
ssh_username = "root"
}
source "nutanix" "windows" {
nutanix_username = var.nutanix_username
nutanix_password = var.nutanix_password
nutanix_endpoint = var.nutanix_endpoint
nutanix_insecure = var.nutanix_insecure
cluster_name = var.nutanix_cluster
vm_disks {
image_type = "ISO_IMAGE"
source_image_name = var.windows_2016_iso_image_name
}
vm_disks {
image_type = "ISO_IMAGE"
source_image_name = var.virtio_iso_image_name
}
vm_disks {
image_type = "DISK"
disk_size_gb = 40
}
vm_nics {
subnet_name = var.nutanix_subnet
}
cd_files = ["scripts/gui/autounattend.xml","scripts/win-update.ps1"]
boot_priority = "disk"
image_name ="win-{{isotime `Jan-_2-15:04:05`}}"
shutdown_command = "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\""
shutdown_timeout = "3m"
cpu = 2
os_type = "Windows"
memory_mb = "8192"
communicator = "winrm"
winrm_port = 5986
winrm_insecure = true
winrm_use_ssl = true
winrm_timeout = "45m"
winrm_password = "packer"
winrm_username = "Administrator"
}