LoginSignup
6
7

More than 5 years have passed since last update.

CoreOSインストール時に使ったcloud-configはどこに行ったの?

Last updated at Posted at 2016-02-14

自分でCoreOSをインストールするときには、初期設定を書き込んだcloud-configを読み込ませる。
ファイル一つでOSの設定を全部、賄えるとは、なんてお手軽なんだろう。

あれ?
ではインストール後に、そういった設定を変更したい場合にはどうしたらよいのだろう。
もちろん、CoreOSだってLinuxなんだから、/etc下に設定ファイルが転がっているのは百も承知。
しかしCoreOSなんだから、一つのファイルで全部、管理したいじゃないか。

答え:
インストール時に使用したcloud-configは、/var/lib/coreos-install/user_dataに保存されているので、これを書き換えればよい。

例。
インストール後に、CoreOSの更新方法を変える。
更新方法は/etc/coreos/update.confでも設定できるが、上述の理由から、敢えてuser_dateで操作する。

では早速。
/var/lib/coreos-install/user_dataに以下の行を加えればよい。
※以下の例ではreboot-strategyにbest-effortを指定している。

 coreos:
   update:
     reboot-strategy: best-effort

CoreOSをリブートすると、/etc/coreos/update.confに以下の通り、最後の一行が増えている。

$ cat update.conf
GROUP=stable
REBOOT_STRATEGY=best-effort

なお、CoreOSのバージョンは/etc/os-releaseに記載あり。

$ cat /etc/os-release
NAME=CoreOS
ID=coreos
VERSION=835.11.0
VERSION_ID=835.11.0
BUILD_ID=
PRETTY_NAME="CoreOS 835.11.0"
ANSI_COLOR="1;32"
HOME_URL="https://coreos.com/"
BUG_REPORT_URL="https://github.com/coreos/bugs/issues"

参考
https://github.com/coreos/coreos-cloudinit/blob/master/Documentation/cloud-config.md#update
https://coreos.com/os/docs/latest/update-strategies.html

https://coreos.com/os/docs/latest/cloud-config-locations.html
On every boot, coreos-cloudinit looks for a config file to configure your host. Here is a list of locations which are used by the Cloud-Config utility, depending on your CoreOS platform:

/var/lib/coreos-install/user_data
When you install CoreOS manually using the coreos-install tool. Usually used in bare metal installations.

6
7
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
6
7