当前位置: 首页 > 工具软件 > Ansible AWX > 使用案例 >

Centos 7 环境 Ansible AWX 安装使用

穆正青
2023-12-01
# wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
# wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
# yum localinstall -y docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm

service docker restart

docker info

安装 Ansible 依赖

安装包

# yum install -y ansible make git nodejs npm python python2-pip

python 模块

# yum -y install epel-release
# yum -y install python-pip
# pip install docker                           //必要的话可能要升级pip
# pip install docker-compose

运行部署 AWX

从 github 项目页下载安装包,我们使用的是1.0.7。

https://github.com/ansible/awx/releases

# wget https://github.com/ansible/awx/archive/1.0.7.tar.gz
# tar zxf 1.0.7.tar.gz
# cd  awx-1.0.7/installer/
# vi inventory
    修改参考:
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
use_docker_compose=true
docker_compose_dir=/var/lib/awx
docker_registry=192.168.128.137:5000                    //本机
docker_registry_repository=awx
docker_registry_username=developer
pg_username=awx
pg_password=awxpass
pg_database=awx
pg_port=5432
postgres_data_dir=/var/lib/awx/pgdata                //增加
secret_key=awxsecret
project_data_dir=/var/lib/awx/projects

安装部署

# ansible-playbook -i inventory install.yml

部署完成后查看容器运行

[root@localhost installer]# docker ps
CONTAINER ID        IMAGE                        COMMAND                  CREATED             STATUS              PORTS                                                 NAMES
296364cf7284        ansible/awx_task:latest      "/tini -- /bin/sh ..."   19 seconds ago      Up 17 seconds       8052/tcp                                              awx_task
41474b6550b6        ansible/awx_web:latest       "/tini -- /bin/sh ..."   47 seconds ago      Up 45 seconds       0.0.0.0:80->8052/tcp                                  awx_web
3d5f9709cfec        memcached:alpine             "docker-entrypoint..."   5 minutes ago       Up 5 minutes        11211/tcp                                             memcached
7a3086e6294d        ansible/awx_rabbitmq:3.7.4   "docker-entrypoint..."   5 minutes ago       Up 5 minutes        4369/tcp, 5671-5672/tcp, 15671-15672/tcp, 25672/tcp   rabbitmq
1b64b2961ee1        postgres:9.6                 "docker-entrypoint..."   5 minutes ago       Up 5 minutes        5432/tcp                                              postgres

在浏览器输入虚拟机服务器的 IP 地址,就可以访问 AWX 的登陆页面,默认账户用户名admin,密码password

 

 类似资料: