Ansible-tower安装

Posted 可惜流年

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ansible-tower安装相关的知识,希望对你有一定的参考价值。

安装

安装包下载
https://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-3.6.0-1.el7.tar.gz
上传到服务器,(系统centos7.4+
解压

tar –xvzf ansible-tower-setup-bundle-3.6.0-1.el7.tar.gz
cd ansible-tower-setup-bundle-3.6.0-1/

修改配置文件

[root@tower ansible-tower-setup-bundle-3.6.0-1]# vim inventory
[tower]
localhost ansible_connection=local
 
[database]
 
[all:vars]
admin_password=\'tower\'   #tower登录密码
 
pg_host=\'\'
pg_port=\'\'
 
pg_database=\'awx\'
pg_username=\'awx\'
pg_password=\'tower\'
pg_sslmode=\'prefer\'  # set to \'verify-full\' for client-side enforced SSL
 
rabbitmq_username=tower
rabbitmq_password=\'tower\'
rabbitmq_cookie=cookiemonster


开始安装

安装之前需要先安装rsync, rsync是linux系统下的数据镜像备份工具

[root@tower ansible-tower-setup-bundle-3.6.0-1]# yum -y install rsync
[root@tower ansible-tower-setup-bundle-3.6.0-1]#./setup.sh

安装成功

访问https://ip

需要认证:

破解

[root@tower ~]# cd /var/lib/awx/venv/awx/lib/python3.6/site-packages/tower_license
[root@tower tower_license]# ll
total 8
-rw-r--r-- 1 root root 7764 Dec 14 01:39 __init__.pyc
drwxr-xr-x 2 root root   37 Jan 12 11:46 __pycache__
 
#安装pip
[root@tower tower_license]# wget https://bootstrap.pypa.io/get-pip.py
[root@tower tower_license]# python get-pip.py
[root@tower tower_license]# pip -V
pip 19.3.1 from /usr/lib/python2.7/site-packages/pip (python 2.7)
[root@tower tower_license]# pip install uncompyle6
 
#反汇编init.pyc
[root@tower tower_license]# uncompyle6 __init__.pyc >__init__.py
[root@tower tower_license]# ll
total 20
-rw-r--r-- 1 root root 11502 Jan 12 12:04 __init__.py
-rw-r--r-- 1 root root  7764 Dec 14 01:39 __init__.pyc
drwxr-xr-x 2 root root    37 Jan 12 11:46 __pycache__
 
#修改__init__.py文件
    def _check_cloudforms_subscription(self):
        return True    #添加这一行
        if os.path.exists(\'/var/lib/awx/i18n.db\'):
            return True
        else:
            if os.path.isdir(\'/opt/rh/cfme-appliance\'):
                if os.path.isdir(\'/opt/rh/cfme-gemset\'):
                    pass
            try:
                has_rpms = subprocess.call([\'rpm\', \'--quiet\', \'-q\', \'cfme\', \'cfme-appliance\', \'cfme-gemset\'])
                if has_rpms == 0:
                    return True
            except OSError:
                pass
 
            return False
....
 
#修改"license_date=253370764800L" 为 "license_date=253370764800"
    def _generate_cloudforms_subscription(self):
        self._attrs.update(dict(company_name=\'Red Hat CloudForms License\', instance_count=MAX_INSTANCES,
          license_date=253370764800,  #修改
          license_key=\'xxxx\',
          license_type=\'enterprise\',
          subscription_name=\'Red Hat CloudForms License\'))
...
 
#------------------------------------------------------------------

 
#修改完重新编译一下
[root@tower tower_license]# python -m py_compile __init__.py
[root@tower tower_license]# python -O -m py_compile __init__.py
[root@tower tower_license]# ll
total 36
-rw-r--r-- 1 root root 11521 Jan 12 12:08 __init__.py
-rw-r--r-- 1 root root  9181 Jan 12 12:08 __init__.pyc
-rw-r--r-- 1 root root  9181 Jan 12 12:08 __init__.pyo
drwxr-xr-x 2 root root    37 Jan 12 11:46 __pycache__
 
#重启服务
[root@tower tower_license]# ansible-tower-service restart
Restarting Tower
Redirecting to /bin/systemctl stop rh-postgresql10-postgresql.service
Redirecting to /bin/systemctl stop rabbitmq-server.service
Redirecting to /bin/systemctl stop nginx.service
Redirecting to /bin/systemctl stop supervisord.service
Redirecting to /bin/systemctl start rh-postgresql10-postgresql.service
Redirecting to /bin/systemctl start rabbitmq-server.service
Redirecting to /bin/systemctl start nginx.service
Redirecting to /bin/systemctl start supervisord.service

访问https://ip/#/license

破解成功

以上是关于Ansible-tower安装的主要内容,如果未能解决你的问题,请参考以下文章

为啥 Ansible-Tower 忽略了额外的变量?

Ansible-Tower自动化运维管理环境

Ansible Tower01

Red Hat Enterprise Linux 8.2 Install Ansible-Tower

Red Hat Enterprise Linux 8.2 Install Ansible-Tower

zabbix故障:apache源码和页面上的php红色提示