ansible_xdata/roles/mongodb/tasks/install.yml
2020-12-08 23:10:25 +08:00

31 lines
537 B
YAML

---
- name: 解压缩
unarchive:
src: mongodb.tar.gz
dest: /usr/local/
- name: 创建数据目录
file:
path: /data/db
state: directory
mode: '0777'
- name: 创建日志目录
file:
path: /data/log
state: directory
mode: '0777'
- name: 拷贝服务文件
copy:
src: mongod
dest: /etc/init.d/mongod
mode: '0777'
- name: 开机自启动
shell:
chdir: ~
cmd: chkconfig --add mongod && chkconfig mongod on
- name: 创建用户
include: create_user.yml