Merged backup user creating

This commit is contained in:
Sergei Antipov 2016-04-18 19:08:24 +06:00
commit 86d4cb209a
3 changed files with 29 additions and 0 deletions

View File

@ -91,6 +91,16 @@ mongodb_mms_group_id: ""
mongodb_mms_api_key: "" mongodb_mms_api_key: ""
mongodb_mms_base_url: https://mms.mongodb.com mongodb_mms_base_url: https://mms.mongodb.com
# Log rotation
mongodb_logrotate: true # Rotate mongodb logs.
mongodb_logrotate_options:
- compress
- copytruncate
- daily
- dateext
- rotate 7
- size 10M
# password for inter-process authentication # password for inter-process authentication
# please regenerate this file on production environment with command 'openssl rand -base64 741' # please regenerate this file on production environment with command 'openssl rand -base64 741'
mongodb_keyfile_content: | mongodb_keyfile_content: |
@ -138,6 +148,7 @@ Required vars to change on production:
```yaml ```yaml
mongodb_user_admin_password mongodb_user_admin_password
mongodb_root_admin_password mongodb_root_admin_password
mongodb_root_backup_name
# if you use replication and authorization # if you use replication and authorization
mongodb_security_keyfile mongodb_security_keyfile

View File

@ -87,3 +87,6 @@ mongodb_user_admin_password: passw0rd
mongodb_root_admin_name: siteRootAdmin mongodb_root_admin_name: siteRootAdmin
mongodb_root_admin_password: passw0rd mongodb_root_admin_password: passw0rd
mongodb_root_backup_name: "backupuser"
mongodb_root_backup_password: "passw0rd"

View File

@ -49,6 +49,21 @@
roles: "root" roles: "root"
} }
- name: create backup user "backupuser"
mongodb_user:
database: admin
name: "{{ item.name }}"
password: "{{ item.password }}"
update_password: "{{ mongodb_user_update_password }}"
roles: "{{ item.roles }}"
login_port: "{{ mongodb_net_port }}"
with_items:
- {
name: "{{ mongodb_root_backup_name }}",
password: "{{ mongodb_root_backup_password }}",
roles: "backup,clusterMonitor"
}
- name: Move back mongod.conf - name: Move back mongod.conf
template: src=mongod.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0644 template: src=mongod.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0644