Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vitamui-pr-pastis
Manage
Activity
Members
Labels
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dad
vitamui-pr-pastis
Commits
78aee8bb
Commit
78aee8bb
authored
4 years ago
by
Mathieu Leguay
Browse files
Options
Downloads
Patches
Plain Diff
[DLAB-4126] Fix authentication detection for mongo
parent
d915c01e
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Feature/design/1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deployment/roles/mongo_init/tasks/check_auth.yml
+26
-21
26 additions, 21 deletions
deployment/roles/mongo_init/tasks/check_auth.yml
with
26 additions
and
21 deletions
deployment/roles/mongo_init/tasks/check_auth.yml
+
26
−
21
View file @
78aee8bb
---
---
-
name
:
Check if authent is enabled
command
:
"
mongo
--host
mongodb://{{
mongod_uri
}}/admin?replicaSet={{
mongod_replicaset_name
}}
-u
{{
mongodb.admin.user
}}
-p
{{
mongodb.admin.password
}}
--quiet
--eval
'db.help()'"
register
:
mongo_authent_enabled
failed_when
:
false
no_log
:
"
{{
hide_passwords_during_deploy
}}"
when
:
mongodb.docker is not defined or not mongodb.docker.enable
-
name
:
Load script in database (docker)
shell
:
"
docker
exec
--tty
{{
mongodb.docker.image_name
}}
/bin/bash
-c
\"
mongo
--host
mongodb://{{
mongod_uri
}}/admin?replicaSet={{
mongod_replicaset_name
}}
-u
{{
mongodb.admin.user
}}
-p
{{
mongodb.admin.password
}}
--quiet
--eval
'db.help()'
\"
"
no_log
:
"
{{
hide_passwords_during_deploy
}}"
failed_when
:
false
register
:
mongo_authent_enabled
when
:
mongodb.docker is defined and mongodb.docker.enable
# Set mongo_no_auth facts
# Set mongo_no_auth facts
-
name
:
Set default mongo facts
-
name
:
Set default mongo facts
set_fact
:
set_fact
:
mongo_credentials
:
"
"
mongo_credentials
:
"
"
mongo_no_auth
:
false
mongo_no_auth
:
false
-
name
:
Set mongo_no_auth fact to
true
-
block
:
set_fact
:
-
name
:
Check if authent is enabled
mongo_no_auth
:
true
command
:
"
mongo
--host
mongodb://{{
mongod_uri
}}/admin?replicaSet={{
mongod_replicaset_name
}}
-u
{{
mongodb.admin.user
}}
-p
{{
mongodb.admin.password
}}
--quiet
--eval
'db.help()'"
when
:
"
mongo_authent_enabled.rc
!=
0"
register
:
mongo_authent_enabled
failed_when
:
false
no_log
:
"
{{
hide_passwords_during_deploy
}}"
-
name
:
Set mongo_no_auth fact to
true
set_fact
:
mongo_no_auth
:
true
when
:
"
mongo_authent_enabled.rc
!=
0"
when
:
mongodb.docker is not defined or not mongodb.docker.enable
-
block
:
-
name
:
Load script in database (docker)
shell
:
"
docker
exec
--tty
{{
mongodb.docker.image_name
}}
/bin/bash
-c
\"
mongo
--host
mongodb://{{
mongod_uri
}}/admin?replicaSet={{
mongod_replicaset_name
}}
-u
{{
mongodb.admin.user
}}
-p
{{
mongodb.admin.password
}}
--quiet
--eval
'db.help()'
\"
"
no_log
:
"
{{
hide_passwords_during_deploy
}}"
failed_when
:
false
register
:
mongo_authent_enabled
-
name
:
Set mongo_no_auth fact to
true
set_fact
:
mongo_no_auth
:
true
when
:
"
mongo_authent_enabled.rc
!=
0"
when
:
mongodb.docker is defined and mongodb.docker.enable
# When authentication is required, we set mongodb admin credentials
# When authentication is required, we set mongodb admin credentials
-
name
:
Set mongodb authentication credentials
-
name
:
Set mongodb authentication credentials
set_fact
:
set_fact
:
mongo_credentials
:
"
-u
{{
mongodb.admin.user
}}
-p
{{
mongodb.admin.password
}}
--authenticationDatabase
{{
mongodb.admin.db
}}
"
mongo_credentials
:
"
-u
{{
mongodb.admin.user
}}
-p
{{
mongodb.admin.password
}}
--authenticationDatabase
{{
mongodb.admin.db
}}
"
when
:
"
mongo_auth
ent_enabled.rc
==
0"
when
:
not
mongo_
no_
auth
no_log
:
"
{{
hide_passwords_during_deploy
}}"
no_log
:
"
{{
hide_passwords_during_deploy
}}"
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment