5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ansibleで管理するために一手間必要なディストリビューション

Last updated at Posted at 2014-08-28

Ansibleはpython2系が必要。ただしPython2.4ではモジュールが足りなくて動かない。

インストール直後ではAnsibleで管理できないサーバ

  • ArchLinux
    • pacman -Sy python2
  • CentOS5系
    • yum install python-simplejson
  • Debian4など
    • pythonが古すぎるのでpythonbrewを使う。

pythonbrew

pythonbrewをインストール

pythonbrew 1.3.5 : Python Package Indexを参考にpythonbrewをインストール

python2.7.3をインストール

pythonbrew list -k
pythonbrew install 2.7.3
pythonbrew use 2.7.3
sudo ln -s `which python` /usr/local/bin/python2.7.3

Debian4だとmercurialがインストールされているためにビルドに失敗した。

$ pythonbrew install 2.7.3
Use the previously fetched /home/owner/.pythonbrew/dists/Python-2.7.3.tgz
Extracting Python-2.7.3.tgz into /home/owner/.pythonbrew/build/Python-2.7.3

This could take a while. You can run the following command on another shell to track the status:
tail -f "/home/owner/.pythonbrew/log/build.log"

Patching Python-2.7.3
Installing Python-2.7.3 into /home/owner/.pythonbrew/pythons/Python-2.7.3
ERROR: Failed to install Python-2.7.3. See /home/owner/.pythonbrew/log/build.log to see why.

  • dpkg --purge mercurialして再度pythonbrew install 2.7.3すると成功した。

ansibleのhostsファイルでpythonのバージョン指定

hosts
[servers]
archlinux-server ansible_python_interpreter=python2
debian4-server ansible_python_interpreter=python2.7.3
centos5-server
5
4
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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?