Giter Club home page Giter Club logo

pythonzm / ops Goto Github PK

View Code? Open in Web Editor NEW
707.0 46.0 318.0 42.02 MB

基于centos6+python3.6+django2+ansible2.4+celery4.2 运维管理系统,目前实现功能:用户和用户组管理、资产管理、集成ansible2.4、简易堡垒机(主机分配支持rdp以及vnc、用户分配、文件上传下载、配置禁用命令清单、操作录像回放功能)、CI/CD(支持git仓库和svn仓库)、数据库管理(一部分)、celery任务编排、知识库及文件共享

Python 91.43% Shell 0.45% Less 7.71% SCSS 0.41%
django cmdb webssh ansible celery

ops's Introduction

ops

基于centos6+python3.6+django2+ansible2.4+celery4.2 运维管理系统-开发中,目前实现功能:用户和用户组管理、日程管理、资产管理、集成ansible、简易堡垒机(主机分配(支持Linux和Windows)、用户分配、文件上传下载、配置禁用命令清单、操作录像回放功能)、数据库管理(一部分)、CI/CD(支持git仓库和svn仓库)、celery任务编排、基于markdown编辑器的知识库支持实时预览和全局搜索结果高亮和文件共享中心

4.24更新

资产管理新增了阿里云主机自动拉取入库功能,像其他腾讯云、华为云等实现方法都差不多就没一一实现,本来想写一些关于docker管理的东西,但感觉没什么实际应用场景,现在 k8s 编排这么流行,就没写,不过在我的博客文章中 django实现web端登录docker 简单的写了下web端登录docker容器的方法,然后这篇文章 docker 配置远程加密调用 描述了如何开启docker远程调用

无耻的推一波我的博客:https://www.poorops.com/ 自动拉取阿里云主机实现方法参考 https://github.com/opendevops-cn/codo-cmdb/blob/master/libs/aliyun/rds.py

安装

一、安装python3.6

建议安装虚拟环境,具体步骤参考https://github.com/pyenv/pyenv

二、安装模块

git clone https://github.com/pythonzm/Ops.git
pip install -r requirements.txt

// 因为django-celery-results的pip包与github上不一致,所以使用下面方法安装
pip install https://github.com/celery/django-celery-results/zipball/master#egg=django-celery-results

三、安装mysql

建议MySQL5.6,安装过程略

vim /etc/my.cnf
## 设置字符集
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

## 忽略大小写
lower_case_table_names=1

/etc/init.d/mysqld restart
# mysql -uroot -p
mysql>create database ops DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql>grant all privileges on ops.* to root@'%' identified by 'password';
mysql>quit

四、安装redis(略)

五、安装mongodb(略)

六、配置celery后台运行,或查看官网

cp conf/celeryd.conf /etc/default/celeryd
### 将配置文件里的内容按照实际情况更改

cp conf/celeryd.server /etc/init.d/celeryd
cp conf/celerybeat.server /etc/init.d/celerybeat
/etc/init.d/celeryd start  ##如果出现celeryd无法启动,则添加环境变量:export C_FORCE_ROOT="true"
/etc/init.d/celerybeat start

七、配置获取主机内存脚本

cp conf/get_mem.py /path/to/your ansible python module location  ##可以使用ansbile --version命令查看路径

八、安装Guacamole用于支持web端登录Windows服务器以及开启VNC的服务器(可选)

安装步骤建议参考官方文档:https://guacamole.apache.org/doc/gug/installing-guacamole.html

安装完成后,修改settings.py中的 GUACD_HOST和 GUACD_PORT,改为guac服务启动后监听的地址和端口

功能实现参考:https://github.com/mohabusama/pyguacamole以及https://github.com/jimmy201602/django-guacamole

九、启动服务

需要将Ops目录中的settings.py celery.py按照实际情况更改

python manage.py makemigrations users assets dbmanager fort plan projs task wiki
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver 0.0.0.0:8000

以下为部分截图:

系统操作日志

image image

用户管理

image

日程管理

参考:https://github.com/RobbieHan/sandboxOA image

添加用户以及分配用户权限(采用的django自带的权限系统)等,用户组同理

image

资产概览

image

资产拉取

可以自动同步阿里云中的ECS,并同步至资产列表中,只写了阿里云的ECS同步,至于RDS等资产或其他像腾讯云、华为云的实现方式基本一致

实现方式参考:https://github.com/opendevops-cn/codo-cmdb

image

资产管理,需要关联的项目管理只完成了一部分

image

资产详细,CPU等信息可以通过收集按钮自动获取

image

资产监控

image

ansible执行模块

image

ansible执行playbook

image

ansible role编辑

image

webssh分配主机及用户、用户组

image

webssh终端,包括文件的上传下载

image

webssh操作记录回放

image

web端登录Windows服务器

image

登录日志查看

image

webssh命令查看

image

数据库用户管理,包括新增用户,修改用户,密码,权限

数据库管理用户,该用户需要有grant option权限,并且只能授权该用户所拥有的权限 image

数据库执行命令

image

数据库操作记录

image

CI/CD项目配置

image

注意:如果是启动tomcat项目,启动命令需要加上nohup,由于ansible运行机制问题

CI/CD部署流程

image

CI/CD部署日志

image

自定义项目架构

image

celery任务编排

image

新增文章

image

文章详细

image

用到的一些开源产品

ops's People

Contributors

pythonzm 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

ops's Issues

fort/login_fort_record/

@pythonzm 你好,请问下如题这个页面逻辑是怎么样的,主机登录日志和连接管理登录日志看起来里面的字段是一样的,另外从assets/assets_list/里面ssh登录成功后,只能执行一条命令后ssh就会断开,我看后面webssh会话超时时间设置的是3分钟

上传文件失败

我想请教一下,在资产管理模块下的资产列表页面,批量导入时,导入不成功,后端无法接收到导入的文件是什么原因,返回400。

点击 "收集主机信息" 报错

[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin (<task.utils.ansible_api_v2.ModuleResultsCollector object at 0x7f1358cdeda0>): 'NoneType' object has no attribute 'send'

makemigrations有报错,migrate提示ops_admin_record表已存在

(ops) [root@1Ops]# python manage.py makemigrations assets users dbmanager fort plan projs task wiki
You are trying to add a non-nullable field 'asset_admin' to assets without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:

  1. Provide a one-off default now (will be set on all existing rows with a null value for this column)
  2. Quit, and let me add a default in models.py
    Select an option: 1
    Please enter the default value now, as valid Python
    The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.now
    Type 'exit' to exit this prompt

22
You are trying to add a non-nullable field 'user' to assetslog without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:

  1. Provide a one-off default now (will be set on all existing rows with a null value for this column)
  2. Quit, and let me add a default in models.py
    Select an option: 1
    Please enter the default value now, as valid Python
    The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.now
    Type 'exit' to exit this prompt

root
Invalid input: name 'root' is not defined
'root'
You are trying to add the field 'add_time' with 'auto_now_add=True' to userplan without a default; the database needs something to populate existing rows.

  1. Provide a one-off default now (will be set on all existing rows)
  2. Quit, and let me add a default in models.py
    Select an option: 1
    Please enter the default value now, as valid Python
    You can accept the default 'timezone.now' by pressing 'Enter' or you can provide another value.
    The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.now
    Type 'exit' to exit this prompt
    [default: timezone.now] >>>
    You are trying to add a non-nullable field 'content' to userplan without a default; we can't do that (the database needs something to populate existing rows).
    Please select a fix:
  3. Provide a one-off default now (will be set on all existing rows with a null value for this column)
  4. Quit, and let me add a default in models.py
    Select an option: 1
    Please enter the default value now, as valid Python
    The datetime and django.utils.timezone modules are available, so you can do e.g. timezone.now
    Type 'exit' to exit this prompt

'test'

(ops) [root@1 Ops]# python manage.py migrate
Operations to perform:
Apply all migrations: admin, assets, auth, contenttypes, dbmanager, django_celery_beat, django_celery_results, fort, projs, sessions, task, users, wiki
Running migrations:
Applying assets.0002_auto_20190523_1448...Traceback (most recent call last):
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/django/db/backends/utils.py", line 83, in _execute
return self.cursor.execute(sql)
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute
result = self._query(query)
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query
conn.query(q)
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/connections.py", line 893, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/connections.py", line 1103, in _read_query_result
result.read()
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/connections.py", line 1396, in read
first_packet = self.connection._read_packet()
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/connections.py", line 1059, in _read_packet
packet.check_error()
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/connections.py", line 384, in check_error
err.raise_mysql_exception(self._data)
File "/data/miniconda/envs/ops/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.InternalError: (1050, "Table 'ops_admin_record' already exists")

settings

from Ops import settings

替换成

from django.conf import settings

有什么区别么?加载得还是Ops.settings吧?

登入有什么特殊之处不

使用createsuperuser创建了一个用户,项目启动之后,在登入这里,提交账号密码后,一直卡住,然后就503了。

关于权限

请问现在的权限是会根据不同用户不同组显示不同内容么?

django项目启动报错

登录界面点击登录,出现django报错页面,错误1146,tabel 'ops.ops_fort_server' doesn't exist,请问需要这个表吗 ,代码中没用这个表,如何解决

操作记录

我在本地上运行这套系统,发现用户操作及资产操作记录这一块好像并没有记录,是这块功能没实现还是我操作不当呢?

Q

大神,看到有更新webssh ,是修复了不能输入数字的bug吗?

测试问题

我自己参考django-rest-framework的文档写了个测试类,但是没办法通过绕过登录认证,使用login和force_authenticate都走不通,一直302到登录路由,请问有什么办法么?

新建服务器类型资产,浏览器返回503

你好,启动项目后新建服务器类型资产时,POST调用/api/servers_assets 的时候浏览器返回503,实际数据已经插入,通过直接访问/api/servers_assets,去post新建服务器资产也返回503,调试一天了,也没查到原因,请大神帮助下,非常感谢;

window rdp功能不够完善

window rdp操作文件上传下载,还有本机和远程机器之间的复制黏贴没有实现,这块功能可以实现吗?

是否增加实时监控功能?

您好,请问您是否有考虑增加实时监控功能呢?我这段时间也在关注基于guacamole的实时监控,可否讨论一下思路呢?

q

请问excel真的能导进去吗?

ws问题

大佬,请教ws出现404一般是什么原因呢?

General
    Request URL: ws://172.31.8.129:8000/ws/ans_module_log/
    Request Method: GET
    Status Code: 404 Not Found
failed: Error during WebSocket handshake: Unexpected response code: 404

请问你qq多少,能咨询下webssh的问题吗?

连接webssh 提示(index):78 WebSocket connection to 'ws://x.x.x.x:81/ws/webssh/5/d803e1ea-3716-4c98-874a-9398a0e51c64/' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET,代码也是抄你的,一般是什么问题呢

[bug] 同步数据报错

python manage.py makemigrations users
You are trying to add a non-nullable field 'asset_admin' to assets without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:

  1. Provide a one-off default now (will be set on all existing rows with a null value for this column)
  2. Quit, and let me add a default in models.py
    Select an option:

日期类型错误

Applying assets.0002_auto_20190910_1755...Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/init.py", line 371, in execute_from_command_line
utility.execute()
......
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'

数据库字段错误

django.core.exceptions.ValidationError: ["'' value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format."]

python manage.py migrate 执行报错

Applying assets.0001_initial... OK
Applying assets.0002_auto_20190720_1636...Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 200, in handle
fake_initial=fake_initial,
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/migration.py", line 122, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/usr/local/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 84, in database_forwards
field,
File "/usr/local/lib/python3.7/site-packages/django/db/backends/mysql/schema.py", line 40, in add_field
super().add_field(model, field)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 423, in add_field
definition, params = self.column_sql(model, field, include_default=True)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 168, in column_sql
default_value = self.effective_default(field)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 240, in effective_default
default = field.get_db_prep_save(default, self.connection)
File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/related.py", line 936, in get_db_prep_save
return self.target_field.get_db_prep_save(value, connection=connection)
File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/init.py", line 767, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/init.py", line 939, in get_db_prep_value
value = self.get_prep_value(value)
File "/usr/local/lib/python3.7/site-packages/django/db/models/fields/init.py", line 947, in get_prep_value
return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.datetime'

一个简单的登录搞的都登录不进去

rsakey = RSA.importKey(key)  # 导入私钥
    cipher = PKCS1_v1_5.new(rsakey)  # 生成对象
    missing_padding = len(en_pwd) % 4
    if missing_padding:
        en_pwd += b'=' * (4 - missing_padding)
    text = cipher.decrypt(base64.b64decode(en_pwd.encode('utf-8')), "ERROR")  # 将密文解密成明文,返回的是一个bytes类型数据,需要自己转换成str

    return text.decode('utf-8')

Installation fails due to conflicting wheel version

Hi, users are unable to run ops due to dependency conflict with wheel package. As shown in the following full dependency graph of ops, billiard==3.5.0.4 requires wheel>=0.29.0,while django-crispy-forms==1.7.2 requires wheel==0.24.0.

According to pip’s “first found wins” installation strategy, wheel==0.33.4 is the actually installed version. However, wheel==0.33.4 does not satisfy wheel==0.24.0.

Dependency tree-------

Ops(version range:)
| +-aioredis(version range:==1.1.0)
| +-amqp(version range:==2.3.2)
| +-ansible(version range:==2.4.1.0)
| +-asgi-redis(version range:==1.4.3)
| +-asgiref(version range:==2.3.2)
| +-asn1crypto(version range:==0.24.0)
| +-async-timeout(version range:==3.0.0)
| +-attrs(version range:==18.1.0)
| +-autobahn(version range:==18.5.2)
| +-automat(version range:==0.6.0)
| +-bcrypt(version range:==3.1.4)
| +-billiard(version range:==3.5.0.4)
| | +-wheel(version range:>=0.29.0)
| | +-case(version range:>=1.3.1)
| | +-flake8(version range:>=2.5.4)
| | +-flakeplus(version range:>=1.1)
| | +-pytest(version range:>=3.0)
| | +-pytest-cov(version range:)
| | +-setuptools(version range:>=20.6.7)
| | +-tox(version range:>=2.3.1)
| | +-0(version range:>=0.29.0)
| +-celery(version range:==4.2.0)
| +-certifi(version range:==2018.4.16)
| +-cffi(version range:==1.11.5)
| +-channels(version range:==2.1.1)
| +-channels-redis(version range:==2.2.1)
| +-chardet(version range:==3.0.4)
| +-constantly(version range:==15.1.0)
| +-cryptography(version range:==2.2.2)
| +-daphne(version range:==2.1.2)
| +-diff-match-patch(version range:==20121119)
| +-django(version range:==2.0.5)
| +-django-celery-beat(version range:==1.2.0)
| +-django-celery-results(version range:==1.0.1)
| +-django-cors-headers(version range:==2.5.0)
| +-django-crispy-forms(version range:==1.7.2)
| | +-coverage(version range:)
| | +-django(version range:)
| | +-pytest(version range:)
| | +-pytest-cov(version range:)
| | +-pytest-django(version range:)
| | +-twine(version range:==1.5.0)
| | +-wheel(version range:==0.24.0)
| +-django-filter(version range:==1.1.0)
| +-django-formtools(version range:==2.1)
| | +-Django(version range:>=1.11)
| +-django-haystack(version range:==2.8.1)
| +-django-import-export(version range:==1.0.1)
| +-django-reversion(version range:==2.0.13)
| +-django-timezone-field(version range:==3.0)
| +-djangorestframework(version range:==3.8.2)
| +-et-xmlfile(version range:==1.0.1)
| | +-python(version range:>=2.6.0)
| +-future(version range:==0.15.2)
| +-gevent(version range:==1.3.7)
| +-gitdb2(version range:==2.0.5)
| +-gitpython(version range:==2.1.11)
| +-greenlet(version range:==0.4.15)
| +-hiredis(version range:==0.2.0)
| +-html5lib(version range:==1.0.1)
| +-httplib2(version range:==0.9.2)
| +-hyperlink(version range:==18.0.0)
| +-idna(version range:==2.6)
| +-incremental(version range:==17.5.0)
| +-jdcal(version range:==1.4)
| +-jieba(version range:==0.39)
| +-jinja2(version range:==2.10)
| +-kombu(version range:==4.2.1)
| +-markdown(version range:==2.6.11)
| +-markupsafe(version range:==1.0)
| +-msgpack(version range:==0.5.6)
| +-msgpack-python(version range:==0.5.6)
| +-nose(version range:==1.3.7)
| +-odfpy(version range:==1.3.6)
| +-openpyxl(version range:==2.5.3)
| +-paramiko(version range:==2.4.1)
| +-pillow(version range:==5.2.0)
| +-ply(version range:==3.11)
| +-pyasn1(version range:==0.4.2)
| +-pycparser(version range:==2.18)
| +-pycryptodomex(version range:==3.6.1)
| +-pyguacamole(version range:==0.8)
| +-pymongo(version range:==3.6.1)
| +-pymysql(version range:==0.8.1)
| +-pynacl(version range:==1.2.1)
| +-pysmi(version range:==0.3.0)
| +-pysnmp(version range:==4.4.4)
| +-python-crontab(version range:==2.3.5)
| | +-python-dateutil(version range:)
| +-python-dateutil(version range:==2.7.3)
| +-python-nmap(version range:==0.6.1)
| | +-coverage(version range:==4.0.3)
| | +-flake8(version range:==2.5.1)
| | +-mccabe(version range:==0.3.1)
| | +-nose(version range:==1.3.7)
| | +-pep8(version range:==1.7.0)
| | +-pluggy(version range:==0.3.1)
| | +-pudb(version range:==2015.4.1)
| | +-py(version range:==1.4.31)
| | +-pyflakes(version range:==1.0.0)
| | +-pygments(version range:==2.1)
| | +-tox(version range:==2.3.1)
| | +-urwid(version range:==1.3.1)
| | +-virtualenv(version range:==14.0.1)
| +-pytz(version range:==2018.4)
| +-pyyaml(version range:==3.12)
| +-redis(version range:==2.10.6)
| +-requests(version range:==2.19.1)
| +-six(version range:==1.10.0)
| +-smmap2(version range:==2.0.5)
| +-svn(version range:==0.3.46)
| +-tablib(version range:==0.12.1)
| | +-odfpy(version range:)
| | +-openpyxl(version range:)
| | | +-jdcal(version range:)
| | | +-et_xmlfile(version range:)
| | +-unicodecsv(version range:)
| | +-xlrd(version range:)
| | +-xlwt(version range:)
| | +-pyyaml(version range:)
| +-twisted(version range:==17.5.0)
| +-txaio(version range:==2.10.0)
| +-unicodecsv(version range:==0.14.1)
| +-urllib3(version range:==1.23)
| +-vine(version range:==1.1.4)
| +-webencodings(version range:==0.5.1)
| +-websockets(version range:==5.0.1)
| +-whoosh(version range:==2.7.4)
| +-xlrd(version range:==1.1.0)
| +-xlwt(version range:==1.3.0)
| +-zope.interface(version range:==4.5.0)

Thanks for your help.
Best,
Neolith

[问题] /etc/init.d/celeryd start 执行报错

按照文档执行,etc/init.d/celeryd start 报错,报错如下:

ops) [root@ops-common-python-person-1eiqn3l-5788 Ops]# /etc/init.d/celeryd start
celery init v10.1.
Using config script: /etc/default/celeryd
celery multi v4.2.0 (windowlicker)
> Starting nodes...
Traceback (most recent call last):
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/__main__.py", line 20, in <module>
    main()
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/bin/base.py", line 273, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/bin/base.py", line 479, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/bin/base.py", line 501, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/app/utils.py", line 359, in find_app
    sym = symbol_by_name(app, imp=imp)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/bin/base.py", line 504, in symbol_by_name
    return imports.symbol_by_name(name, imp=imp)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/kombu/utils/imports.py", line 56, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/root/.pyenv/versions/3.6.6/envs/ops/lib/python3.6/site-packages/celery/utils/imports.py", line 104, in import_from_cwd
    return imp(module, package=package)
  File "/root/.pyenv/versions/3.6.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'Ops'
	> [email protected]: * Child terminated with exit code 1
FAILED

##如果出现celeryd无法启动,则添加环境变量:export C_FORCE_ROOT="true", 已按照此方法处理,仍然报错.

部署代码卡住

到 执行同步代码任务 这步卡住
(后台显示 要输入远程主机的密码)

做到第六步时候无法继续

楼主,你好呀,感谢在百忙中看这个问题,因为现在按照文档一路搭建下来,到达第6步得时候,启动服务报错找不到app指定的module,最后查看是配置文件那有个app地方需要指定,请问这个module是需要我们手动写吗?还是他官方有提供的默认模板?如果需要写能提供个模板吗?

playbook管理界面,执行playbook的时候只能获取到定义到yaml文件中的主机名,无法获取到inventory主机组中的主机

playbook管理界面,执行playbook的时候只能获取到定义到yaml文件中的主机名,无法获取到inventory主机组中的主机,
看ansible源代码中
pb = Playbook.load(playbook_path, variable_manager=self._variable_manager, loader=self._loader)

FIXME: move out of inventory self._inventory.set_playbook_basedir(os.path.realpath(os.path.dirname(playbook_path)))

不知道self._inventory的值怎么传递进去???

请教

export C_FORCE_ROOT="true"是放在哪个脚本里面?celeryd.conf还是celeryd.server

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.