How to install Ansible and Openstack on Centos v7

Install Ansible and Openstack client should be easy jobs, however, due to the conflict of underlying package, you may need some help of this guide.

Step-by-step guide


Reference guides:

  1. Ansible installation on Centos
  2. openstack installation guide

Installation Step 0-6:

Step 0. create a centos server for the installation.

We assume you use centos v7.

you can use ‘centos-7-heat-raw’ image to create a instance in catalyst cloud for instance.

Step 1. check if python is installed

$python

Step 2. install pip

# install epel-release (already installed on centos-7-heat-raw)
$sudo yum install epel-release
# update all the installed package
$sudo yum -y update
# install pip (already installed on centos-7-heat-raw)
$sudo yum install python-devel python-pip

Step 3. update pip, setuptools and wheel

# already up-to-date on centos-7-heat-raw
$sudo python -m pip install –upgrade pip
# update from 40.0.0 to 40.4.1
$sudo python -m pip install –upgrade setuptools
# installed wheel-0.31.1
$sudo python -m pip install –upgrade wheel

Step 4. install openstackclient

$sudo pip install python-openstackclient

#if you see error message: you may miss gcc on your os Install gcc can solve this problem.

Building wheels for collected packages: subprocess32

no acceptable C compiler found in $PATH

…..

Failed building wheel for subprocess32

install gcc:
$ yum install gcc

#if you see error message: You need to manually remove this package so that the installation can continue.

Cannot uninstall ‘requests’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

pip show request

cd /usr/lib/python2.7/site-packages

rm -r requests

rm -r requests-2.6.0-py2.7.egg-info

pip list

#if you see error message: Same as the previous error. Manually remove the package. You may see more of this message depends on what machine image you start with.

Cannot uninstall ‘ipaddress’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

pip show ipaddress

cd /usr/lib/python2.7/site-packages

rm ipaddress*

pip list

#if you see error message: could be because of package such as in this case gopfile.cache is not properly installed, so force to reinstall openstack client can solve this problem.

File “/usr/lib/python2.7/site-packages/dogpile/cache/region.py”, line 15, in <module>
from decorator import decorate
ImportError: cannot import name decorate

pip install –ignore-installed python-openstackclient

Step 5. install ansible

$sudo yum install ansible

# error: after install ansible, openstackclient stop working

Step 6. fix the problem by uninstall and reinstall pyOpenSSL and crytography

#lower the version of cryptography from 2.3 to 1.7.2
$sudo pip uninstall pyOpenSSL cryptography
$sudo pip install pyOpenSSL cryptography

Step 7. install load balancing client (if needed)

$sudo pip install python-octaviaclient

log for the step 6 _______________________________________________________________________________________
[centos@jump ~]$ openstack network list

From cffi callback <function _verify_callback at 0x7f3681a91b90>:

Traceback (most recent call last):

AttributeError: ‘module’ object has no attribute ‘X509_up_ref’

Failed to discover available identity versions when contacting https://api.nz-hlz-1.catalystcloud.io:5000/v3. Attempting to parse version from URL.

From cffi callback <function _verify_callback at 0x7f3681a91d70>:

Traceback (most recent call last):

File “/usr/lib/python2.7/site-packages/OpenSSL/SSL.py”, line 309, in wrapper

_lib.X509_up_ref(x509)

AttributeError: ‘module’ object has no attribute ‘X509_up_ref’

SSL exception connecting to https://api.nz-hlz-1.catalystcloud.io:5000/v3/auth/tokens: HTTPSConnectionPool(host=’api.nz-hlz-1.catalystcloud.io‘, port=5000): Max retries exceeded with url: /v3/auth/tokens (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘ssl3_get_server_certificate’, ‘certificate verify failed’)],)”,),))

Google: File “/usr/lib/python2.7/site-packages/OpenSSL/SSL.py”, line 309, in wrapper

_lib.X509_up_ref(x509)

[centos@jump ~]$ pip show cryptography

Name: cryptography

Version: 2.3

Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.

Home-page: https://github.com/pyca/cryptography

Author: The cryptography developers

Author-email: cryptography-dev@python.org

License: BSD or Apache License, Version 2.0

Location: /usr/lib64/python2.7/site-packages

Requires: idna, enum34, six, cffi, asn1crypto, ipaddress

Required-by: pyOpenSSL, paramiko, openstacksdk, ansible

$sudo pip uninstall pyOpenSSL cryptography
$sudo pip install pyOpenSSL cryptography

[centos@jump ~]$ pip show cryptography

Name: cryptography

Version: 1.7.2

Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.

Home-page: https://github.com/pyca/cryptography

Author: The cryptography developers

Author-email: cryptography-dev@python.org

License: BSD or Apache License, Version 2.0

Location: /usr/lib64/python2.7/site-packages

Requires: idna, pyasn1, six, setuptools, enum34, ipaddress, cffi

Required-by: pyOpenSSL, paramiko, openstacksdk, ansible

_______________________________________________________________________________

Version 1.7.2 is the right version

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s