Changes in authorization

This commit is contained in:
Sergei Antipov 2015-02-17 13:26:56 +06:00
parent 416fb2daf8
commit d8d847825d
1 changed files with 9 additions and 13 deletions

View File

@ -1,16 +1,13 @@
--- ---
- name: Install required package for mongodb_user module
apt: name=python-pymongo
- name: create administrative user siteRootAdmin - name: create administrative user siteRootAdmin
mongodb_user: mongodb_user:
database: admin database: admin
name: "{{ item.name }}" name: "{{ item.name }}"
password: "{{ item.password }}" password: "{{ item.password }}"
roles: "{{ item.roles }}" roles: "{{ item.roles }}"
login_host: "{{ mongodb_login_host|default('localhost') }}" login_host: 127.0.0.1
login_port: "{{ mongodb_login_port|default(27017) }}" login_port: "{{ mongodb_conf_port|default(27017) }}"
with_items: with_items:
- { - {
name: "{{ mongodb_root_admin_name }}", name: "{{ mongodb_root_admin_name }}",
@ -24,10 +21,8 @@
name: "{{ item.name }}" name: "{{ item.name }}"
password: "{{ item.password }}" password: "{{ item.password }}"
roles: "{{ item.roles }}" roles: "{{ item.roles }}"
login_host: "{{ mongodb_login_host|default('localhost') }}" login_host: 127.0.0.1
login_port: "{{ mongodb_login_port|default(27017) }}" login_port: "{{ mongodb_conf_port|default(27017) }}"
login_user: "{{ mongodb_root_admin_name }}"
login_password: "{{ mongodb_root_admin_password }}"
with_items: with_items:
- { - {
name: "{{ mongodb_user_admin_name }}", name: "{{ mongodb_user_admin_name }}",
@ -41,10 +36,11 @@
name: "{{ item.name }}" name: "{{ item.name }}"
password: "{{ item.password }}" password: "{{ item.password }}"
roles: "{{ item.roles }}" roles: "{{ item.roles }}"
login_host: "{{ mongodb_login_host|default('localhost') }}" replica_set: "{{ mongodb_conf_replSet }}"
login_port: "{{ mongodb_login_port|default(27017) }}" login_host: 127.0.0.1
login_user: "{{ mongodb_root_admin_name }}" login_port: "{{ mongodb_conf_port|default(27017) }}"
login_password: "{{ mongodb_root_admin_password }}" login_user: "{{ mongodb_user_admin_name }}"
login_password: "{{ mongodb_user_admin_password }}"
with_items: with_items:
- "{{ mongodb_users }}" - "{{ mongodb_users }}"
when: mongodb_users is defined when: mongodb_users is defined