Skip to content

Instantly share code, notes, and snippets.

@sotayamashita
Last active September 15, 2015 12:51
Show Gist options
  • Save sotayamashita/faab73265d2638124dd3 to your computer and use it in GitHub Desktop.
Save sotayamashita/faab73265d2638124dd3 to your computer and use it in GitHub Desktop.
🎓 Training - Getting started with Packer
Series Last Updated OS X Vagrant Packer
Training
16 Aug 2015
10.10.4
1.7.2
0.8.5

Packer とは

インストール

$ brew update && brew upgrade --all && brew cleanup
$ brew install packer
$ packer version
Packer v0.8.5

Packer の流れ

  1. builder 仮想マシンのベース作成
  2. Shell Script や Ansible などでプロビジョニング
  3. post-processor で特定の仮想マシンを書き出す

Packer を使ってやりたいこと

ハマったところ

sudo: sorry, you must have a tty to run sudo

問題

ssh で接続してコマンド実行しようとして、script 内で sudo を使用すると以下のようなエラーになる

sudo: sorry, you must have a tty to run sudo

解決方法

provisionersの部分に下記追加

"ssh_pty": true,

便利なサイト

  • Packer ... 公式サイト
  • Boxcutter ... Packer の各 OS でのテンプレートが配布されているので参考になります。

用語

  • AMI - Amazon Machine Imageの略。AWS EC2 で動く仮想マシンのインスタンス元。Vagrant の Box のようなもの。
  • Amazon Linux - Amazon が独自に開発している Read Hat 系の Linux ディストリビューション。
  • Packer - Pakcer は Vagrant の作者 Michel Hasimoto 氏によって作成された仮想マシンのイメージの作成を行うツール。

参照

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment