首页 > 其他 > 详细

ansible&Tower无限hosts的License修改方法

时间:2015-10-10 12:48:44      阅读:10491      评论:1      收藏:0      [点我收藏+]

第一步:到官方申请一个免费的license,支持10个hosts

第二步:安装Tower,直接运行tower的setup.sh如果遇到报错,根据具体内容找到对应的playbook解决

Tower下载地址

第三步:反编译task_engine.pyc文件位置awx/awx/main,反编译工具EasyPythonDecompiler

easypythondecompiler下载

技术分享

反编译后的文件为task_engine.pyc_dis,文件重命名为task_engine.py

以下摘取license验证部分代码

def validation_info(self, show_key = True):
        if not self.fetch_ami() or not self.fetch_instance():
            return dict(valid_key=False, compliant=False)
        key = self.generate_key()
        if ‘license_key‘ not in self.attributes:
            self.set_key(key)
        read_key = self.attributes.get(‘license_key‘, ‘UNLICENSED‘)
        self.attributes[‘license_key‘] = read_key
        if key != read_key:
            return dict(valid_key=False, compliant=False)
        if Host:
            current_instances = Host.objects.active_count()
        else:
            current_instances = 0
        available_instances = int(self.attributes[‘instance_count‘])#修改这里
        self.attributes[‘current_instances‘] = int(current_instances)
        self.attributes[‘available_instances‘] = int(available_instances)
        self.attributes[‘free_instances‘] = available_instances - current_instances
        self.attributes[‘valid_key‘] = True
        self.attributes[‘license_date‘] = sys.maxint
        self.attributes[‘time_remaining‘] = sys.maxint
        self.attributes[‘grace_period_remaining‘] = sys.maxint
        self.attributes[‘date_warning‘] = False
        self.attributes[‘date_expired‘] = False
        self.attributes[‘is_aws‘] = True


修改内容

available_instances = int(self.attributes[‘instance_count‘])
available_instances = 10000

删除task_engine.pyc task_engine.pyo 重启tower

希望对你有帮助

本文出自 “Tower应用” 博客,请务必保留此出处http://tower.blog.51cto.com/3711105/1701339

ansible&Tower无限hosts的License修改方法

原文:http://tower.blog.51cto.com/3711105/1701339

(2)
(3)
   
举报
评论 一句话评论(1
2015-12-08 15:36:47
请问您是用什么版本的??我现在用的是2.4.1版本,提示反编译失败,请问可以破吗?还是低版本的可以用?
回复
 (8)
 (4)
1条  
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!