From 7828ad5b9212dc40ab7148482bade14dd14bd595 Mon Sep 17 00:00:00 2001 From: Deimosfr Date: Sat, 9 May 2015 23:15:49 +0200 Subject: [PATCH] can set uid and gid of mongodb user --- README.md | 2 ++ defaults/main.yml | 2 ++ tasks/configure.yml | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 56b9228..362421c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ mongodb_disable_thp: true mongodb_manage_service: true mongodb_user: mongodb +mongodb_uid: +mongodb_gid: mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}" mongodb_conf_auth: false # Run with security diff --git a/defaults/main.yml b/defaults/main.yml index 6a4c25d..0dafae3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,6 +8,8 @@ mongodb_disable_thp: true mongodb_manage_service: true mongodb_user: mongodb +mongodb_uid: +mongodb_gid: mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}" mongodb_conf_auth: false # Run with security diff --git a/tasks/configure.yml b/tasks/configure.yml index 181810e..8f694b3 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,5 +1,13 @@ --- +- name: set mongodb gid + group: name=mongodb gid={{ mongodb_gid }} state=present + when: mongodb_gid + +- name: set mongodb uid + user: name=mongodb uid={{ mongodb_uid }} group=mongodb state=present + when: mongodb_uid + - name: Register default MongoDB listen IP set_fact: mongodb_listen_ip=127.0.0.1 when: ansible_local.mongodb.mongodb.mongodb_listen_ip is undefined