LoginSignup
1
1

More than 5 years have passed since last update.

suz-lab CentOSでUserDataを使用する時のメモ

Last updated at Posted at 2016-04-24

こんにちは、ひろかずです。
suz-lab CentOSでインスタンス起動時にUsarDataに仕込んだスクリプト(Deep Securityを自分で有効化する)を実行させる際に、意外とハマったのでメモを残します。

参考情報

かっぱさんのブログ:本事象を理解し、切り分ける上で非常に助けになりました。
いまさらで恐縮ですが cloud-init について勉強する(1)

Developers.IO:こちらも非常に助かりました
Amazon Linuxのcloud-initの動きについて調べてみた

Developers.IO:よく纏まっていて、参考になります。
cloud-initのデフォルト挙動を徹底的に調べてまとめてみた -結果ソースコードを読んだ-

実行環境

suz-lab_centos-core-6.6-HVM (ami-e6c5c9e7)

何が必要だったか

ユーザ

useradd syslog -g adm -s /sbin/nologin

ユーザがないと、こんな感じに怒られます。

# less /var/log/cloud-init-output.log
:
Cloud-init v. 0.7.5 running 'init-local' at Fri, 22 Apr 2016 07:44:22 +0000. Up 948.21 seconds.
2016-04-22 16:44:22,057 - util.py[WARNING]: Unable to change the ownership of /var/log/cloud-init.log to user syslog, group adm
:

cloud-initの起動順序

cloud-init関連の起動順序をAmazon Linuxと同じにしました。

▼ before

# ls -l /etc/rc3.d/ | grep cloud
lrwxrwxrwx  1 root root 22  4月 23 07:23 2016 K50cloud-config -> ../init.d/cloud-config
lrwxrwxrwx  1 root root 26  4月 23 07:23 2016 K50cloud-init-local -> ../init.d/cloud-init-local
lrwxrwxrwx  1 root root 21  4月 23 07:23 2016 S50cloud-final -> ../init.d/cloud-final
lrwxrwxrwx  1 root root 20  4月 23 07:23 2016 S50cloud-init -> ../init.d/cloud-init

▼ after

# ls -l /etc/rc3.d/ | grep cloud
lrwxrwxrwx  1 root root 26  4月 23 07:23 2016 S50cloud-init-local -> ../init.d/cloud-init-local
lrwxrwxrwx  1 root root 20  4月 23 07:23 2016 S51cloud-init -> ../init.d/cloud-init
lrwxrwxrwx  1 root root 22  4月 23 07:23 2016 S52cloud-config -> ../init.d/cloud-config
lrwxrwxrwx  1 root root 21  4月 23 07:23 2016 S98cloud-final -> ../init.d/cloud-final

今回はいろいろ勉強になりました。

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