LoginSignup
0
0

More than 5 years have passed since last update.

[Ansible入門] 1. Ansibleのインストール(pipを利用)

Last updated at Posted at 2016-09-25

今さらですが、CentOSに Ansibleをインストールしたので手順をメモっておきます
pipでインストールします
色々な方法でインストールできるみたいなので、他の方法を知りたい方は公式ページを参照ください

環境メモ

# OS
[vagrant@localhost ~]$ cat /etc/redhat-release
CentOS release 6.6 (Final) # vagrantで入れやすかったので
# Python
[vagrant@localhost ~]$ python --version
Python 2.6.6

pipのインストール

下記コマンドで一発

curl -kL https://bootstrap.pypa.io/get-pip.py | sudo python

Ansibleのインストール

sudo yum install gcc libffi-devel python-devel openssl-devel # 必要なパッケージを先にインストール
sudo pip install ansible

インストールしたバージョン

[vagrant@localhost ~]$ ansible --version
ansible 2.1.1.0
  config file =
  configured module search path = Default w/o overrides

遭遇したエラーなど

何もインストールせずに sudo pip install ansible やると下記のようなエラーでた

    build/temp.linux-x86_64-2.6/_openssl.c:70068: error: ‘_cffi_f_sk_X509_NAME_num’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70069: error: ‘_cffi_f_sk_X509_NAME_push’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70070: error: ‘_cffi_f_sk_X509_NAME_value’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70071: error: ‘_cffi_f_sk_X509_REVOKED_num’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70072: error: ‘_cffi_f_sk_X509_REVOKED_value’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70073: error: ‘_cffi_f_sk_X509_free’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70074: error: ‘_cffi_f_sk_X509_new_null’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70075: error: ‘_cffi_f_sk_X509_num’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70076: error: ‘_cffi_f_sk_X509_push’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70077: error: ‘_cffi_f_sk_X509_value’ undeclared here (not in a function)
    build/temp.linux-x86_64-2.6/_openssl.c:70787: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘init_openssl’
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lOBHHV/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-phrkUY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-lOBHHV/cryptography/

↓下記コマンドで解決

sudo yum install gcc libffi-devel python-devel openssl-devel

参考↓
http://stackoverflow.com/questions/22073516/failed-to-install-python-cryptography-package-with-pip-and-setup-py

0
0
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
0
0