-3

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
mr.zog
  • 923
  • 3
  • 20
  • 39
  • I have learnt that I can tail /var/log/cloud-init.log and /var/log/cloud-init-output.log on the VM to find errors. Previously I had been looking at log files on the hypervisor (host), and that wasn't useful. – mr.zog May 01 '22 at 01:39
  • And by 'on the VM' I mean _in_ the VM. – mr.zog May 01 '22 at 01:54

1 Answers1

0

The data source we use if we don't use a third party or 'external' data source is called NoCloud. Running cloud-localds locally means you're using NoCloud.

mr.zog
  • 923
  • 3
  • 20
  • 39