inlcude user and storage setup

This commit is contained in:
Robert Kaussow 2018-07-07 00:05:37 +02:00
parent 52ee3143f2
commit 9a716d6625
2 changed files with 41 additions and 41 deletions

View File

@ -2,7 +2,7 @@
mongodb_version: 3.6
mongodb_system_user: mongod
mongodb_system_group: mongod
mongodb_storage_dbpath:
mongodb_storage_dbpath: /var/lib/mongo
# mongodb_system_gid: omit

View File

@ -14,28 +14,28 @@
name: mongodb-org
state: present
# - name: Create system group '{{ mongodb_system_group }}'
# group:
# name: "{{ mongodb_system_group }}"
# gid: "{{ mongodb_system_gid | default(omit) }}"
# state: present
#
# - name: Create system user '{{ mongodb_system_user }}'
# user:
# name: "{{ mongodb_system_user }}"
# uid: "{{ mongodb_system_uid | default(omit) }}"
# group: "{{ mongodb_system_group }}"
# notify: __mongod_restart
#
# - name: Create db storage dir at '{{ mongodb_storage_dbpath }}'
# file:
# path: "{{ mongodb_storage_dbpath }}"
# owner: "{{ mongodb_system_user }}"
# group: "{{ mongodb_system_group }}"
# follow: yes
# recurse: yes
# state: directory
#
- name: Create system group '{{ mongodb_system_group }}'
group:
name: "{{ mongodb_system_group }}"
gid: "{{ mongodb_system_gid | default(omit) }}"
state: present
- name: Create system user '{{ mongodb_system_user }}'
user:
name: "{{ mongodb_system_user }}"
uid: "{{ mongodb_system_uid | default(omit) }}"
group: "{{ mongodb_system_group }}"
notify: __mongod_restart
- name: Create db storage dir at '{{ mongodb_storage_dbpath }}'
file:
path: "{{ mongodb_storage_dbpath }}"
owner: "{{ mongodb_system_user }}"
group: "{{ mongodb_system_group }}"
follow: yes
recurse: yes
state: directory
# - name: Make sure mongodb is running
# systemd:
# name: mongod