У меня есть виртуальная среда Proxmox 6.1-3, и я могу создавать новые (Windows Server 2019) виртуальные машины через terraform на этой машине.
На следующем шаге я хочу использовать cloudbase-init установить имя пользователя, пароль и имя хоста. Я установил cloudbase-init на свой шаблон. В этом шаблоне мой cloudbase-init.conf:
[DEFAULT]
username=Admin
groups=Administratoren
inject_user_password=true
first_logon_behaviour=no
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService,
cloudbaseinit.metadata.services.httpservice.HttpService,
cloudbaseinit.metadata.services.ec2service.EC2Service,
cloudbaseinit.metadata.services.maasservice.MaaSHttpService
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,
cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,
cloudbaseinit.plugins.windows.setuserpassword.SetUserPasswordPlugin
# Miscellaneous.
allow_reboot=true # allow the service to reboot the system
# stop_service_on_exit=false
[config_drive]
raw_hhd=true
cdrom=true
vfat=true
В этом шаблоне мой cloudbase-init-unattended.conf:
[DEFAULT]
username=Admin
groups=Administrators
inject_user_password=true
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init-unattend.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=COM1,115200,N,8
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService,
cloudbaseinit.metadata.services.httpservice.HttpService,
cloudbaseinit.metadata.services.ec2service.EC2Service,
cloudbaseinit.metadata.services.maasservice.MaaSHttpService
plugins=cloudbaseinit.plugins.common.mtu.MTUPlugin,
cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,
cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin
allow_reboot=true
stop_service_on_exit=false
check_latest_version=false
Мой main.tf выглядит так основан на приведенном ниже примере (https://github.com/Telmate/terraform-provider-proxmox/blob/master/examples/cloudinit_example.tf)
provider "proxmox" {
pm_tls_insecure = true
pm_api_url = "https://192.168.0.209:8006/api2/json"
pm_password = "start0815!"
pm_user = "root@pam"
pm_otp = ""
}
resource "proxmox_vm_qemu" "cloudinit" {
name = "winsrv01"
desc = "A test for using terraform and cloudinit"
# Node name has to be the same name as within the cluster
# this might not include the FQDN
target_node = "proxmox"
# The template name to clone this vm from
clone = "NeueVM"
# Activate QEMU agent for this VM
agent = 0
os_type = "windows"
cores = "2"
sockets = "1"
#vcpus = "0"
cpu = "host"
memory = "2048"
scsihw = "lsi"
# Setup the disk. The id has to be unique
disk {
id = 0
size = 32
type = "virtio"
storage = "local-lvm"
storage_type = "rbd"
iothread = true
}
# Setup the network interface and assign a vlan tag: 256
network {
id = 10
model = "virtio"
bridge = "vmbr0"
tag = 256
}
# Setup the ip address using cloud-init.
# Keep in mind to use the CIDR notation for the ip.
ipconfig0 = "ip=192.168.0.211/24,gw=192.168.0.1"
}
Но я не могу установить службы userdata / metadata, которые необходимы для использования cloudbase-init.
Кто-нибудь знает, как это сделать или где почитать?