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
OpenEdx
configuration
Commits
fa79c178
Commit
fa79c178
authored
Jun 09, 2016
by
Kevin Falcone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Primarily doc updates, with one clumping together of similar code.
parent
96b465ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
playbooks/edx-east/mongo_upgrade_hidden_secondaries.yml
+1
-1
playbooks/library/mongodb_rs_config
+6
-6
No files found.
playbooks/edx-east/mongo_upgrade_hidden_secondaries.yml
View file @
fa79c178
...
...
@@ -19,7 +19,7 @@
connection
:
local
gather_facts
:
False
tasks
:
-
name
:
Get
status
of mongo cluster
-
name
:
Get
configuration
of mongo cluster
mongodb_rs_config
:
host
:
"
{{
(MONGO_RS_CONFIG.members|map(attribute='host')|list)[0]
}}"
username
:
"
{{
MONGO_ADMIN_USER
}}"
...
...
playbooks/library/mongodb_rs_config
View file @
fa79c178
...
...
@@ -108,11 +108,7 @@ def main():
if
repl_set
:
status
=
client
.
admin
.
command
(
"replSetGetStatus"
)
else
:
module
.
exit_json
(
changed
=
False
)
# Not using `replSetGetConfig` because it's not supported in MongoDB 2.x.
if
repl_set
:
# Not using `replSetGetConfig` because it's not supported in MongoDB 2.x.
rs_config
=
client
.
local
.
system
.
replset
.
find_one
()
else
:
module
.
exit_json
(
changed
=
False
)
...
...
@@ -123,9 +119,13 @@ def main():
status
=
json
.
loads
(
json_util
.
dumps
(
status
))
rs_config
=
json
.
loads
(
json_util
.
dumps
(
rs_config
))
# Status contains information about Primary/Secondary, so we iterate that list
# But we want to return config for that host, not status (since this is the config module),
# this is the inner loop of the comprehension, where we match on the hostname (could also
# match on _id).
primary
=
[
c
for
m
in
status
[
'members'
]
if
m
[
'stateStr'
]
==
'PRIMARY'
for
c
in
rs_config
[
'members'
]
if
m
[
'name'
]
==
c
[
'host'
]
]
secondary
=
[
c
for
m
in
status
[
'members'
]
if
m
[
'stateStr'
]
==
'SECONDARY'
for
c
in
rs_config
[
'members'
]
if
m
[
'name'
]
==
c
[
'host'
]
]
# we're parsing the config here, much simpler
# we're parsing the config
directly
here, much simpler
hidden
=
[
m
for
m
in
rs_config
[
'members'
]
if
m
[
'hidden'
]
]
module
.
exit_json
(
changed
=
False
,
primary
=
primary
,
secondary
=
secondary
,
hidden
=
hidden
,
config
=
rs_config
)
...
...
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