This message was deleted.
# elemental
a
This message was deleted.
f
The MachineRegistration looks correct. This will make your command run at boot stage (
Before=getty.target
Unit), so I wonder if maybe the hostname is set to something different later on in the boot process. What are you experiencing the hostname to be? Also note the related doc: https://elemental.docs.rancher.com/hostname
q
right now it is that random "rancher-xy" but it should be the vmware set guestinfo.hostname. pretty sure that works when using the iso build by seedimage.yaml. will recheck this right now
f
on a second look, I think the schema you posted is incorrect:
Copy code
spec:
  config:
    elemental:
    cloud-config:
q
so it should be:
Copy code
elemental:
    registration:
        url: <https://dev.rancher2.xxx.com/elemental/registration/vx2l2wbdjglpqtrnsk9vpndz7md94mkdtth6q7qzc28p7c59g5rrbt>
        emulate-tpm: true
        emulated-tpm-seed: -1
        auth: tpm
cloud-config:
    runcmd:
        - hostnamectl set-hostname $(vmtoolsd --cmd "info-get guestinfo.hostname")
?
f
it's not clear where you are taking this from, are you trying to produce your own elemental-register configuration file?
I recommend to use the MachineRegistration instead and then the SeedImage builder functionality to produce a bootable iso. The CLI documentation offers some examples, in those the cloud-config is used to set the root credentials, but you can modify it: https://elemental.docs.rancher.com/quickstart-cli
Also note that the
elemental-register
will apply the
cloud-config
that has been defined in the remote MachineRegistration, so appending any cloud-config to the elemental-register config.yaml is ineffective
s
If I may jump in, there is a consideration to be made regarding the cloud-config. There
cloud-config
in a
SeedImage
is applied at ISO boot, and the
cloud-config
in a
MachineRegistration
is applied at boot of an installed system.
q
yes, i got the tip to do that command in seedimage and it works fine
s
If crafting manually the SeedImage
cloud-config
is the actual question then this is simple
the actual yaml file should be included into the ISO file system at this path:
Copy code
/iso-config/<my_yaml_file>.yaml
q
but i build iso images in a cicd with a push to vcenter in the end and it seems that the hostnamectl command is missing
``xorriso -indev $ISO.iso -outdev output/$ISO-$INSTANCE-$CI_COMMIT_SHORT_SHA.iso -map $CLUSTER-$INSTANCE.yaml /livecd-cloud-config.yaml -boot_image any replay``
where $CLUSTER-$INSTANCE.yaml is:
Copy code
elemental:
    registration:
        url: <https://dev.rancher2.xx.com/elemental/registration/vx2l2wbdjglpqtrnsk9vpndz7md94mkdtth6q7qzc28p7c59g5rrbt>
        emulate-tpm: true
        emulated-tpm-seed: -1
        auth: tpm
so how do i get the hostnamectl also into the image like it is done when using SeedImage manifest?
s
In addition to that, if you are using the same
cloud-init
syntax from the k8s resource, then the actual yaml file should include the appropriate shebang, so from your given SeedImage example, the yaml should looklike:
Copy code
#cloud-config

runcmd:
- hostnamectl set-hostname $(vmtoolsd --cmd "info-get guestinfo.hostname")
note the
#cloud-config
at the first line
q
Copy code
elemental:
    registration:
        url: <https://dev.rancher2.xx.com/elemental/registration/vx2l2wbdjglpqtrnsk9vpndz7md94mkdtth6q7qzc28p7c59g5rrbt>
        emulate-tpm: true
        emulated-tpm-seed: -1
        auth: tpm
#cloud-config
runcmd:
- hostnamectl set-hostname $(vmtoolsd --cmd "info-get guestinfo.hostname")
?
s
The xorriso flag we use to include the seedimage yaml in the ISO is:
Copy code
-map <my_custom_seedimage_cloud-config>.yaml /iso-config/cloud-config.yaml
Those are separate files, you should add an extra
-map
flag. Let me try to rewrite your example, hold on, I might need 5min to copy & paste and reshape it
See the following command (based on your example):
Copy code
xorriso -indev $ISO.iso -outdev output/$ISO-$INSTANCE-$CI_COMMIT_SHORT_SHA.iso -map $CLUSTER-$INSTANCE.yaml /livecd-cloud-config.yaml -map $SEEDIMG_CLOUDCONFIG /iso-config/cloud-config.yaml -boot_image any replay
Where the variable
$SEEDIMG_CLOUDCONFIG
expands to a path of a file with the following content:
Copy code
#cloud-config

runcmd:
- hostnamectl set-hostname $(vmtoolsd --cmd "info-get guestinfo.hostname")
So in the above command
/livecd-cloud-config.yaml
is the data that is used to actually register and the
/iso-config/cloud-config.yaml
is the
cloud-config
that is applied at ISO boot.
q
ok, i will try this. thank you 👍
works 👍
🎉 1