Added variables and task for replicaSet configuration

This commit is contained in:
Sergei Antipov 2015-02-09 18:38:18 +06:00
parent 2dba294ff8
commit 5f167f612a
3 changed files with 32 additions and 0 deletions

View File

@ -33,6 +33,8 @@ mongodb_conf_syslog: "no" # Log to system's syslog facil
# Replica set options: # Replica set options:
mongodb_conf_replSet: # Enable replication <setname>[/<optionalseedhostlist>] mongodb_conf_replSet: # Enable replication <setname>[/<optionalseedhostlist>]
mongodb_conf_replIndexPrefetch: "all" # specify index prefetching behavior (if secondary) [none|_id_only|all] mongodb_conf_replIndexPrefetch: "all" # specify index prefetching behavior (if secondary) [none|_id_only|all]
mongodb_conf_oplogSize: 512 # specifies a maximum size in megabytes for the replication operation log
mongodb_conf_keyFile: /etc/mongodb-keyfile # Specify path to keyfile with password for inter-process authentication
mongodb_shell: {} # Define mongo shell commands to run mongodb_shell: {} # Define mongo shell commands to run
# Syntax: mongodb_shell: # Syntax: mongodb_shell:
@ -55,3 +57,22 @@ mongodb_logrotate_options:
- dateext - dateext
- rotate 7 - rotate 7
- size 10M - size 10M
# password for inter-process authentication
mongodb_keyfile_content: |
8pYcxvCqoe89kcp33KuTtKVf5MoHGEFjTnudrq5BosvWRoIxLowmdjrmUpVfAivh
CHjqM6w0zVBytAxH1lW+7teMYe6eDn2S/O/1YlRRiW57bWU3zjliW3VdguJar5i9
Z+1a8lI+0S9pWynbv9+Ao0aXFjSJYVxAm/w7DJbVRGcPhsPmExiSBDw8szfQ8PAU
2hwRl7nqPZZMMR+uQThg/zV9rOzHJmkqZtsO4UJSilG9euLCYrzW2hdoPuCrEDhu
Vsi5+nwAgYR9dP2oWkmGN1dwRe0ixSIM2UzFgpaXZaMOG6VztmFrlVXh8oFDRGM0
cGrFHcnGF7oUGfWnI2Cekngk64dHA2qD7WxXPbQ/svn9EfTY5aPw5lXzKA87Ds8p
KHVFUYvmA6wVsxb/riGLwc+XZlb6M9gqHn1XSpsnYRjF6UzfRcRR2WyCxLZELaqu
iKxLKB5FYqMBH7Sqg3qBCtE53vZ7T1nefq5RFzmykviYP63Uhu/A2EQatrMnaFPl
TTG5CaPjob45CBSyMrheYRWKqxdWN93BTgiTW7p0U6RB0/OCUbsVX6IG3I9N8Uqt
l8Kc+7aOmtUqFkwo8w30prIOjStMrokxNsuK9KTUiPu2cj7gwYQ574vV3hQvQPAr
hhb9ohKr0zoPQt31iTj0FDkJzPepeuzqeq8F51HB56RZKpXdRTfY8G6OaOT68cV5
vP1O6T/okFKrl41FQ3CyYN5eRHyRTK99zTytrjoP2EbtIZ18z+bg/angRHYNzbgk
lc3jpiGzs1ZWHD0nxOmHCMhU4usEcFbV6FlOxzlwrsEhHkeiununlCsNHatiDgzp
ZWLnP/mXKV992/Jhu0Z577DHlh+3JIYx0PceB9yzACJ8MNARHF7QpBkhtuGMGZpF
T+c73exupZFxItXs1Bnhe3djgE3MKKyYvxNUIbcTJoe7nhVMrwO/7lBSpVLvC4p3
wR700U0LDaGGQpslGtiE56SemgoP

View File

@ -17,6 +17,15 @@
- name: Configure logs - name: Configure logs
file: state=file path={{ mongodb_conf_logpath }} owner={{mongodb_user}} group={{mongodb_user}} mode=0644 file: state=file path={{ mongodb_conf_logpath }} owner={{mongodb_user}} group={{mongodb_user}} mode=0644
- name: Create keyFile
copy:
dest: "{{ mongodb_conf_keyFile }}"
content: "{{ mongodb_keyfile_content }}"
owner: "{{ mongodb_user }}"
group: "root"
mode: 0600
when: mongodb_conf_replSet != ""
- name: Run mongoshell commands - name: Run mongoshell commands
command: mongo {{ item.key }} --eval "{{ item.value|join('\n') }}" command: mongo {{ item.key }} --eval "{{ item.value|join('\n') }}"
with_dict: mongodb_shell with_dict: mongodb_shell

View File

@ -23,4 +23,6 @@ syslog = {{ mongodb_conf_syslog }}
# Replica set options: # Replica set options:
replSet = {{ mongodb_conf_replSet }} replSet = {{ mongodb_conf_replSet }}
replIndexPrefetch = {{ mongodb_conf_replIndexPrefetch }} replIndexPrefetch = {{ mongodb_conf_replIndexPrefetch }}
oplogSize = {{ mongodb_conf_oplogSize }}
keyFile = {{ mongodb_conf_keyFile }}
{% endif %} {% endif %}