53 lines
1.0 KiB
YAML
53 lines
1.0 KiB
YAML
---
|
|
|
|
- name: 检查 topic_name
|
|
fail:
|
|
msg: 需要在host定义 topic_name
|
|
when: topic_name is undefined
|
|
|
|
- name: 检查 consumer_id
|
|
fail:
|
|
msg: 需要在host定义 consumer_id
|
|
when: consumer_id is undefined
|
|
|
|
- name: 创建代码目录
|
|
file:
|
|
path: /data/code
|
|
state: directory
|
|
|
|
- name: 创建日志目录
|
|
file:
|
|
path: /data/log/xlegudata_consumer
|
|
state: directory
|
|
|
|
- name: 拷贝代码
|
|
unarchive:
|
|
src: xlegudata_consumer.tar.gz
|
|
dest: /data/code/
|
|
register: xlegudata_consumer_changed_result
|
|
|
|
- name: 安装环境
|
|
shell:
|
|
chdir: /data/code/xlegudata_consumer
|
|
cmd: pipenv install Pipfile
|
|
when: xlegudata_consumer_changed_result.changed
|
|
|
|
- name: 添加配置
|
|
template:
|
|
src: xdata_consumer.ini.j2
|
|
dest: /etc/supervisord.d/xdata_consumer.ini
|
|
|
|
- name: 更新配置
|
|
shell:
|
|
chdir: ~
|
|
cmd: supervisorctl update
|
|
|
|
- name: 代码改变重启动
|
|
shell:
|
|
chdir: ~
|
|
cmd: supervisorctl restart xdata_consumer
|
|
when: xlegudata_consumer_changed_result.changed
|
|
|
|
|
|
|