作業ログ源泉垂れ流し

しがないIT技術者の作業ログを垂れ流す

Fedora CoreOSのインストール練習 2 〜自動アップデートの設定〜

前回の続き。

現在のFedora CoreOSでは、Zincatiを使って自動アップデートするように設定されていて、そのデフォルト設定では、アップデートの準備が出来ると自動でリブートするようになっている。
そこで、特定の曜日・時間にだけリブートするように設定してみる。

公式ドキュメントを参考にして、Zincatiの設定ファイルの内容を決める。
今回は、土日の朝4時〜6時の間だけリブートするように設定してみる。

[updates]
strategy = "periodic"

[updates.periodic]
time_zone = "Asia/Tokyo"

[[updates.periodic.window]]
days = [ "Sat", "Sun" ]
start_time = "4:00"
length_minutes = 120

まず、strategyperiodic を選ぶ。 time_zone を日本に設定して、days に曜日 Sat, Sun を指定し、リブート可能区間 (window) を 4:00 から 120分に設定している。

この設定ファイルを /etc/zincati/config.d/ の下に適当なファイル名で置けば良い。

Fedora CoreOSなので、Ignitionで配置するようにする。
Butan configを前回のものに書き足して作る。

variant: fcos
version: 1.3.0
passwd:
  users:
    - name: core
      ssh_authorized_keys:
        - (ssh公開鍵)
storage:
  files:
    - path: /etc/zincati/config.d/55-updates-strategy.toml
      contents:
        inline: |
          [updates]
          strategy = "periodic"
          [[updates.periodic.window]]
          days = [ "Sat", "Sun" ]
          start_time = "4:00"
          length_minutes = 120

前回同様にVMを作成する。

sshでログインして確認してみる。

host$ ssh core@coreos_ip_address
coreos$ cat /etc/zincati/config.d/55-updates-strategy.toml
[updates]
strategy = "periodic"
[updates.periodic]
time_zone = "Asia/Tokyo"
[[updates.periodic.window]]
days = [ "Sat", "Sun" ]
start_time = "4:00"
length_minutes = 120

Zincatiのログでも確認する。

$ sudo journalctl -b 0 -e -u zincati.service | grep strategy
Jun 09 08:53:49 localhost zincati[925]: [INFO ] update strategy: periodic, total schedule length 240 minutes; next window at 4:0 on Sat (Asia/Tokyo), subject to time zone caveats.

特定の曜日・時間にだけリブートするようにZincatiが設定できた!