cloud-init 家庭實驗室最簡單的資料來源是什麼?

cloud-init 家庭實驗室最簡單的資料來源是什麼?

我正在使用 cloud-init 22.1-14 在家庭伺服器上使用 Ubuntu 雲端映像和 kvm/qemu 來啟動虛擬機器。我認為我正處於需要實現資料來源的階段,因為如果我嘗試在 init 過程中寫入任意文件,我的虛擬機器創建就會終止。以下是我產生包含配置資料的 ISO 映像的操作。

cloud-localds --network-config=/srv/init/network-init.cfg /var/kvm/mldc-seed.qcow2 /srv/init/cloud-init.cfg

這是我嘗試使用不適用於 cloud-init 22.1-14 的語法編寫 .tmux.conf 檔案的範例。

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'

由於我關注了我安裝的cloud-init的版本,我寫入任意檔案的能力有所提升。現在我可以編寫任意數量的文字文件,而不會中斷 cloud-init 的運行。

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

答案1

如果我們不使用第三方或「外部」資料來源,我們使用的資料來源稱為 NoCloud。在本地運行 cloud-localds 意味著您正在使用 NoCloud。

相關內容