容器云系列之基于Docker部署Ansible-Tower

15 篇文章 0 订阅
3 篇文章 0 订阅

本文简要介绍自动化运维工具Ansible可视化管理平台Ansible Tower。Ansible的自动化运维实现分三部分介绍:

容器云系列之基于Docker的Ansible自动化运维实现——介绍Ansible的基本概念和语法使用
容器云系列之Ansible部署使用——介绍Ansible的安装部署和使用
容器云系列之基于Docker部署Ansible-Tower——介绍使用Docker部署Ansible-Tower

3、基于Docker部署Ansible-Tower
3.1 Tower instance组成

Ansible Tower包括Web服务HTTP Service、通信队列RabbitMQ/Redis、Job作业处理单元Celery Workers和配置信息存储数据库PostgreSQL,如下图所示:

在这里插入图片描述

3.2 安装Ansible-Tower

1)下载awx代码

[root@tango-01 tmp]# git clone https://github.com/ansible/awx.git
[root@tango-01 tmp]# cd awx
[root@tango-01 awx]# git clone https://github.com/ansible/awx-logos.git

2)安装相关依赖包

[root@tango-01 installer]# pip3 install docker 
[root@tango-01 installer]# pip3 install docker-compose

否则会提示错误信息:

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 tango-01's Python /usr/local/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}

3)配置inventory

[root@tango-01 installer]# pwd
/tmp/awx/installer
[root@tango-01 installer]# vi inventory
localhost ansible_connection=local ansible_python_interpreter="/usr/bin/env python3"

[all:vars]
dockerhub_base=ansible
dockerhub_version=latest

awx_task_hostname=awx
awx_web_hostname=awxweb
postgres_data_dir="/tmp/pgdocker"
host_port=80
host_port_ssl=443

docker_compose_dir="/var/lib/awx"

pg_username=awx
pg_password=password
pg_database=awx
pg_port=5432

admin_user=admin
admin_password=password

project_data_dir=/var/lib/awx/projects

4)docker编译awx

[root@tango-01 installer]# ansible-playbook -i inventory install.yml
PLAY RECAP ****************************************************************************************************************************************************************
localhost                  : ok=15   changed=4    unreachable=0    failed=0    skipped=91   rescued=0    ignored=0

5)查看结果

[root@tango-01 installer]# docker container ls
CONTAINER ID        IMAGE                COMMAND                  CREATED             STATUS              PORTS                  NAMES
7a1329f43d63        ansible/awx:latest   "/usr/bin/tini -- /u…"   4 minutes ago       Up 3 minutes        8052/tcp               awx_task
056943a3889b        ansible/awx:latest   "/usr/bin/tini -- /b…"   4 minutes ago       Up 3 minutes        0.0.0.0:80->8052/tcp   awx_web
6bf445df5762        postgres:10          "docker-entrypoint.s…"   4 minutes ago       Up 3 minutes        5432/tcp               awx_postgres
d66b2caabfc0        redis                "docker-entrypoint.s…"   4 minutes ago       Up 3 minutes        6379/tcp               awx_redis

6)通过浏览器输入http://192.168.112.10:80即可访问AWX
在这里插入图片描述
输入用户admin和密码password
在这里插入图片描述


参考资料

  1. https://docs.ansible.com/ansible/latest/user_guide
  2. http://www.ansible.com.cn/
  3. https://docs.ansible.com/ansible-tower/3.2.4/html/administration/clustering.html

转载请注明原文地址:https://blog.csdn.net/solihawk/article/details/121958909
文章会同步在公众号“牧羊人的方向”更新,感兴趣的可以关注公众号,谢谢!
在这里插入图片描述

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值