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

dirtysea 发表于 2018-9-6 13:40:22

Ansible Tower 3.2.x 企业版无限hosts

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

[*]ansible tower
[*]方法一 需要申请试用授权文件

[*]修改license验证
[*]方法二 无需申请试用授权文件

[*]修改license验证
[*]编译
[*]重启服务
[*]验证



方法一 需要申请试用授权文件修改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://img-blog.csdn.net/20180130195352188?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvQ29keUd1bw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast

https://blog.csdn.net/CodyGuo/article/details/78738584
页: [1]
查看完整版本: Ansible Tower 3.2.x 企业版无限hosts