0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cloud-init

Last updated at Posted at 2025-10-07

デフォルトでUbuntu 24.04をインストールしたらnetplanにcloud-initが入っている。
これどうすべき?

cloud-initはAWS EC2、Azure、Google Cloud、OpenStack、LXDなどのクラウドサーバで使われるもので、仮想マシンを起動したときに「最初の設定(ネットワーク・ユーザ・SSHキーなど)」を自動で行う仕組みです。スタンドアロンだと不要なのだけどどう無効にするのか分からなかった。

cloud-initでネットワークの設定を上書きされないようにする方法

  1. mv /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak
  2. vi /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
    • network: {config: disabled}
  3. vi /etc/netplan/01-static.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s25:
      dhcp4: false
      addresses:
        - 192.168.10.100/24
      routes:
        - to: default
          via: 192.168.10.1
      nameservers:
        addresses: [8.8.8.8]

99が最優先に実行され、このコマンドでcloud-initの生成が抑制される。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?