ansible tower是ansible的一个图形化界面,IT自动化的管理平台,本文整理了安装过程中的步骤以及碰到的坑。
前提条件 
操作系统版本:
Red Hat Enterprise Linux 7.4 or later 64-bit 
CentOS 7.4 or later 64-bit 
Ubuntu 16.04 LTS 64-bit 
 
数据库版本:
PostgreSQL version 9.6.X以上 
Ansible version 2.2 (最低版本) 来运行 Ansible Tower versions 3.2以上 
 
Tower安装 
下载
1 2 3 4 wget https://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-latest.el7.tar.gz -P /root/tower/ cd /root/tower/ tar xvf ansible-tower-setup-bundle-latest.el7.tar.gz -C ./ cd ansible-tower-setup-bundle-3.4.3-1.el7/ 
目录结构,跟playbook类似
1 2 3 4 5 6 7 8 9 10 11 [root@zabbix-stb ansible-tower-setup-bundle-3.4.3-1.el7]# ll 总用量 52 -rw-r--r--  1 root root   143 3月  27 07:55 backup.yml drwxr-xr-x  2 root root    17 3月  27 07:55 group_vars -rw-r--r--  1 root root  8314 3月  27 07:55 install.yml -rw-r--r--  1 root root   494 5月  20 16:37 inventory drwxr-xr-x  3 root root  8192 3月  27 07:55 licenses -rw-r--r--  1 root root  2526 3月  27 07:55 README.md -rw-r--r--  1 root root  1393 3月  27 07:55 restore.yml drwxr-xr-x 20 root root   320 3月  27 07:55 roles -rwxr-xr-x  1 root root 11068 3月  27 07:55 setup.sh 
编辑inventory配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 [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 
运行脚本
限制
1 echo codyguo > /var/lib/awx/i18n.db 
访问地址就是ip
简介 
导航栏说明
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 # 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            设置 
导入现有的主机
1 2 3 4 5 6 [root@ ansible-tower-setup-bundle-3.4.3-1.el7]# tower-manage inventory_import --source=/root/hosts --inventory-id=2     2.704 INFO     Updating inventory 2: 所有主机     2.859 INFO     Reading Ansible inventory source: /root/hosts     4.627 INFO     Processing JSON output...     4.632 INFO     Loaded 10 groups, 184 hosts     6.417 INFO     Inventory import completed for  (所有主机 - 7) in 3.7s