Ansible Tower 3.2.x 企业版无限hosts-八零岁月
记录所见
分享所感

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_license
vi __init__.py

新增120行, return True

 def _check_cloudforms_subscription(self):
 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__.py
python -O -m py_compile __init__.py

重启服务

ansible-tower-service restart

验证
打开–settings–VIEW YOUR LICENSE 查看

文章转载请说明出处:八零岁月 » Ansible Tower 3.2.x 企业版无限hosts

分享到:更多 ()

吐槽集中营 抢沙发

评论前必须登录!