服务器维护,服务器代维,安全设置,漏洞扫描,入侵检测服务

运维之家

 找回密码
 注册
搜索
查看: 5197|回复: 0

Ansible Tower 3.2.x 企业版无限hosts

[复制链接]
dirtysea 发表于 2018-9-6 13:40:22 | 显示全部楼层 |阅读模式
ansible tower

仅限于学习,非商业用途。





方法一 需要申请试用授权文件修改license验证
  • cd /var/lib/awx/venv/awx/lib/python2.7/site-packages/tower_license
  • vi __init__.py注释230行,新增两行
  • available_instances = 1000000
  • attrs['license_type'] = 'enterprise'


以下摘取license验证部分代码

  • def validate(self):    # Return license attributes with additional validation info.    attrs = copy.deepcopy(self._attrs)    key = attrs.get('license_key', 'UNLICENSED')    if not self._check_cloudforms_subscription() and (key == 'UNLICENSED' or key != self._generate_key()):        attrs.update(dict(valid_key=False, compliant=False))        return attrs    attrs['valid_key'] = True    attrs['deployment_id'] = hashlib.sha1(key).hexdigest()    if Host:        current_instances = Host.objects.active_count()    else:           current_instances = 0    #available_instances = int(attrs.get('instance_count', None) or 0)    available_instances = 1000000     attrs['license_type'] = 'enterprise'    attrs['current_instances'] = current_instances    attrs['available_instances'] = available_instances    attrs['free_instances'] = available_instances - current_instances

方法二 无需申请试用授权文件修改license验证
  • cd /var/lib/awx/venv/awx/lib/python2.7/site-packages/tower_licensevi __init__.py新增120行, return True119     def _check_cloudforms_subscription(self):120         return True


以下摘取license验证部分代码

    def __init__(self, **kwargs):        self._attrs = dict(            company_name='',            instance_count=0,            license_date=0,            license_key='UNLICENSED',        )        if not kwargs:            kwargs = getattr(settings, 'LICENSE', None) or {}        self._attrs.update(kwargs)        self._attrs['license_date'] = int(self._attrs['license_date'])        if not self._attrs.get('subscription_name', None):            self._attrs['subscription_name'] = self._generate_subscription_name()        if self._check_cloudforms_subscription():            self._generate_cloudforms_subscription()    def _generate_cloudforms_subscription(self):        self._attrs.update(dict(company_name="Red Hat CloudForms License",                                instance_count=9999999,                                license_date=253370764800,                                license_key='CodyGuo',                                license_type='enterprise',                                subscription_name='Red Hat CloudForms License'))    def _check_cloudforms_subscription(self):        return True        if os.path.exists('/var/lib/awx/i18n.db'):            return True        if os.path.isdir("/opt/rh/cfme-appliance") and os.path.isdir("/opt/rh/cfme-gemset"):            try:                has_rpms = subprocess.call(["rpm", "--quiet", "-q", "cfme", "cfme-appliance", "cfme-gemset"])                if has_rpms == 0:                    return True            except OSError:                pass        return False
编译
  • python -m py_compile __init__.pypython -O -m py_compile __init__.py
重启服务
ansible-tower-service restart
验证

打开–settings–VIEW YOUR LICENSE 查看



https://blog.csdn.net/CodyGuo/article/details/78738584


您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|手机版|Archiver|运维之家

GMT+8, 2024-3-29 05:47 , Processed in 0.150479 second(s), 14 queries .

Powered by Dirtysea

© 2008-2020 Dirtysea.com.

快速回复 返回顶部 返回列表