首页 > 代码库 > Ansible Tower01
Ansible Tower01
文档:http://docs.ansible.com/ansible-tower/
本文以Ansible-tower-3.1.2 OS为CentOS7.2为例。
一、安装前注意事项
The Tower installer creates a self-signed SSL certificate and keyfile at /etc/tower/tower.cert and /etc/tower/tower.key for HTTPS communication. These can be replaced after install with your own custom SSL certificates if you desire, but the filenames are required to be the same.(如果需要替换之前的/etc/tower/tower.cert、/etc/tower/tower.key证书,需要保证替换之后的证书和之前的证书名称相同)
If using Ansible version 1.8 or later, ensure that fact caching using Redis is not enabled in ansible.cfg on the Tower machine.(如果使用可执行版本1.8或更高版本,请确保在Ansible Tower上的ansible.cfg中未启用使用Redis的fact caching。)
Note that the Tower installation must be run from an internet connected machine that can install software from trusted 3rd-party places such as Ansible’s software repository, and your OS vendor’s software repositories.(请注意,Tower安装必须通过互联网连接的机器运行,该机器可以从可靠的第三方场所安装软件,如Ansible的软件仓库和您的OS供应商的软件库。)
(1)支持的操作系统:
Red Hat Enterprise Linux 7 64-bit
CentOS 7 64-bit
Ubuntu 14.04 LTS 64-bit
Ubuntu 16.04 LTS 64-bit
注意:Ansible Tower requires Red Hat Enterprise Linux 7.2 or later.
(2)最少2G内存,推荐4G+内存
(3)20 GB of dedicated hard disk space(20 GB专用硬盘空间)
10 GB of the 20 GB requirement must be dedicated to /var/, where Tower stores its files and working directories (dedicating less space will cause the installation to fail)
(4)64-bit support required (kernel and runtime)
二、安装过程
1.下载ansible tower
下载地址:http://releases.ansible.com/ansible-tower/setup/
含有安装包文件的版本:http://releases.ansible.com/ansible-tower/setup-bundle/
wget http://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-latest.el6.tar.gz tar zxvf ansible-tower-setup-bundle-latest.el7.tar.gz cd ansible-tower-setup-bundle-3.1.2-2.el7
2.安装ansible tower
a.设置主机信息
sed -i "s#admin_password=‘‘#admin_password=‘123456‘#g" inventory sed -i "s#pg_host=‘‘#pg_host=‘127.0.0.1‘#g" inventory sed -i "s#pg_port=‘‘#pg_port=‘5432‘#g" inventory
b.修改yum源(操作中并没有修改,原地址也挺快)
sed -i ‘s#dl.fedoraproject.org/pub#mirrors.ustc.edu.cn#g‘ roles/packages_el/defaults/main.yml sed -i ‘s/#baseurl=/baseurl=/g‘ roles/packages_el/files/epel-6.repo sed -i ‘s/mirrorlist=/#mirrorlist=/g‘ roles/packages_el/files/epel-6.repo sed -i ‘s#download.fedoraproject.org/pub#mirrors.ustc.edu.cn#g‘ roles/packages_el/files/epel-6.repo yum -y install centos-release-scl-rh centos-release-scl sed -i ‘s#mirror.centos.org#centos.ustc.edu.cn#g‘ /etc/yum.repos.d/CentOS-SCLo-scl.repo sed -i ‘s#mirror.centos.org#centos.ustc.edu.cn#g‘ /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo yum -y install supervisor
c.安装Ansible tower
#./setup.sh
d.安装过程中遇到的问题
(1).在TASK [awx_install : Migrate the Tower database schema (may take awhile when upgrading).] 这一步会出现错误,提示信息是数据库连接不上
启动postgresql
service postgresql-9.4 initdb service postgresql-9.4 start
创建用户
su - postgres -bash-4.2$ psql postgres=# CREATE ROLE awx CREATEDB PASSWORD ‘admin‘ LOGIN; postgres=# \q -bash-4.2$ exit sed -i ‘s#peer#md5#g‘ /var/lib/pgsql/9.4/data/pg_hba.conf sed -i ‘s#ident#md5#g‘ /var/lib/pgsql/9.4/data/pg_hba.conf service postgresql-9.4 restart
测试awx用户连接,输入密码连接,并创建数据库
-bash-4.2$ psql -U awx -d postgres -h 127.0.0.1 postgres=# create database awx; postgres=# \q
再次./setup.sh进行安装tower
(2).在TASK中fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "This machine does not have sufficient RAM to run Ansible Tower."}
解决方法:增加内存,至少2G
(3).在TASK中fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "Please set rabbitmq_password in the inventory file before running setup"}
解决方法:安装RabbitMQ,具体见《RabbitMQ01》。
三、Web配置
访问Web界面,http://192.168.1.34/#/
用户名/密码为admin/123456
导入license
没有的话,点击REQUEST LICENSE,去官方申请免费试用。
提交license,就进入了DASHBOARD页面。
Ansible Tower01