Ansible @ Windows 挫折
AnsibleをWindowsに入れようと思った。 以下その理由。
- 自分の開発端末はMacだけど、ほとんどの人はそうではない。
- Chefでも良かったんだけど、「Chefは重厚すぎる」が最近の流れっぽい
- Python ならどこの環境でも同じように使えるだろう(と思っていたんだが、そうでもなかったみたい。)
ここからスタート http://www.ansibleworks.com/docs/gettingstarted.html
まずはpythonも入っていなかったので python 2.7.5 Windows版 64bitのMSI をダウンロード http://www.python.org/
そのままインストール。設定は全てデフォルトのまま
終わったらユーザの環境変数Pathに C:\Python27 を追加
コンソールを立ち上げて確認
C:\Users\carrotsword>python --version Python 2.7.5
setuptools をインストールしたいが最近はdistributeというパッケージのほうが主流らしい 以下のスクリプトを実行すればいいとどこかで探し当てた
http://python-distribute.org/distribute_setup.py
なんかC:\Python27\Scripts に入ったらしいので、そこにもパスを通す。 で確認
C:\Users\carrotsword>easy_install --version C:\Python27\Scripts\easy_install-script.py:5: UserWarning: Unbuilt egg for setup tools [unknown version] (c:\users\carrotsword\downloads\distribute-0.7.3) from pkg_resources import load_entry_point distribute 0.6.49
なんか警告出るんですけど・・・・。 よくわからないまま
https://pypi.python.org/pypi/distribute
からdistribute0.6.49をダウンロードして python setup.py install
してみたら警告はでなくなったみたいだ。しかし上記のページを見るとdistribute 0.7.3 があるんだけどこっちの方がいいのかなあ。
Ansibleのページに以下のパッケージを入れておくといいよとか書いてあるので入れてみる。
- paramiko
- PyYAML
- jinja2
paramikoはSSHのパッケージらしい。
C:\>easy_install paramiko Searching for paramiko Best match: paramiko 1.11.0 Processing paramiko-1.11.0-py2.7.egg paramiko 1.11.0 is already the active version in easy-install.pth Using c:\python27\lib\site-packages\paramiko-1.11.0-py2.7.egg Processing dependencies for paramiko Searching for pycrypto>=2.1,!=2.4 Reading http://pypi.python.org/simple/pycrypto/ Best match: pycrypto 2.6 Downloading https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.tar. gz#md5=88dad0a270d1fe83a39e0467a66a22bb Processing pycrypto-2.6.tar.gz Writing c:\users\carrotsword\appdata\local\temp\easy_install-lokwae\pycrypto-2.6\se tup.cfg Running pycrypto-2.6\setup.py -q bdist_egg --dist-dir c:\users\carrotsword\appdata\ local\temp\easy_install-lokwae\pycrypto-2.6\egg-dist-tmp-cdtwlt warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. error: Setup script exited with error: Unable to find vcvarsall.bat
なんだこれ。 調べてみたらVisualStudioが必要らしい。 仕方ないのでインストールしてみたが、状況変わらず。
http://www.voidspace.org.uk/python/modules.shtml#pycrypto から暗号かモジュールなのかな?をダウンロードしてきてインストールしたらparamikoのインストールも通るようになった。
次PyYAML入れようとしたけどこれもエラーで入らない。 仕方ないので飛ばしてjinja2
C:\Python27>easy_install jinja2 Searching for jinja2 Reading http://pypi.python.org/simple/jinja2/ Best match: Jinja2 2.7.1 Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.1.tar.gz#md5=282aed153e69f970d6e76f78ed9d027a Processing Jinja2-2.7.1.tar.gz Writing c:\users\carrotsword\appdata\local\temp\easy_install-ah0ocl\Jinja2-2.7.1\setup.cfg Running Jinja2-2.7.1\setup.py -q bdist_egg --dist-dir c:\users\carrotsword\appdata\local\temp\easy_install-ah0ocl\Jinja2-2.7.1\egg-dist-tmp-qfoq2k warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'docs\_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Adding jinja2 2.7.1 to easy-install.pth file Installed c:\python27\lib\site-packages\jinja2-2.7.1-py2.7.egg Processing dependencies for jinja2 Searching for markupsafe Reading http://pypi.python.org/simple/markupsafe/ Best match: MarkupSafe 0.18 Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.18.tar.gz#md5=f8d252fd05371e51dec2fe9a36890687 Processing MarkupSafe-0.18.tar.gz Writing c:\users\carrotsword\appdata\local\temp\easy_install-kgyzax\MarkupSafe-0.18\setup.cfg Running MarkupSafe-0.18\setup.py -q bdist_egg --dist-dir c:\users\carrotsword\appdata\local\temp\easy_install-kgyzax\MarkupSafe-0.18\egg-dist-tmp-msdhto ========================================================================== WARNING: The C extension could not be compiled, speedups are not enabled. Failure information, if any, is above. Retrying the build without the C extension now. ========================================================================== WARNING: The C extension could not be compiled, speedups are not enabled. Plain-Python installation succeeded. ========================================================================== Adding markupsafe 0.18 to easy-install.pth file Installed c:\python27\lib\site-packages\markupsafe-0.18-py2.7.egg Finished processing dependencies for jinja2 C:\Python27>
なんか入ったらしいけどこれも警告はいてますな。
ぶっちゃけ全然Ansibleに到達していないんだけどもうここで萎えた。VS入れろとかあれ入れろコレ入れろでは今回うまくやったとしても他の人に引き継ぐハードルが上がりすぎる。 Chefはそんな事しなくてもgemでほとんどうまく行った気がするけど、よく考えたらPuTTYとかrsyncとかバイナリは必要だったか。 Javaでこういうの作ったらええんかね。