特别说明
- 本文档没有特殊说明,均已root用户安装
2. 本文档中ftp传输文件的工具采用filezilla。
3. 本文档中的执行命令必须严格按照顺序而来。
4. 本文档中所用浏览器为Google Chrome。
基础安装
添加源
ssh连接到Tower服务器
[root]# cd /etc/yum.repos.d
[root]# touch ansible-tower.repo
[root]# touch media.repo
[root]# vi ansible-tower.repo
添加如下内容:
[tower]
name=Ansible Tower Offline Repository $releasever $basearch
baseurl=file:///var/lib/tower-bundle/tower
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ansible-release
cost=10
[epel_bundled]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=file:///var/lib/tower-bundle/epel
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
cost=10
[pgdg94]
name=PostgreSQL 9.4 $releasever - $basearch
baseurl=file:///var/lib/tower-bundle/pgdg94
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-94
cost=10
[mongodb-org]
name=MongoDB Repository
baseurl=file:///var/lib/tower-bundle/mongodb-org
gpgcheck=0
enabled=1
cost=10
[jlaska-proot]
name=Copr repo for proot owned by jlaska
baseurl=file:///var/lib/tower-bundle/jlaska-proot
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/jlaska-proot-epel.gpg
enabled=1
enabled_metadata=1
cost=10
[root]# vi media.repo
添加如下内容:#xx.xx.xx.xx换成Yum服务器IP地址
[rhel-7-server-rpms]
name=rhel-7-server-rpms
baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-rpms
gpgcheck=0
enabled=1
[rhel-7-server-extras-rpms]
name=rhel-7-server-extras-rpms
baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-extras-rpms
gpgcheck=0
enabled=1
[rhel-7-server-optional-rpms]
name=rhel-7-server-optional-rpms
baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-optional-rpms
gpgcheck=0
enabled=1
[rhel-7-server-ose-3.1-rpms]
name=rhel-7-server-ose-3.1-rpms
baseurl=http://xx.xx.xx.xx/repos/rhel-7-server-ose-3.1-rpms
gpgcheck=0
enabled=1
[zabbix247]
name=zabbix247
baseurl=http://xx.xx.xx.xx/repos/zabbix247
gpgcheck=0
enabled=1
将所需依赖拷贝至Tower服务器
将ansible-tower-setup-bundle-2.4.3-1.el7.tgz,lisence.rtf,rpm-gpg.zip,task_engine.pyo,tower-bundle.zip,xlrd-0.9.4.tar.gz,gen_inventory.py,project.zip拷贝至Tower服务器中。
SSH登录到Tower服务器
[root]# cd ~
[root]# scp -r root@xx.xx.xx.xx:/data/tower/ . #xx.xx.xx.xx表示跳转机IP地址
The authenticity of host ‘172.16.1.120 (172.16.1.120)’ can’t be established.
RSA key fingerprint is b4:3c:68:d5:a7:fe:6e:b8:37:aa:84:8a:94:0c:b3:e9.
Are you sure you want to continue connecting (yes/no)? Yes *[输入Yes回车]
Warning: Permanently added ‘172.16.1.120’ (RSA) to the list of known hosts.
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Kernel \r on an \m
root@172.16.1.120’s password: [输入密码回车回车]
拷贝成功过下图所示:
[root]# unzip tower-bundle.zip -d /var/lib
[root]# unzip -o rpm-gpg.zip -d /etc/pki/
[root]# tar -zxvf xlrd-0.9.4.tar.gz
[root]# cd xlrd-0.9.4
[root]# python setup.py install
[root]# cd /root
[root]# tar -zxvf ansible-tower-setup-bundle-2.4.3-1.el7.tgz
[root]# cd ansible-tower-setup-bundle-2.4.3-1.el7
[root]# ./configure
执行这个文件:./configure,会交互式收集安装信息,按照如下顺序应答:
第一个问题:回车
第二个问题:i
第三个问题:admin
确认密码:admin
第四个问题:y
[root]# ./setup.sh
安装成功如下图所示:
[root]# cd /root
[root]# cp get_inventory.py /var/lib/awx
[root]# ssh-keygen -t rsa -P ‘’
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 【回车】
Created directory ‘/root/.ssh’.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
4b:d1:b8:eb:b9:79:93:1e:a7:6d:07:33:32:14:74:d1 root@i-psx9pwbx
The key’s randomart image is:
+—[ RSA 2048]——+
| .. oo |
| o.. E |
| o .. |
| o. |
| S. |
| . oo + |
| o .+.+ |
| . o+=. . |
| =+oo.. |
+————————-+
[root]# cp task_engine.pyo /usr/lib/python2.7/site-packages/awx/main/task_engine.pyo [提示覆盖,请输入Y]
[root]# chmod u+x get_inventory.py
[root]# unzip -o projects.zip -d /var/lib/awx/
[root]# systemctl restart httpd
登录Tower服务器初始化配置
浏览器中输入Tower服务器的IP地址
选择“继续前往XX.XX.XX.XX(不安全)”
输入Tower的用户名和密码,点击 Sign in 。默认用户名和密码为:admin/admin
将注册的License拷贝至“1”中,并将“2”选中,点击“Submit”。
提交完成表示整个Tower初始化成功。
初始化认证
点击右上角的图标。
点击Credentials
点击右边图标。
填写完上面信息,鼠标滑到最下面,点击“Save”保存。
参考资料
Ansible Tower官网:
https://www.ansible.com/tower
ansible&Tower无限hosts的License修改方法
http://tower.blog.51cto.com/3711105/1701339/