xoxys.mongodb/tasks/config.yml
2018-07-08 02:04:09 +02:00

50 lines
1.3 KiB
YAML

---
- block:
- 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 '{{ mongodb_storage_dbpath }}'
file:
path: "{{ mongodb_storage_dbpath }}"
owner: "{{ mongodb_system_user }}"
group: "{{ mongodb_system_group }}"
selevel: s0
serole : object_r
setype: mongod_var_lib_t
seuser: system_u
state: directory
- name: Create log dir '{{ mongodb_systemlog_path | dirname }}'
file:
path: "{{ mongodb_systemlog_path | dirname }}"
owner: "{{ mongodb_system_user }}"
group: "{{ mongodb_system_group }}"
recurse: yes
state: directory
when: mongodb_systemlog_destination == 'file'
- name: Deploy configuration file
template:
src: etc/mongod.conf.j2
dest: /etc/mongod.conf
mode: 0644
notify: __mongod_restart
- name: Make sure mongodb is up and running
systemd:
name: mongod
state: started
enabled: yes
become: True
become_user: root