{"id":15049947,"url":"https://github.com/pythonzm/ops","last_synced_at":"2025-05-16T19:07:26.942Z","repository":{"id":33699420,"uuid":"140719938","full_name":"pythonzm/Ops","owner":"pythonzm","description":"基于centos6+python3.6+django2+ansible2.4+celery4.2 运维管理系统，目前实现功能：用户和用户组管理、资产管理、集成ansible2.4、简易堡垒机(主机分配支持rdp以及vnc、用户分配、文件上传下载、配置禁用命令清单、操作录像回放功能)、CI/CD（支持git仓库和svn仓库）、数据库管理（一部分）、celery任务编排、知识库及文件共享","archived":false,"fork":false,"pushed_at":"2024-05-31T04:34:05.000Z","size":43026,"stargazers_count":726,"open_issues_count":42,"forks_count":327,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-05-16T19:06:39.304Z","etag":null,"topics":["ansible","celery","cmdb","django","webssh"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythonzm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-12T13:54:01.000Z","updated_at":"2025-05-05T03:23:17.000Z","dependencies_parsed_at":"2024-11-21T07:02:51.598Z","dependency_job_id":"7fc896ef-ba3a-40cd-964f-912347c093a0","html_url":"https://github.com/pythonzm/Ops","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2FOps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2FOps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2FOps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonzm%2FOps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonzm","download_url":"https://codeload.github.com/pythonzm/Ops/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592395,"owners_count":22097013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","celery","cmdb","django","webssh"],"created_at":"2024-09-24T21:23:50.503Z","updated_at":"2025-05-16T19:07:21.925Z","avatar_url":"https://github.com/pythonzm.png","language":"Python","readme":"# ops\n基于centos6+python3.6+django2+ansible2.4+celery4.2  运维管理系统-开发中，目前实现功能：用户和用户组管理、日程管理、资产管理、集成ansible、简易堡垒机(主机分配（支持Linux和Windows）、用户分配、文件上传下载、配置禁用命令清单、操作录像回放功能)、数据库管理（一部分）、CI/CD（支持git仓库和svn仓库）、celery任务编排、基于markdown编辑器的知识库支持实时预览和全局搜索结果高亮和文件共享中心\n\n\n\n## 4.24更新\n\n资产管理新增了阿里云主机自动拉取入库功能，像其他腾讯云、华为云等实现方法都差不多就没一一实现，本来想写一些关于docker管理的东西，但感觉没什么实际应用场景，现在 `k8s` 编排这么流行，就没写，不过在我的博客文章中 [django实现web端登录docker](https://www.poorops.com/articles/?id=88) 简单的写了下web端登录docker容器的方法，然后这篇文章 [docker 配置远程加密调用](https://www.poorops.com/articles/?id=92) 描述了如何开启docker远程调用\n\n\u003e 无耻的推一波我的博客：[https://www.poorops.com/](https://www.poorops.com/)\n\u003e 自动拉取阿里云主机实现方法参考 [https://github.com/opendevops-cn/codo-cmdb/blob/master/libs/aliyun/rds.py](https://github.com/opendevops-cn/codo-cmdb/blob/master/libs/aliyun/rds.py)\n\n## 安装\n一、安装python3.6\n\n\u003e 建议安装虚拟环境，具体步骤参考\u003chttps://github.com/pyenv/pyenv\u003e\n\n二、安装模块\n```\ngit clone https://github.com/pythonzm/Ops.git\npip install -r requirements.txt\n\n// 因为django-celery-results的pip包与github上不一致，所以使用下面方法安装\npip install https://github.com/celery/django-celery-results/zipball/master#egg=django-celery-results\n```\n三、安装mysql\n\u003e 建议MySQL5.6，安装过程略\n```\nvim /etc/my.cnf\n## 设置字符集\n[client]\ndefault-character-set=utf8\n[mysql]\ndefault-character-set=utf8\n[mysqld]\ninit_connect='SET collation_connection = utf8_unicode_ci'\ninit_connect='SET NAMES utf8'\ncharacter-set-server=utf8\ncollation-server=utf8_unicode_ci\nskip-character-set-client-handshake\n\n## 忽略大小写\nlower_case_table_names=1\n\n/etc/init.d/mysqld restart\n# mysql -uroot -p\nmysql\u003ecreate database ops DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\nmysql\u003egrant all privileges on ops.* to root@'%' identified by 'password';\nmysql\u003equit\n```\n\n四、安装redis（略）\n\n五、安装mongodb（略）\n\n六、配置celery后台运行，或查看[官网](http://docs.celeryproject.org/en/latest/index.html)\n```\ncp conf/celeryd.conf /etc/default/celeryd\n### 将配置文件里的内容按照实际情况更改\n\ncp conf/celeryd.server /etc/init.d/celeryd\ncp conf/celerybeat.server /etc/init.d/celerybeat\n/etc/init.d/celeryd start  ##如果出现celeryd无法启动，则添加环境变量：export C_FORCE_ROOT=\"true\"\n/etc/init.d/celerybeat start\n```\n\n七、配置获取主机内存脚本\n\n``` \ncp conf/get_mem.py /path/to/your ansible python module location  ##可以使用ansbile --version命令查看路径\n```\n\n八、安装Guacamole用于支持web端登录Windows服务器以及开启VNC的服务器（可选）\n\n   安装步骤建议参考官方文档：\u003chttps://guacamole.apache.org/doc/gug/installing-guacamole.html\u003e\n    \n    安装完成后，修改settings.py中的 GUACD_HOST和 GUACD_PORT，改为guac服务启动后监听的地址和端口\n   功能实现参考：\u003chttps://github.com/mohabusama/pyguacamole\u003e以及\u003chttps://github.com/jimmy201602/django-guacamole\u003e\n\n九、启动服务\n\u003e 需要将Ops目录中的settings.py celery.py按照实际情况更改\n```\npython manage.py makemigrations users assets dbmanager fort plan projs task wiki\npython manage.py migrate\npython manage.py createsuperuser\npython manage.py runserver 0.0.0.0:8000\n```\n\n以下为部分截图：\n### 系统操作日志\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/system_log.jpg)\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/request_data.jpg)\n\n### 用户管理\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/user_list.png)\n\n### 日程管理\n\u003e 参考：https://github.com/RobbieHan/sandboxOA\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/user_plan.png)\n\n### 添加用户以及分配用户权限(采用的django自带的权限系统)等，用户组同理\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/add_user.png)\n\n### 资产概览\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/asset_chart.png)\n\n### 资产拉取\n\n可以自动同步阿里云中的ECS，并同步至资产列表中，只写了阿里云的ECS同步，至于RDS等资产或其他像腾讯云、华为云的实现方式基本一致\n\n实现方式参考：[https://github.com/opendevops-cn/codo-cmdb](https://github.com/opendevops-cn/codo-cmdb)\n\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/pull_asset.jpg)\n\n### 资产管理，需要关联的项目管理只完成了一部分\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/asset_list.png)\n\n### 资产详细，CPU等信息可以通过收集按钮自动获取\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/asset_info.jpg)\n\n### 资产监控\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/monitor.png)\n\n### ansible执行模块\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/ansible_module.png)\n\n### ansible执行playbook\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/role_result.png)\n\n### ansible role编辑\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/role_detail.png)\n\n### webssh分配主机及用户、用户组\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/webssh_manage.png)\n\n### webssh终端，包括文件的上传下载\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/terminal.png)\n\n### webssh操作记录回放\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/record.png)\n\n### web端登录Windows服务器\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/rdp.png)\n\n### 登录日志查看\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/login_record.png)\n\n### webssh命令查看\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/webssh_commond.png)\n\n### 数据库用户管理，包括新增用户，修改用户，密码，权限\n\u003e数据库管理用户,该用户需要有grant option权限,并且只能授权该用户所拥有的权限\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/mysql_user.png)\n### 数据库执行命令\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/sql_exec.png)\n### 数据库操作记录\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/sql_log.png)\n\n### CI/CD项目配置\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/project_config.png)\n\u003e 注意：如果是启动tomcat项目，启动命令需要加上nohup，由于ansible运行机制问题\n\n### CI/CD部署流程\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/deploy.png)\n\n### CI/CD部署日志\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/deploy_log.png)\n\n### 自定义项目架构\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/project_chart.png)\n\n### celery任务编排\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/celery.png)\n\n### 新增文章\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/wiki_add.png)\n### 文章详细\n![image](https://github.com/pythonzm/Ops/blob/master/screenshots/wiki_view.png)\n\n## 用到的一些开源产品\n\n* 后端：\n  * channels：用于实现websocket长连接：\u003chttps://github.com/django/channels\u003e\n  * django-rest-framework：用于编写API：\u003chttps://github.com/encode/django-rest-framework\u003e\n  * ansible：用于批量管理机器的工具：\u003chttps://github.com/ansible/ansible\u003e\n  * celery：用于执行异步任务：\u003chttps://github.com/celery/celery\u003e\n  * django-celery-beat，用于监测celery定时任务：\u003chttps://github.com/celery/django-celery-beat\u003e\n  * django-celery-results：用于存储celery执行结果：\u003chttps://github.com/celery/django-celery-results\u003e\n  * paramiko：用于远程连接Linux服务器：\u003chttps://github.com/paramiko/paramiko\u003e\n  * Pillow：用于图像处理：\u003chttps://github.com/python-pillow/Pillow\u003e\n  * pyguacamole：连接Guacamole服务器的客户端：\u003chttps://github.com/mohabusama/pyguacamole\u003e\n  * PyMySQL：处理mysql：\u003chttps://github.com/PyMySQL/PyMySQL\u003e\n  * requests：用于HTTP请求：\u003chttps://github.com/requests/requests\u003e\n  * xlrd，xlwt：excel处理：\u003chttps://github.com/python-excel/xlrd\u003e \u003chttps://github.com/python-excel/xlwt\u003e\n  \n* 前端：\n  * AdminLTE：后台管理的前端框架：\u003chttps://github.com/almasaeed2010/AdminLTE\u003e\n  * ace：用于生成前端编辑器：\u003chttps://github.com/ajaxorg/ace\u003e\n  * bootstrap-fileinput：基于bootstrap的文件上传插件：\u003chttps://github.com/kartik-v/bootstrap-fileinput\u003e\n  * echarts：用于图表展示：\u003chttps://echarts.baidu.com/\u003e\n  * highlight：用于代码高亮：\u003chttps://github.com/highlightjs/highlight.js\u003e\n  * jquery-confirm：基于jquery的确认modal：\u003chttps://github.com/craftpip/jquery-confirm\u003e\n  * jsplumb：用于生成流程图的jquery插件：\u003chttps://github.com/jsplumb/jsplumb\u003e\n  * modaal：生成modal的插件：\u003chttps://github.com/humaan/Modaal\u003e\n  * parsley：处理表单验证的插件：\u003chttps://github.com/guillaumepotier/Parsley.js\u003e\n  * zTree_v3：用于生成树形结构的jquery插件：\u003chttps://github.com/zTree/zTree_v3\u003e\n  * asciinema-player：用于播放webssh录像的插件：\u003chttps://github.com/asciinema/asciinema-player\u003e\n  * guacamole-client：用于播放rdp和vnc录像的插件：\u003chttps://github.com/apache/guacamole-client/tree/master/doc/guacamole-playback-example\u003e\n  * xterm：用于前端生成webssh界面：\u003chttps://github.com/xtermjs/xterm.js\u003e\n  * dataTables：用于生成表格的插件：\u003chttps://github.com/DataTables/DataTables\u003e\n  * fullCalendar:用于日程管理：https://github.com/fullcalendar/fullcalendar\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonzm%2Fops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonzm%2Fops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonzm%2Fops/lists"}