Upload
masahito-zembutsu
View
808
Download
0
Embed Size (px)
DESCRIPTION
インスタンス起動時に任意のスクリプトを実行する"Provisoning Script"の使い方。 http://softlayer.doorkeeper.jp/events/10880 Japan SoftLayer User Group Meetup #1 Lightning Talk Mar 23, Shinagawa, Tokyo, Japan
Citation preview
Provisioning Script
起動時に自動的にスクリプトを実行する話
@zembutsu
SoftLayer User Group #1 Lightning Talks #jslug
Provisioning Script
boot時に自動的にスクリプトを展開
自動実行 ( HTTPS )
なんでも実行できるよ!
例: SELinux の自動実行 や “rm –rf /”
Provisioning Script
boot時に自動的にスクリプトを展開
自動実行 ( HTTPS )
なんでも実行できるよ!
例: SELinux の自動実行 や “rm –rf /”
登録時のポイント
http … /root/ 直下にファイルを置くだけ
自動実行したいなら HTTPS に ( GIST が楽 )
登録時のポイント
http … /root/ 直下にファイルを置くだけ
自動実行したいなら HTTPS に ( GIST が楽 )
#!/bin/sh cp -p /etc/sysconfig/clock /etc/sysconfig/clock.orig cat <<EOF > /etc/sysconfig/clock ZONE="Asia/Tokyo" UTC=false ARC=false EOF mv /etc/localtime /etc/localtime.orig ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime cd tmp echo 'start' >> /tmp/serf.log date >> /tmp/serf.log wget -O 0.5.0_linux_amd64.zip https://dl.bintray.com/mitchellh/serf/0.5.0_linux_amd64.zip unzip 0.5.0_linux_amd64.zip mv ./serf /usr/bin/serf ln -s /usr/bin/serf /usr/local/bin/serf serf agent -join=10.55.114.194 -iface=eth0 & echo 'end' >> /tmp/serf.log date >> /tmp/serf.log
登録時のポイント
http … /root/ 直下にファイルを置くだけ
自動実行したいなら HTTPS に ( GIST が楽 )
[root@node1 ~]# ls -al /root/ 合計 3236 dr-xr-x---. 3 root root 4096 4月 15 16:15 2014 . dr-xr-xr-x. 22 root root 4096 4月 15 18:24 2014 .. -rw------- 1 root root 503 4月 15 17:48 2014 .bash_history -rw-r--r--. 1 root root 18 5月 20 19:45 2009 .bash_logout -rw-r--r--. 1 root root 176 5月 20 19:45 2009 .bash_profile -rw-r--r--. 1 root root 176 9月 23 12:59 2004 .bashrc -rw-r--r--. 1 root root 100 9月 23 12:59 2004 .cshrc drwxr-xr-x 2 root root 4096 4月 15 16:11 2014 .ssh -rw-r--r--. 1 root root 129 12月 4 06:42 2004 .tcshrc -rw------- 1 root root 305 4月 15 15:28 2014 post_install.8NUQ
Provisioning Script
アイディア次第で何でも出来るよ!
おわり