Skip to content

Commit a3a4b61

Browse files
author
Sergei Antipov
committed
Moved mongodb_user task into auth_init
1 parent 9442794 commit a3a4b61

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

tasks/auth_initialization.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@
3333
roles: "root"
3434
}
3535

36+
- name: create normal users
37+
mongodb_user:
38+
database: "{{ item.database }}"
39+
name: "{{ item.name }}"
40+
password: "{{ item.password }}"
41+
roles: "{{ item.roles }}"
42+
replica_set: "{{ mongodb_conf_replSet }}"
43+
login_user: "{{ mongodb_user_admin_name }}"
44+
login_password: "{{ mongodb_user_admin_password }}"
45+
login_port: "{{ mongodb_conf_port }}"
46+
with_items:
47+
- "{{ mongodb_users }}"
48+
3649
- name: Move back mongod.conf
3750
template: src=mongod.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0644
3851

tasks/main.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
when: mongodb_conf_auth and not mongodb_conf_replSet
2121
tags: [mongodb]
2222

23-
- include: user_add.yml
24-
when: mongodb_conf_auth and mongodb_users
25-
tags: [mongodb]
26-
2723
- include: mms-agent.yml
2824
when: mongodb_mms_api_key != ""
2925
tags: [mongodb]

tasks/user_add.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)