I'm using cloud-init 22.1-14 to spin up VMs using Ubuntu cloud images and kvm/qemu on a home server. I think I'm at the stage where I need to implement a data source because my VM creation dies if I try to write arbitrary files as a part of my init. Here's what I do to generate an ISO image containing the configuration data.
cloud-localds --network-config=/srv/init/network-init.cfg /var/kvm/mldc-seed.qcow2 /srv/init/cloud-init.cfg
Here's an example of me trying to write a .tmux.conf file using syntax that does not work with cloud-init 22.1-14.
write_files:
- path: /home/msh/.tmux.conf
content: |
unbind C-b
set -g prefix C-a
bind-key C-a last-window
bind-key k confirm kill-window
owner: 'muh:adm'
permissions: '0640'
Since I paid attention to the version of cloud-init I had installed, my ability to write arbitrary files has improved. Now I can write any number of text files without breaking the cloud-init run.
write_files:
- content: |
set ts=2
set sts=2
set sw=2
set expandtab
path: /home/msh/.exrc
owner: root:root
permissions: '0660'
defer: true