Ansible AWX installsteemCreated with Sketch.

in #ansible7 years ago

安装前置准备

安装ansible和一些依赖
yum install git ansible python2-pip make -y

配置阿里docker源
cat > /etc/yum.repos.d/docker.repo << EOF
[docker]
name=docker
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/
enabled=1
gpgcheck=0
EOF

安装docker并使用仓库加速
yum install docker-ce -y
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://4529fa45.m.daocloud.io
systemctl enable docker && systemctl start docker

安装docker-py
pip install -U docker-py

下载镜像
docker pull ansible/awx_task
docker pull ansible/awx_web
docker pull rabbitmq:3
docker pull postgres:9.6
docker pull memcached:alpine

做免密钥登录
ssh-keygen
ssh-copy-id 10.62.10.128

正式安装

克隆awx并安装
git clone https://github.com/ansible/awx
cd awx/installer/
ansible-playbook -i inventory install.yml

查看容器运行情况
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ea1a063678f ansible/awx_task:latest "/tini -- /bin/sh ..." 4 minutes ago Up 4 minutes 8052/tcp awx_task
2fbe5dc92891 ansible/awx_web:latest "/tini -- /bin/sh ..." 4 minutes ago Up 4 minutes 0.0.0.0:80->8052/tcp awx_web
b925b026e301 memcached:alpine "docker-entrypoint..." 5 minutes ago Up 5 minutes 11211/tcp memcached
051e2c1e1ac9 rabbitmq:3 "docker-entrypoint..." 5 minutes ago Up 5 minutes 4369/tcp, 5671-5672/tcp, 25672/tcp rabbitmq
4da240165079 postgres:9.6 "docker-entrypoint..." 5 minutes ago Up 5 minutes 5432/tcp postgres

查看日志:
docker logs -f awx_task

登录

http://10.62.10.128
admin
password

遇到的错误

错误1:

fatal: [10.62.10.128]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named docker. Try pip install docker-py"}
解决:
尝试使用pip install -U docker-py 不管用,后来使用yum install python-docker-py -y 解决。

错误2:

fatal: [10.62.10.128]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named 'requests.packages.urllib3'. Try pip install docker-py"}
解决:
pip install -U urllib3

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.033
BTC 93401.60
ETH 3112.38
USDT 1.00
SBD 3.04