Git Product home page Git Product logo

ansible_ui's Introduction

About

该平台为ansible系统的web程序

Function

  • 按照项目来组织布局,更为直观,上手简单
  • 提供简单易懂的主机管理界面
  • 提供用户密钥管理功能
  • 提供yml文件界面管理功能
  • 提供任务部署功能
  • 提供文件传输功能
  • 提供命令执行功能
  • 提供预约执行功能
  • 提供任务模板功能
  • 提供log功能
  • 提供邮件通知功能
  • 基于celery队列进行任务分发,便于扩展

UserManual

ansible_ui平台用户手册

Requirements

  • pip
  • virtualenv
  • mysql-server,mysql-devel
  • openldap-devel

Install

  • 系统为CentOS6.5

  • 添加系统用户

      useradd ansible
      su - ansible
    
  • 配置virtualenv环境

      virtualenv envansible
      source envansible/bin/active
    
  • 下载源码

      git clone https://github.com/alaxli/ansible_ui.git
    
  • 安装依赖库

      cd ansible-ui
      pip install -r requirements.txt
      pip install PIL --allow-external PIL --allow-unverified PIL
    
  • 配置ldap、数据库和邮件信息

      cd desktop/core/internal
      vim settings_local.py 
      # 修改 LDAP Datebase Mail 和ansible_playbook命令位置(which ansible_playbook)配置
      如果需要使用ldap,还需要修改settings.py,去掉下面行的注释
      #'desktop.core.auth.backend.LdapBackend',
    
  • 配置数据库

      create database ansible CHARACTER SET utf8;
      grant all on ansible.* to ansibleuser@'localhost' identified by '******';
    
  • 初始化数据库

      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
    
  • 配置celery

      修改celery-conf/supervisord.conf
      [inet_http_server] #配置web管理supervisor
      [program:ansible_celeryd] #修改command中 virtualenv 和 ansible_ui home
    
  • 启动celery

      supervisord -c celery-conf/supervisord.conf
    
  • 配置ansible

      cp ansible-conf/ansible.cfg ~/.ansible.cfg
    
  • Vagrant + Ansible

    感谢yunlzheng提供了使用vagrant+ansible自动构建开发环境的方式Vagrantfile+playbook.yml,具体操作推荐阅读yunlzheng的《利用Ansible将开发环境纳入版本管理》

Run

  • 直接运行

      python manage.py runserver ip:8000
    
  • apache + wsgi

      修改apache-conf/ansible.cfg : ansible_ui_dir,指向实际目录
      修改ansible.wsgi : yourvirtualenv 指向实际目录
      拷贝apache-conf/ansible.cfg 到apache配置目录下
      重启 httpd
    
  • nginx + uwsgi

      配置nginx: 参考nginx-conf/nginx_ansible.cfg  
      启动nginx
      修改ansible.wsgi : yourvirtualenv 指向实际目录
      修改ansible_uwsgi.ini : 修改相关配置
      启动 uwsgi: uwsgi --ini ansible_uwsgi.ini -d ansible.log
    

Demo

Problem

  • 已知问题:在单核CPU服务器上任务无法运行(在调用pexpect时会报“ValueError: I/O operation on closed file”错误,类似这个问题,如果要在单核CPU服务器上运行,请将pexpect降为2.4版本

ansible_ui's People

Contributors

alaxli avatar yunlzheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible_ui's Issues

执行 python manage.py migrate ansible 报错

python:2.7
Django:1.6

当单独安装 guardian 时 需要 Django:1.7 以上版本

231># python manage.py migrate ansible
Traceback (most recent call last):
File "manage.py", line 11, in
execute_from_command_line(sys.argv)
File "/usr/local/python2.7/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/local/python2.7/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/python2.7/lib/python2.7/site-packages/django/core/management/init.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/python2.7/lib/python2.7/site-packages/django/core/management/init.py", line 75, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/python2.7/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
import(name)
File "/usr/local/python2.7/lib/python2.7/site-packages/south/management/commands/init.py", line 10, in
import django.template.loaders.app_directories
File "/usr/local/python2.7/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 25, in
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError guardian: cannot import name register

How to apply my "HOSTS" file contents "ansible_ui" ?

my hosts file contents is like this:

localhost              ansible_connection=local

[zabbix-proxy]
t-proxy  ansible_ssh_host=10.0.0.###

[zabbix-proxy:vars]
ansible_ssh_private_key_file=~/.ssh/xxx_worker.pem
ansible_ssh_user=ubuntu

[zabbix-agent]
t-agent-01      ansible_ssh_host=10.0.0.###
t-agent-02      ansible_ssh_host=10.0.0.###
t-agent-03      ansible_ssh_host=10.0.0.###
t-agent-04      ansible_ssh_host=10.0.0.###


[zabbix-agent:vars]
ansible_ssh_private_key_file=~/.ssh/xxx_worker.pem
ansible_ssh_user=ubuntu

my ansible command result like this:

[ansible@ip-10-0-0-48 cl-test]$ ansible -i hosts -m ping all
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
localhost | success >> {
    "changed": false,
    "ping": "pong"
}

t-agent-04 | success >> {
    "changed": false,
    "ping": "pong"
}

t-agent-01 | success >> {
    "changed": false,
    "ping": "pong"
}

t-agent-02 | success >> {
    "changed": false,
    "ping": "pong"
}

t-agent-03 | success >> {
    "changed": false,
    "ping": "pong"
}

t-proxy | success >> {
    "changed": false,
    "ping": "pong"
}

How to apply my "HOSTS" file contents "ansible_ui"?

ansible-ui is installed on "ip-10-0-0-48"

Unknown command: 'schemamigration'

运行 python manage.py schemamigration desktop.apps.account --init
Unknown command: 'schemamigration'
Type 'manage.py help' for usage.

3.15章,涉及的持续集成,实现不了?

for c++,using blade $JENKINS_HOME/scripts/store4blade.py $JENKINS_HOME $JOB_NAME $BUILD_NUMBER $your_svn_url # for java,using maven python $JENKINS_HOME/scripts/store4maven.py $JENKINS_HOME $JOB_NAME $your_svn_url $SVN_REVISION

这个里面的store4maven.py,没有找到,在源码里面.

部署任务

为什么我部署任务后一直是pending状态。
在debug日志里有看到
INFO /home/ansible/envansible/bin/ansible-playbook -i /home/ansible/ansible_ui/projects/test/inventories/hosts /home/ansible/ansible_ui/projects/test/.tmp/393a961e-6410-11e4-a723-842b2b6f19ac.yml --private-key /home/ansible/ansible_ui/cretential/root/id_dsa
但是一直不执行

部署遇到问题,求教

执行python manage.py syncdb,这一步报错:django.db.utils.OperationalError: (1045, "Access denied for user 'ansibleuser'@'localhost' (using password: YES)")

之前mysql配置有2个
create database ansible CHARACTER SET utf8;
grant all on ansible.* to ansibleuser@'localhost' identified by '******';

本人是个菜鸟,不太懂,请大家帮忙,多谢

部署密钥出现问题

大家安装后都能正常使用吗?现在部署密钥的时候不成功,一直报输入的参数是3个,只获得了2个。

部署密钥一直提示please wait

后台debug提示
Internal Server Error: /ansible/test/deploykey Traceback (most recent call last): File "/usr/lib64/python2.6/site-packages/django/core/handlers/base.py", line 114, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/ansible/ansible_ui/desktop/apps/ansible/views.py", line 777, in deploykey hostlist = get_hosts(inventory, hosts) File "/home/ansible/ansible_ui/desktop/apps/ansible/tasks.py", line 319, in get_hosts inventory = Inventory(hostfile) TypeError: __init__() takes at least 3 arguments (2 given) [14/Apr/2016 17:23:18] "POST /ansible/test/deploykey HTTP/1.1" 500 12966

这是语法错误吧

是否支持ansible-playbook调用.yml文件方式来执行任务

1.我创建了一个test的project,在playbooks下面创建了roles
2.在playbook创建了一个setup.yml文件,内容如下:

  • hosts: node-all
    remote_user: root
    roles:
    - 01-init
    3.通过命令行执行是没有问题的,ansible-playbook setup.yml -i ../inventories/hosts
    4.在浏览器上面执行会报错,ERROR: hosts is not a legal parameter in an Ansible task or handler
    有人遇到过这个问题么?

部署密钥报错

Internal Server Error: /ansible/test/deploykey
Traceback (most recent call last):
File "/home/ansible/envansible/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "/home/ansible/ansible_ui/desktop/apps/ansible/views.py", line 777, in deploykey
hostlist = get_hosts(inventory, hosts)
File "/home/ansible/ansible_ui/desktop/apps/ansible/tasks.py", line 319, in get_hosts
inventory = Inventory(hostfile)
TypeError: init() takes at least 3 arguments (2 given)
请问这是怎么回事

亲测可用的requirements.txt(带版本号)

Django==1.6
Jinja2==2.8.1
MarkupSafe==1.0
MySQL-python==1.2.5
Pillow==4.0.0
PyYAML==3.12
South==1.0.2
amqp==1.0.13
ansible==2.2.1.0
anyjson==0.3.3
argparse==1.2.1
asn1crypto==0.22.0
celery==3.0.11
cffi==1.9.1
cryptography==1.8.1
django-auth-ldap==1.2.10
django-celery==3.0.11
django-guardian==1.3.2
django-jsonfield==1.0.1
enum34==1.1.6
idna==2.5
ipaddress==1.0.18
kombu==2.5.16
meld3==1.0.2
olefile==0.44
packaging==16.8
paramiko==2.1.2
pexpect==4.2.1
ptyprocess==0.5.1
pyasn1==0.2.3
pycparser==2.17
pycrypto==2.6.1
pyparsing==2.2.0
python-dateutil==1.5
python-ldap==2.4.32
python-magic==0.4.12
pytz==2016.10
simplejson==3.10.0
six==1.10.0
supervisor==3.3.1
threadpool==1.3.2
uWSGI==2.0.14
vine==1.1.3
wsgiref==0.1.2

ExceptionPexpect: The command was not found or was not executabl

部署搭建成功,执行任何任务都出现如下错误

traceback

                Traceback (most recent call last):
  File "/home/ansible/ansible_ui/desktop/apps/ansible/tasks.py", line 253, in run
    status, stdout, stderr = self.run_pexpect(job_pk, args, cwd, env, passwords)
  File "/home/ansible/ansible_ui/desktop/apps/ansible/tasks.py", line 204, in run_pexpect
    child = pexpect.spawn(args[0], args[1:], cwd=cwd, env=env)
  File "/usr/lib/python2.6/site-packages/pexpect/__init__.py", line 511, in __init__
    self._spawn(command, args)
  File "/usr/lib/python2.6/site-packages/pexpect/__init__.py", line 616, in _spawn
    'executable: %s.' % self.command)
ExceptionPexpect: The command was not found or was not executable: /envansible_dir/bin/ansible-playbook.

初始化数据库报错,寻求帮助

(envansible) [ansible@vm-007-node014 ansible_ui]$ python manage.py schemamigration desktop.apps.account --init
Traceback (most recent call last):
File "manage.py", line 11, in
execute_from_command_line(sys.argv)
File "/home/ansible/envansible/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/home/ansible/envansible/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/ansible/envansible/lib/python2.7/site-packages/django/core/management/init.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/ansible/envansible/lib/python2.7/site-packages/django/core/management/init.py", line 75, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/ansible/envansible/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
import(name)
File "/home/ansible/envansible/lib/python2.7/site-packages/south/management/commands/init.py", line 10, in
import django.template.loaders.app_directories
File "/home/ansible/envansible/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 25, in
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError kombu.transport.django: No module named django
(envansible) [ansible@vm-007-node014 ansible_ui]$

环境:python 2.7.13 django 1.6.0

部署秘钥 显示一直是wait.....

直接后台运行 $ansible -i /home/ansible/hosts.txt all -u ansible -m ping -k
SSH password:
192.168.163.140 | UNREACHABLE! => {
"changed": false,
"msg": "ERROR! SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
"unreachable": true
ssh一直连接不上,但是直接ssh [email protected]是成功的,防火墙,selinux也都关闭了,还是不行,请教高手!感激不尽。

部署完成后,发布任务,状态显示error

你好,我目前搭建好了,但是遇到了一个问题,执行脚本或者其他远程操作都会提示
Traceback (most recent call last):
File "/data/soft/app/python2.7/ansible_ui/ansible_ui/desktop/apps/ansible/tasks.py", line 257, in run
status, stdout, stderr = self.run_pexpect(job_pk, args, cwd, env, passwords)
File "/data/soft/app/python2.7/ansible_ui/ansible_ui/desktop/apps/ansible/tasks.py", line 205, in run_pexpect
child = pexpect.spawn(args[0], args[1:], cwd=cwd, env=env)
File "/data/soft/app/python2.7/env/lib/python2.7/site-packages/pexpect/pty_spawn.py", line 197, in init
self._spawn(command, args, preexec_fn, dimensions)
File "/data/soft/app/python2.7/env/lib/python2.7/site-packages/pexpect/pty_spawn.py", line 270, in _spawn
'executable: %s.' % self.command)
ExceptionPexpect: The command was not found or was not executable: /data/soft/app/python2.7/ansible_ui/ansible_ui/playbooks.

这个应该怎么解决啊?状态显示的是error

亲, 安装的时候报了一个异常错误

File "/usr/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 25, in
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError guardian: cannot import name register

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.