mirror of
https://github.com/status-im/ansible-role-mongodb.git
synced 2025-01-09 21:15:44 +00:00
47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
---
|
|
|
|
- name: create administrative user siteRootAdmin
|
|
mongodb_user:
|
|
database: admin
|
|
name: "{{ item.name }}"
|
|
password: "{{ item.password }}"
|
|
roles: "{{ item.roles }}"
|
|
login_host: 127.0.0.1
|
|
login_port: "{{ mongodb_conf_port|default(27017) }}"
|
|
with_items:
|
|
- {
|
|
name: "{{ mongodb_root_admin_name }}",
|
|
password: "{{ mongodb_root_admin_password }}",
|
|
roles: "root"
|
|
}
|
|
|
|
- name: create administrative user siteUserAdmin
|
|
mongodb_user:
|
|
database: admin
|
|
name: "{{ item.name }}"
|
|
password: "{{ item.password }}"
|
|
roles: "{{ item.roles }}"
|
|
login_host: 127.0.0.1
|
|
login_port: "{{ mongodb_conf_port|default(27017) }}"
|
|
with_items:
|
|
- {
|
|
name: "{{ mongodb_user_admin_name }}",
|
|
password: "{{ mongodb_user_admin_password }}",
|
|
roles: "userAdminAnyDatabase"
|
|
}
|
|
|
|
- name: create normal users
|
|
mongodb_user:
|
|
database: "{{ item.database }}"
|
|
name: "{{ item.name }}"
|
|
password: "{{ item.password }}"
|
|
roles: "{{ item.roles }}"
|
|
replica_set: "{{ mongodb_conf_replSet }}"
|
|
login_host: 127.0.0.1
|
|
login_port: "{{ mongodb_conf_port|default(27017) }}"
|
|
login_user: "{{ mongodb_user_admin_name }}"
|
|
login_password: "{{ mongodb_user_admin_password }}"
|
|
with_items:
|
|
- "{{ mongodb_users }}"
|
|
when: mongodb_users is defined
|