Add user for backup mongodb databases

This commit is contained in:
e.dekhtyarev 2015-11-17 12:14:41 +06:00
parent b22dcbdd28
commit 05b608b31a
3 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -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"

View File

@ -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 }}"