centos6.5快速安装Ansible Tower 3.0.4

  资源

yum install -y ansible
wget http://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-latest.el6.tar.gz
tar zxf ansible-tower-setup-bundle-latest.el6.tar.gz #centos6最高支持到3.0.4
cd ansible-tower-setup-bundle-3.0.4-1.el6

sed -i “s#password=”#password=’admin’#g” inventory
sed -i “s#host=”#host=’127.0.0.1’#g” inventory
sed -i “s#port=”#port=’5432’#g” inventory

sed -i ‘s#dl.fedoraproject.org/pub#mirrors.ustc.edu.cn#g’ roles/packages_el/defaults/main.yml
sed -i ‘s/#baseurl=/baseurl=/g’ roles/packages_el/files/epel-6.repo
sed -i ‘s/mirrorlist=/#mirrorlist=/g’ roles/packages_el/files/epel-6.repo
sed -i ‘s#download.fedoraproject.org/pub#mirrors.ustc.edu.cn#g’ roles/packages_el/files/epel-6.repo

yum -y install centos-release-scl-rh centos-release-scl
sed -i ‘s#mirror.centos.org#centos.ustc.edu.cn#g’ /etc/yum.repos.d/CentOS-SCLo-scl.repo
sed -i ‘s#mirror.centos.org#centos.ustc.edu.cn#g’ /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

vim roles/preflight/defaults/main.yml
修改为minimum_var_space: 1000000

bash setup.sh

TASK [awx_install : Migrate the Tower database schema (may take awhile when upgrading).]
#这个任务会报错,数据库连不上,需要初始化postgresql

service postgresql-9.4 initdb
service postgresql-9.4 start
chkconfig postgresql-9.4 on

su – postgres
psql
\password postgres; #输入两次密码 123456
CREATE ROLE awx CREATEDB PASSWORD ‘admin’ LOGIN;
\q
sed -i ‘s#peer#md5#g’ /var/lib/pgsql/9.4/data/pg_hba.conf
sed -i ‘s#ident#md5#g’ /var/lib/pgsql/9.4/data/pg_hba.conf

service postgresql-9.4 restart

创建数据库
psql -U awx -d postgres -h 127.0.0.1 #admin
create database awx;
\q

创建完后继续安装
安装完成后用https://hostip登录
用户名/密码为admin admin
导入license,点击REQUEST LICENSE,去官方申请免费试用
申请到的证书为json格式,保存为文本文件导入

#破解证书的hosts数量
find / -name task_engine.pyc
/var/lib/awx/venv/tower/lib/python2.7/site-packages/awx/main/task_engine.pyc
下载python反编译工具
https://link.jianshu.com/?t=http://sourceforge.net/projects/easypythondecompiler/
反编译task_engine.pyc,保存为task_engine.py
修改task_engine.py89行和186行代码
将available_instances = int(self.attributes[‘instance_count’]) 改为available_instances = 10000
修改247行代码,把相应的功能由False改为True #注意windows下不要用tab改,影响缩进
删除/var/lib/awx/venv/tower/lib/python2.7/site-packages/awx/main/task_engine.py* ,将修改后的task_engine.py文件上传到tower上
/var/lib/awx/venv/tower/lib/python2.7/site-packages/awx/main/
python -m py_compile task_engine.py
重启tower服务
ansible-tower-service restart

LEAVE A COMMENT

Captcha Code