Ansible-Tower安装与破解详细教程

Ansible是一款出色的自动化任务部署软件,Ansible Tower应该算是基于Ansible开发的一款商业的web自动化运维平台。Ansible Tower安装也相当简单,安装脚本自动化安装所有组件或者依赖,包括数据库,Ansible,Python,rsync等等。完全符合它自动化的理念。

1.环境准备

系统环境:CentOS8.2

官方最低配置要求:2核4G

Ansible Tower版本:3.7.3,根据官方要求系统需要CentOS7.7及之后的版本,并且在Tower3.6之后不再支持Ubuntu。

经实际测试,安装过程会检测系统内存,如果内存不足4G,安装会报错:

TASK [preflight : Preflight check - Fail if this machine lacks sufficient RAM.]
fatal: [localhost]: FAILED! => {"changed": false, "msg": "This machine does not have sufficient RAM to run Ansible Tower."}

根据官方建议:Only the “targeted” SELinux policy is supported. The targeted policy can be set to disabled, permissive, or enforcing.

我们直接关闭SeLinux,编辑/etc/selinux/conf,将SELINUXG修改为disabled

2.安装包下载

在线安装包只是包含一些配置文件,安装包在安装过程中是需要在线的下载的,在线下载很容易断开,没有条件的建议还是下载离线安装包安装;离线安装包包含了所有文件。

[root@AnsibleTower ansible-tower-setup-bundle-3.7.3-1]# tar xf ansible-tower-setup-bundle-3.7.3-1.tar.gz
[root@AnsibleTower ansible-tower-setup-bundle-3.7.3-1]# ls
backup.yml bundle group_vars install.yml inventory licenses README.md rekey.yml restore.yml roles setup.sh

3.安装

编辑配置文件inventory,admin_password和pg_password默认为空,一般只修改这两个参数即可,其他参数可以保持默认(有一部分参数没有截进来),有需求可以自定义。

root@AnsibleTower ansible-tower-setup-bundle-3.7.3-1]# cat inventory
[tower]
localhost ansible_connection=local
[database]
[all:vars]
admin_password='admin'
pg_host=''
pg_port=''
pg_database='awx'
pg_username='awx'
pg_password='awx'
pg_sslmode='prefer' # set to 'verify-full' for client-side enforced SSL

运行setup.sh进行安装:

[root@AnsibleTower ansible-tower-setup-bundle-3.7.3-1]# ./setup.sh
......
The setup process completed successfully.
Setup log saved to /var/log/tower/setup-2020-10-24-23:58:32.log.

4.访问

https://server_name

这时候登录是需要许可证的,接下来进行破解。

5.破解

[root@AnsibleTower tower_license]# cd /var/lib/awx/venv/awx/lib/python3.6/site-packages/tower_license
[root@AnsibleTower tower_license]# ll
total 12
-rw-r--r-- 1 root root 8348 Sep 29 04:36 __init__.pyc
drwxr-xr-x 2 root root 37 Oct 25 00:02 __pycache__

__init__.pyc是关于许可证信息的文件,pyc文件是 py程序编译后得到的字节码文件,是无法编辑的。这时候需要下载一个反编译器uncompyle6,这是python原生的反编译器。

进行反编译:

[root@AnsibleTower tower_license]# pip3 install uncompyle6
[root@AnsibleTower tower_license]# uncompyle6 __init__.pyc > __init__.py

编辑__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'):

将__init__.py重新编译:

[root@AnsibleTower tower_license]# python3 -m py_compile __init__.py
[root@AnsibleTower tower_license]# python3 -O -m py_compile __init__.py

重启服务:

[root@AnsibleTower tower_license]# ansible-tower-service restart

访问:https://server_name

6.申明

  • 本文涉及内容仅限个人学习研究之用,不得用于商业用途!
  • 商业使用请购买正版,谢谢!


「 文章如果对你有帮助,请点个赞哦^^ 」 

8+