Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
b797b47f
Commit
b797b47f
authored
Nov 09, 2015
by
Feanil Patel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2449 from edx/feanil/mongo_3_0_role_update
Feanil/mongo 3 0 role update
parents
5e7227e8
8d91b529
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
playbooks/roles/mongo_3_0/tasks/main.yml
+16
-3
playbooks/roles/mongo_3_0/templates/repset_add_secondaries.js.j2
+2
-2
playbooks/roles/mongo_3_0/templates/repset_init.js.j2
+2
-2
No files found.
playbooks/roles/mongo_3_0/tasks/main.yml
View file @
b797b47f
...
...
@@ -12,9 +12,9 @@
register
:
mongodb_already_installed
when
:
MONGO_CLUSTERED
-
name
:
verify MongoDB not installed (clustered upgrades)
fail
:
msg="MongoDB is currently installed and cannot be safely upgraded in a clustered configuration. FIXME"
when
:
mongodb_already_installed.stat.exists and MONGO_CLUSTERED
#
- name: verify MongoDB not installed (clustered upgrades)
#
fail: msg="MongoDB is currently installed and cannot be safely upgraded in a clustered configuration. FIXME"
#
when: mongodb_already_installed.stat.exists and MONGO_CLUSTERED
-
name
:
remove mongo 2.4 if present
apt
:
>
...
...
@@ -190,6 +190,19 @@
file
:
path=/tmp/repset_add_secondaries.js state=absent
when
:
MONGO_CLUSTERED and MONGO_PRIMARY == ansible_default_ipv4["address"]
-
name
:
ensure all members are in replica set
mongo_rs_member
:
rs_host
:
"
{{
MONGO_PRIMARY
}}"
rs_port
:
27017
host
:
"
{{
ansible_default_ipv4['address']
}}"
port
:
27017
username
:
"
{{
MONGO_ADMIN_USER
}}"
password
:
"
{{
MONGO_ADMIN_PASSWORD
}}"
state
:
"
{{
item.state
}}"
hidden
:
"
{{
item.hidden
}}"
with_items
:
mongo_cluster_members
when
:
item.name == ansible_default_ipv4["address"]
-
name
:
create a mongodb user
mongodb_user
:
>
database={{ item.database }}
...
...
playbooks/roles/mongo_3_0/templates/repset_add_secondaries.js.j2
View file @
b797b47f
...
...
@@ -20,7 +20,7 @@ db.auth( '{{ MONGO_ADMIN_USER }}', '{{ MONGO_ADMIN_PASSWORD }}');
{%- endif -%}
{%- endfor -%}
{%- else -%}
{%- set hosts = mongo_cluster_members -%}
{%- set hosts = mongo_cluster_members
|map(attribute="name")
-%}
{%- endif -%}
// Check that the cluster is ok
...
...
@@ -30,7 +30,7 @@ if(!rs.status().ok) { throw 'Mongo Cluster Not Ok';}
// and add them if we are the master
if(rs.isMaster().ismaster) {
if(rs.status().members.length!={{ hosts|length }}) {
{% for host in
mongo_cluster_member
s %}
{% for host in
host
s %}
{%- if host != ansible_default_ipv4["address"] -%}
rs.add({_id: {{ loop.index }}, host: '{{ host }}'});
{%- endif -%}
...
...
playbooks/roles/mongo_3_0/templates/repset_init.js.j2
View file @
b797b47f
...
...
@@ -22,11 +22,11 @@ db.auth( '{{ MONGO_ADMIN_USER }}', '{{ MONGO_ADMIN_PASSWORD }}');
{%- endif -%}
{%- endfor -%}
{%- else -%}
{%- set hosts = mongo_cluster_members -%}
{%- set hosts = mongo_cluster_members
|map(attribute="name")
-%}
{%- endif -%}
config = {_id: '{{ mongo_repl_set }}', members: [{% for host in
mongo_cluster_member
s %}
config = {_id: '{{ mongo_repl_set }}', members: [{% for host in
host
s %}
{%- if host == ansible_default_ipv4["address"] -%}
{_id: {{ loop.index }}, host: '{{ host }}'}
{%- endif -%}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment