ansible_ui 安装文档 参考资料: https://github.com/alaxli/ansible_ui/issues/15 注意,以下安装过程最好都用root
用户安装 一. 环境准备 1. lsb_release -a LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.3 (Final) Release: 6.3 Codename: Final 2. uname -a Linux test42 2.6.32-504.30.3.el6.x86_64 #1 SMP Wed Jul 15 10:13:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux 3. python -V Python 2.6.6 4. mkdir -p /data/soft/app/python2.7/ansible_ui 5. 检查是否安装有pip pip -V -bash: pip: command not found 6.安装pip,setuptools,参考 http://pip-cn.readthedocs.io/en/latest/installing.html,下载地址: https://bootstrap.pypa.io/ a. 下载get-pip.py ,
上传至/data/soft/app/python2.6 b. cd /data/soft/app/python2.6/ c. python get-pip.py d. pip -V,
显示 pip 8.1.2 from /usr/lib/python2.6/site-packages (python 2.6), 则安装成功 7.
修改yum源为163yum源,yum安装的时候会快,并且不会再出现无法解析的问题 a. 参考http://mirrors.163.com/.help/centos.html b. 备份/etc/yum.repos.d/CentOS-Base.repo,mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak c. cp /data/soft/app/python2.6/CentOS6-Base-163.repo /etc/yum.repos.d/ d. yum clean all e. yum makecache 8. 安装相关库 yum install -y gcc gcc-c++ 注:如遇到
错误:Downloading Packages: http://mirrors.163.com/centos/6/os/x86_64/Packages/cpp-4.4.7-17.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.163.com'" 通过如下方式
解决:打开
文件/etc/resolv.conf在其中
添加: nameserver 8.8.8.8 nameserver 8.8.4.4 search localdomain yum install -y git yum install -y openldap-devel yum install -y python-devel yum install -y libffi-devel yum install -y openssl-devel yum install -y libjpeg-devel yum install -y zlib-devel yum install -y python-setuptools yum install -y
MysqL-devel yum install -y sshpass 9. 配置sshpass,如使用192.168.0.xx免密
登录,按如下步骤执行 a. ssh -o StrictHostKeyChecking=no 192.168.0.xx b. ssh-keygen -t rsa c. ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.xx d. ssh '192.168.0.xx' 如果这一步能够
登录成功,说明配置成功 10. 安装最新版本的python a. 下载python2.7.11 源码并
上传至/data/soft/app/python2.7, 切换当前工作目录为/data/soft/app/python2.7 b. tar -xf Python-2.7.11.tgz c. cd Python-2.7.11 d. ./configure --prefix=/usr/local e. make && make install f. cd /usr/local/bin/ g. ./python -V,
显示 Python 2.7.11 二. 使用virtualenv创建python2.7沙盒环境 1. pip install virtualenv 2. cd /data/soft/app/python2.7/ 3. mkdir env 4. virtualenv --python=python2.7 --no-site-packages env/ 5. source ./env/bin/activate 6. deactivate 三. 安装ansible_ui 及
数据库配置 1. cd /data/soft/app/python2.7/ansible_ui 2. git clone https://github.com/alaxli/ansible_ui.git 3. mkdir -p ansible_ui/playbooks,此路径为存放playbook的路径 4. /data/soft/app/python2.7/ansible_ui/ansible_ui,确认此目录下有manage.py, 激活python 虚拟环境,source ./env/bin/activate 5. 开始安装ansible_ui --使用pip 安装的时候不要使用sudo,否则会切换到python2.6.6的pip安装,会导致安装过程中出现很多问题 pip install setuptools_scm pip install -r requirements.txt pip install Pillow pip install django-guardian==1.3.0 pip install ansible==1.9.6 6. 配置
数据库, cd desktop/core/internal, vim settings_local.py,
修改后如下 # Database settings DATABASES = { 'default': { 'ENGINE': 'django.db.backends.
MysqL',# Add 'postgre
sql_psycopg2','
MysqL','
sqlite3' or 'oracle'. 'NAME': 'ansible',# Or path to database file if using
sqlite3. 'USER': 'ansibleuser',# Not used with
sqlite3. 'PASSWORD': 'xxxxxx',# Not used with
sqlite3. 'HOST': '192.168.0.xx','PORT': '3306',# Set to empty string for default. Not used with
sqlite3. },} # Mail settings MAIL_SENDER = "xx@xxx.com" MAIL_SMTP = "smtp.xx.com" # Ansible-playbook path ANSIBLE_PLAYBOOK = '/data/soft/app/python2.7/ansible_ui/playbooks' 7. 在
数据库中创建
用户并授权 1.
登录192.168.0.xx,
MysqL -u root -p 2. 在
MysqL中执行如下 create database ansible CHARACTER SET utf8; grant all on ansible.* to ansibleuser@'%' identified by 'xxxxxx'; 8. 初始化
数据库,cd /data/soft/app/python2.7/ansible_ui/ansible_ui,执行如下命令 ***以下命令执行过程中,会要求你设置一个superuser和密码,请记录下此
用户名和密码,此
用户名和密码就是
登录ansible_ui的超级
用户 python manage.py schemamigration desktop.apps.account --init python manage.py schemamigration desktop.apps.ansible --init python manage.py syncdb python manage.py migrate ansible python manage.py migrate account python manage.py migrate kombu.transport.django python manage.py migrate djcelery python manage.py migrate guardian 9. 配置supervisord和ansible a. cd /data/soft/app/python2.7/ansible_ui/ansible_ui/celery-conf/ b. vim supervisord.conf,查找program:ansible_celeryd,
修改command中 virtualenv 和 ansible_ui home,
修改后如下command = /data/soft/app/python2.7/env/bin/python /data/soft/app/python2.7/ansible_ui/ansible_ui/manage.py celeryd -B -l info c. cd /data/soft/app/python2.7/ansible_ui/ansible_ui d. cp ansible-conf/ansible.cfg ~/.ansible.cfg 10. 启动 a. supervisord -c celery-conf/supervisord.conf b. python manage.py runserver 0.0.0.0:8000 至此,ansible_ui已安装完毕,并且使用的是远程
MysqL数据库(192.168.0.xx)
原文链接:https://www.f2er.com/centos/380749.html