From 5f167f612a9bd52bc8983ec6f3f143e7e5daca82 Mon Sep 17 00:00:00 2001 From: Sergei Antipov Date: Mon, 9 Feb 2015 18:38:18 +0600 Subject: [PATCH] Added variables and task for replicaSet configuration --- defaults/main.yml | 21 +++++++++++++++++++++ tasks/configure.yml | 9 +++++++++ templates/mongod.conf.j2 | 2 ++ 3 files changed, 32 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index a55bfa1..12d3f2b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -33,6 +33,8 @@ mongodb_conf_syslog: "no" # Log to system's syslog facil # Replica set options: mongodb_conf_replSet: # Enable replication [/] 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 # Syntax: mongodb_shell: @@ -55,3 +57,22 @@ mongodb_logrotate_options: - dateext - rotate 7 - 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 diff --git a/tasks/configure.yml b/tasks/configure.yml index a7d8e61..7a8fdbd 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -17,6 +17,15 @@ - name: Configure logs 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 command: mongo {{ item.key }} --eval "{{ item.value|join('\n') }}" with_dict: mongodb_shell diff --git a/templates/mongod.conf.j2 b/templates/mongod.conf.j2 index 2da21a1..e9b062d 100644 --- a/templates/mongod.conf.j2 +++ b/templates/mongod.conf.j2 @@ -23,4 +23,6 @@ syslog = {{ mongodb_conf_syslog }} # Replica set options: replSet = {{ mongodb_conf_replSet }} replIndexPrefetch = {{ mongodb_conf_replIndexPrefetch }} +oplogSize = {{ mongodb_conf_oplogSize }} +keyFile = {{ mongodb_conf_keyFile }} {% endif %}