工具安装 | docker安装ansible-awx,dockeransible-awx
工具安装 | docker安装ansible-awx,dockeransible-awx
简介:
公司中实现运维自动化的架构中主要用到ansible,但是ansible脚本主要部署于服务器指令行中不太直观。经搜查资料,得知ansible tower(之前叫做awx)是将ansible的指令界面化,简明直观,简单易用,故搭建了一个ansible tower环境,与大家分享学习。
搭建过程
1、前期准备
防火墙配置
**firewalld**centos
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --add-service=http --permanent;firewall-cmd --add-service=https --permanent
systemctl restart firewalld
**iptable**
iptables -F #清空防火墙规则
iptables -X
iptables -Z
iptables-save #保存防火墙规则
systemctl stop firewalld && systemctl disable firewalld #关闭并开机不自启动firewalld
2、安装相关依赖包
yum install -y epel
yum install -y yum-utils device-mapper-persistent-data lvm2 ansible git python-devel python-pip python-docker-py vim-enhanced
安装docker
3、clone awx代码
git clone https://github.com/ansible/awx.git
cd awx
git clone https://github.com/ansible/awx-logos.git
4、配置inventory
cd installer
cat inventory | grep -v "#"
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python"
[all:vars]
dockerhub_base=ansible
dockerhub_version=latest
postgres_data_dir=/tmp/pgdocker
host_port=80
docker_compose_dir=/var/lib/awx
pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432
secret_key=awxsecret
awx_official=true
awx_alternate_dns_servers="4.2.2.1,4.2.2.1"
project_data_dir=/var/lib/awx/projects
5、编译安装awx
ansible-playbook -i inventory install.yml -vv
#安装结果
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d002f418ea09 ansible/awx_task:latest "/tini -- /bin/sh -c…" 33 minutes ago Up 33 minutes 8052/tcp awx_task
472f059c7ff6 ansible/awx_web:latest "/tini -- /bin/sh -c…" 33 minutes ago Up 33 minutes 0.0.0.0:80->8052/tcp awx_web
c0efec105374 memcached:alpine "docker-entrypoint.s…" 35 minutes ago Up 35 minutes 11211/tcp memcached
67c6d9fa48ad ansible/awx_rabbitmq:3.7.4 "docker-entrypoint.s…" 35 minutes ago Up 35 minutes 4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp rabbitmq
d47ec2dab181 postgres:9.6 "docker-entrypoint.s…" 35 minutes ago Up 35 minutes 5432/tcp postgres
6、安装测试
打开链接测试:http://ip
帐号:admin
密码:password
评论暂时关闭