I'm quite new to cloud init. I started documenting few days ago, but all what I found is related to KVM or cloud enviroments, and they does not rapresent my need.
I want to use cloud init in an bare metal environment (I'm using centOS). Let's say that I do not want to use cloud init for the the network configuration and all the other modules that are provided.
My need is to use cloud-init to launch a command when the server reboots... Suppose that I want to launch a touch commad:
touch /root/hello.txt
How do I have to configure cloud-init in order to achieve this?
I see that there are some files and folders inside /etc/cloud/:
/etc/cloud/cloud.cfg
/etc/cloud/cloud.cfg.d/
I see that inside the files /etc/cloud/cloud.cfg
there are all the boot stages...
Can you explain me step-by-step what I have to do in order to have my cloud-init that execute the command touch /root/hello.txt
at the next reboot (and get rid of all the other operations that are done).
I suppose that I have to set Datasource: NoCloud
, and crate meta-data
and user-data
, but I cannot figure out how to do that.
Thanks in advance!