Add user for backup mongodb databases
This commit is contained in:
parent
b22dcbdd28
commit
05b608b31a
|
@ -14,6 +14,7 @@ mongodb_package: mongodb-org
|
|||
|
||||
mongodb_force_wait_for_port: false # When not forced, the role will wait for mongod port to become available only with systemd
|
||||
mongodb_pymongo_from_pip: false # Install latest PyMongo via PIP or package manager
|
||||
mongodb_pymongo_pip_version: "2.9"
|
||||
mongodb_disable_thp: true
|
||||
|
||||
mongodb_manage_service: true
|
||||
|
|
|
@ -83,3 +83,6 @@ mongodb_user_admin_password: passw0rd
|
|||
|
||||
mongodb_root_admin_name: siteRootAdmin
|
||||
mongodb_root_admin_password: passw0rd
|
||||
|
||||
mongodb_root_backup_name: "backupuser"
|
||||
mongodb_root_backup_password: "o8vUd0ldMVuyLKxY9ZiU"
|
||||
|
|
|
@ -44,14 +44,27 @@
|
|||
roles: "root"
|
||||
}
|
||||
|
||||
- name: create backup user "backupuser"
|
||||
mongodb_user:
|
||||
database: admin
|
||||
name: "{{ item.name }}"
|
||||
password: "{{ item.password }}"
|
||||
roles: "{{ item.roles }}"
|
||||
login_port: "{{ mongodb_conf_port }}"
|
||||
when: mongodb_conf_auth
|
||||
with_items:
|
||||
- {
|
||||
name: "{{ mongodb_root_backup_name }}",
|
||||
password: "{{ mongodb_root_backup_password }}",
|
||||
roles: "backup,clusterMonitor"
|
||||
}
|
||||
|
||||
- name: create normal users
|
||||
mongodb_user:
|
||||
database: "{{ item.database }}"
|
||||
name: "{{ item.name }}"
|
||||
password: "{{ item.password }}"
|
||||
roles: "{{ item.roles }}"
|
||||
login_user: "{{ mongodb_user_admin_name }}"
|
||||
login_password: "{{ mongodb_user_admin_password }}"
|
||||
login_port: "{{ mongodb_conf_port }}"
|
||||
with_items:
|
||||
- "{{ mongodb_users }}"
|
||||
|
|
Loading…
Reference in New Issue