
ansible自动化 图形化工具---tower
一、环境
系统版本
root@template:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.7 LTS"
此次系统版本比较老,实际公司环境需使用当下长期稳定维护的服务器发行版
确保以下几点:
防火墙及SElinux均为关闭状态(如是 centos 系统)
服务器要配置网络,因为执行./setup的时候会联网安装很多的依赖包,安装速度和你的网速有关
yum源为阿里云yum源
不同Tower版本要求不同,请务必参考https://docs.ansible.com/ansible-tower/latest/html/installandreference/install_notes_reqs.html
二、安装 ansible
使用源安装
apt-get update
apt-get install software-properties-common -y
apt-add-repository --yes --update ppa:ansible/ansible
apt-get install ansible -y
运行命令查看是否安装成功
root@template:~# ansible --version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.12 (default, Mar 1 2021, 11:38:31) [GCC 5.4.0 20160609]
目录结构
三、安装tower
下载
wget https://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-latest.el7.tar.gz
tar -zxvf ansible-tower-setup-bundle-latest.el7.tar.gz -C /data/tower
cd /data/tower
目录结构,跟playbook类似
root@template:/data/tower# ll
total 72
-rw-r--r-- 1 root root 2506 May 4 2022 README.md
-rw-r--r-- 1 root root 626 May 4 2022 backup.yml
drwxr-xr-x 4 root root 4096 May 4 2022 bundle/
drwxr-xr-x 3 root root 4096 May 4 2022 collections/
drwxr-xr-x 2 root root 4096 May 4 2022 group_vars/
-rw-r--r-- 1 root root 8524 May 4 2022 install.yml
-rw-r--r-- 1 root root 3185 May 4 2022 inventory
drwxr-xr-x 3 root root 12288 May 4 2022 licenses/
-rw-r--r-- 1 root root 1439 May 4 2022 rekey.yml
-rw-r--r-- 1 root root 3492 May 4 2022 restore.yml
drwxr-xr-x 21 root root 4096 May 4 2022 roles/
-rwxr-xr-x 1 root root 11357 May 4 2022 setup.sh*
编辑inventory配置
[tower]
localhost ansible_connection=local
[database]
[all:vars]
admin_password='admin'
pg_host='127.0.0.1'
pg_port='5432'
pg_database='awx'
pg_username='awx'
pg_password='awx'
rabbitmq_port=5672
rabbitmq_vhost=tower
rabbitmq_username=tower
rabbitmq_password='tower'
rabbitmq_cookie=cookiemonster
# Isolated Tower nodes automatically generate an RSA key for authentication;
# To disable this behavior, set this value to false
# isolated_key_generation=true
# Needs to be true for fqdns and ip addresses
rabbitmq_use_long_name=false
运行脚本
./setup.sh
访问地址就是ip
web界面导航栏说明
# viewes
Dashboard 仪表盘展示信息的
Jobs 跑过的任务记录
Schedules 计划任务
My View 查看用户的工作模版,和任务记录
# resources
Templates 任务模版,配置调用playbook执行时的各种参数,从此处添加计划任务
Credentials 配置连接 机器/云主机api Key/自定义的凭证类型 的账号密码等信息
Projects 这里配置项目对应的playbook,可以从Git上拉取或从本地文件夹读取playbook
Inventories 资产清单
Inventory Scripts 自定义获取资产清单的脚本
# access
Organizations 组织管理
Users 用户管理
Teams 用户组管理
# Administration
Credential Types 自定义凭证类型,添加后可在Credentials中使用
Notifications 配置任务通知,支持电子邮件,Twillio电话等
Management Jobs 计划任务管理
Instance Groups 资产组管理
Applications 自定义应用
Settings 设置
注:详细使用说明请参考官方文档:https://docs.ansible.com/ansible-tower/latest/html/installandreference/install_notes_reqs.html
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 Oldhan's World
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果