adamant-kite-43734
07/21/2023, 2:27 PMadventurous-battery-36116
07/23/2023, 1:21 PMmillions-ocean-48249
07/24/2023, 1:29 PM"guestinfo.interface.0.ip.0.address:ip:vswitch-pg"
To:
"guestinfo.interface.0.ip.0.address=ip:vswitch-pg"
I did get the properties to work as intended after making this change. I just need to get the cloud-init to run as expected. I will spend some time on this today. Last week it wasnt running at all seemingly so I was never getting the IP at the OS level, but the properties looked good in the vapp settings.adventurous-battery-36116
07/24/2023, 1:43 PMmillions-ocean-48249
07/25/2023, 8:44 PMfailureMessage": "Failure detected from referenced resource <http://rke-machine.cattle.io/v1|rke-machine.cattle.io/v1>, Kind=VmwarevsphereMachine with name \"test-blue-control-6ca3f5f1-wqzgg\": [cmdCreateInner] could not alter cloud-init file: existing userdata file does not begin with '#!' or '#cloud-config'"
Here is a copy of my cloud-config.yml:
#cloud-config
write_files:
- content: |
#!/bin/bash
vmtoolsd --cmd 'info-get guestinfo.ovfEnv' > /tmp/ovfenv
IPAddress=$(sed -n 's/.*Property oe:key="guestinfo.interface.0.ip.0.address" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
SubnetMask=$(sed -n 's/.*Property oe:key="guestinfo.interface.0.ip.0.netmask" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
Gateway=$(sed -n 's/.*Property oe:key="guestinfo.interface.0.route.0.gateway" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
DNS=$(sed -n 's/.*Property oe:key="guestinfo.dns.servers" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
cat > /etc/netplan/01-netcfg.yaml <<EOF
network:
version: 2
renderer: networkd
ethernets:
ens224:
addresses:
- $IPAddress/24
gateway4: $Gateway
nameservers:
addresses : [$DNS]
EOF
sudo netplan apply
path: /root/network_config.sh
permissions: '755'
- content: |
network: {config: disabled}
path: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
permissions: '644'
- content: |
net.ipv4.conf.all.forwarding=1
net.ipv6.conf.all.forwarding=1
path: /etc/sysctl.d/90-rke2.conf
permissions: '644'
users:
- default
- name: username
plain_text_passwd: 'passwordhere'
shell: /bin/bash
groups: wheel
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- ecdsa-sha2-nistp521 <keygohere>
runcmd:
- bash /root/network_config.sh
Do you have any ideas? I am at a bit of a loss. This is pretty much the last thing in the way of me getting this deployment rolling out.adventurous-battery-36116
07/25/2023, 10:05 PMexisting userdata
is the red flag for me. What are you using for an image and how are you preparing it? Incidentally, you could get rid of the /etc/sysctl.d/90-rke2.conf
as RKE2 setup will take care of that for you.adventurous-battery-36116
07/25/2023, 10:14 PMwrite_files:
- path: /etc/cool/example/file
defer: true
permissions: "0600"
content: ${jsonencode(script_file)}
millions-ocean-48249
07/26/2023, 2:15 PMmillions-ocean-48249
07/26/2023, 2:15 PMmillions-ocean-48249
07/26/2023, 2:57 PMmillions-ocean-48249
07/26/2023, 6:24 PMfile("${path.module}/files/cloud-init.yaml")
which should have worked fine, but I went ahead and just tested removing ${path.module}, and just referenced the file as:
file("files/cloud-init.yaml")
and now its working. user error.