09

packer を使ってみる。

ほんとに使ってみるだけシリーズ。 ドキュメントにはインストールはhomebrew でできるけどbinaryをtapしろと書かれている。

$ brew tap homebrew/binary

実行してみたけどgithub落ちてて終了

….

復帰したので試してみる

kitchen-mac:packer carrotsword$ brew tap homebrew/binary
Cloning into '/usr/local/Library/Taps/homebrew-binary'...
remote: Counting objects: 41, done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 41 (delta 17), reused 36 (delta 12)
Unpacking objects: 100% (41/41), done.
Tapped 4 formula
kitchen-mac:packer carrotsword$ brew install packer
==> Downloading https://dl.bintray.com/mitchellh/packer/0.3.4_darwin_amd64.zip
######################################################################## 100.0%
  /usr/local/Cellar/packer/0.3.4: 16 files, 102M, built in 63 second

とおもったけど、諸事情あってWindowsマシンで試すことになった。

VMWare workstation をインストールしないといけないようだ。 仕方ないのでとりあえず評価版をインストール。

こんな感じの設定を書いてみた。

{
  "builders" :[{
    "type": "vmware",
    "iso_url": "http://releases.ubuntu.com/12.04/ubuntu-12.04.2-server-amd64.iso",
    "iso_checksum": "af5f788aee1b32c4b2634734309cc9e9",
    "iso_checksum_type": "md5",
    "ssh_username": "packer",
    "ssh_wait_timeout": "30s",
    "shutdown_command": "shutdown -P now",
    "vm_name" : "iAP_intra",
    "http_directory" : "C:/develop/http-serv",
    "boot_command" : [
         "<esc><esc><enter><wait>",
         "/install/vmlinuz noapic ",
         "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
         "debian-installer=ja_JP auto locale=ja_JP kbd-chooser/method= ",
         "hostname={{ .Name }} ",
         "fb=false debconf/frontend=noninteractive ",
         "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=Japan ",
         "keyboard-configuration/variant=Japan console-setup/ask_detect=false ",
         "initrd=/install/initrd.gz -- <enter>"
       ]}
  ]
}

とりあえずVMはできてインストールは始まったけど途中で終わってる感。キーボードとか適当にJapanとか書いてるからかな。それともこの辺からkickstartが必要になるってことかな。

でもよく考えたら何十台もインストールする訳でもないので、やっぱり良いやと思って終了。これ多分ほんとにいくつも環境作る人じゃないと必要という程ではないんだろうなあ。個人的にはvmware のハイパーバイザ上にリモートからVM作れたりすると良いんだけど、いろいろ前提が整ってないしなあ。