1
2

More than 5 years have passed since last update.

Ansible AWXをインストールしてみる

Last updated at Posted at 2019-08-02

Ansible AWXをインストールしてみる

この記事は
awxをインストールしてみた
https://qiita.com/matchpon23/items/7442632bd23b3cf0554e
を拝見してわずかにハマったのでメモとして残します。

前提

環境

  • AWS: t2.medium
  • OS: CentOS Linux release 7.6.1810 (Core)
  • Ansible AWX 6.1.0.0

まずは、上記のページを見て進んで行ってください。
多分、こんなエラーが出て進まなくなっている人が見てください。

1: 使用している python が古いと以下のエラーが出ます。

TASK [local_docker : Start the containers] **********************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on ip-172-30-0-125.ap-northeast-1.compute.internal's Python /bin/python. Please read module documentation and install in the appropriate location, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named docker"}

解決方法

1.ライブラリのインストール

yum -y install gcc zlib-devel bzip2 bzip2-devel readline readline-devel sqlite sqlite-devel openssl openssl-devel

2.pyenv installerのインストール

curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

3.以下の内容を実行

cat << 'EOS' >> ~/.bash_profile
export PATH="/root/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
EOS

source ~/.bash_profile

pyenv
pyenv 1.2.13
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   local       Set or show the local application-specific Python version
   global      Set or show the global Python version
   shell       Set or show the shell-specific Python version
   install     Install a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   which       Display the full path to an executable
   whence      List all Python versions that contain the given executable

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme

4.Python3系のインストール

pyenv install 3.6.9

5.インストールしたPythonを使用するように設定

pyenv global 3.6.9

6.インストールされているPythonの一覧を表示

pyenv versions
  system
* 3.6.9 (set by /root/.pyenv/version)

7.docker-compose もインストール

pip install docker-compose

8.再度 AWX のインストールを実行

ansible-playbook -i inventory install.yml

2: 使用している Python が新しすぎます

TASK [local_docker : Create Docker Compose Configuration] *******************************************************************
failed: [localhost] (item=environment.sh) => {"ansible_loop_var": "item", "changed": false, "checksum": "e369ef7b0186eef5f38dc16027878a3a6a0d9f0c", "item": "environment.sh", "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}
failed: [localhost] (item=credentials.py) => {"ansible_loop_var": "item", "changed": false, "checksum": "9d8c48ec0e65f6cc2aa8d1e2720f826b0f65551a", "item": "credentials.py", "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}
failed: [localhost] (item=docker-compose.yml) => {"ansible_loop_var": "item", "changed": false, "checksum": "130ffe64ef4d17371117cbc8bf0ee8fc666efe7f", "item": "docker-compose.yml", "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}

解決方法

1.一旦、古い python に切り替えます

pyenv global system

2.再度 AWX をインストール

ansible-playbook -i inventory install.yml

3.すると 1: のエラーになりますので以下を実施

pyenv global 3.6.9

4.再度 AWX をインストールします。

ansible-playbook -i inventory install.yml

3: Docker が止まってませんか?

TASK [local_docker : Start the containers] *************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))"}

解決方法

1.docker を再起動します

systemctl start docker

2.再度 AWX をインストールします。

ansible-playbook -i inventory install.yml

ハマったポイントはこの位だっとおもいます。

・2019/08/05追記
Ansible AWX 6.1.0 で随分解消された模様
Python 2.7 だけで問題なくインストールできました

1
2
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
1
2