Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mongodb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible
roles
mongodb
Commits
d4f673fd
Verified
Commit
d4f673fd
authored
3 years ago
by
nd
Browse files
Options
Downloads
Patches
Plain Diff
add cluster, user creation and replication setup support
parent
76f01a03
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
defaults/main.yml
+18
-0
18 additions, 0 deletions
defaults/main.yml
tasks/main.yml
+35
-0
35 additions, 0 deletions
tasks/main.yml
templates/mongod.conf.j2
+4
-40
4 additions, 40 deletions
templates/mongod.conf.j2
vars/main.yml
+1
-0
1 addition, 0 deletions
vars/main.yml
with
58 additions
and
40 deletions
defaults/main.yml
+
18
−
0
View file @
d4f673fd
mongodb
:
version
:
"
4.2"
api_user
:
"
{{
omit
}}"
api_password
:
"
{{
omit
}}"
config
:
storage
:
dbPath
:
/var/lib/mongodb
journal
:
enabled
:
true
systemLog
:
destination
:
file
logAppend
:
true
path
:
/var/log/mongodb/mongod.log
net
:
port
:
27017
bindIp
:
127.0.0.1
processManagement
:
timeZoneInfo
:
/usr/share/zoneinfo
replication
:
replSetName
:
rs01
backup
:
enable
:
true
keep_days
:
2
This diff is collapsed.
Click to expand it.
tasks/main.yml
+
35
−
0
View file @
d4f673fd
-
name
:
install pymongo from pip because the debian version is too old
pip
:
executable
:
pip3
name
:
pymongo
-
name
:
copy mongodb config
notify
:
-
restart mongodb
...
...
@@ -16,6 +21,36 @@
daemon_reload
:
yes
enabled
:
yes
-
name
:
flush handlers
meta
:
flush_handlers
-
name
:
create replica sets
retries
:
3
delay
:
5
loop
:
"
{{
mongodb.replicaset|dict2items
}}"
community.mongodb.mongodb_replicaset
:
login_host
:
"
{{
mongodb.config.net.bindIp
}}"
login_port
:
"
{{
mongodb.config.net.port
}}"
login_user
:
"
{{
mongodb.api_user
}}"
login_password
:
"
{{
mongodb.api_password
}}"
replica_set
:
"
{{
item.key|d(mongodb.config.replication.replSetName)
}}"
members
:
"
{{
item.value.members
}}"
validate
:
no
-
name
:
create mongodb user
no_log
:
true
loop
:
"
{{
mongodb.user|dict2items
}}"
community.mongodb.mongodb_user
:
login_host
:
"
{{
mongodb.config.net.bindIp
}}"
login_port
:
"
{{
mongodb.config.net.port
}}"
login_user
:
"
{{
mongodb.api_user
}}"
login_password
:
"
{{
mongodb.api_password
}}"
name
:
"
{{
item.key
}}"
password
:
"
{{
item.value.password
}}"
roles
:
"
{{
item.value.roles
}}"
database
:
"
{{
item.value.database|d('admin')
}}"
replica_set
:
"
{{
item.value.replica_set|d(mongodb.config.replication.replSetName)
}}"
-
include_tasks
:
backup.yml
when
:
-
mongodb.backup.enable
This diff is collapsed.
Click to expand it.
templates/mongod.conf.j2
+
4
−
40
View file @
d4f673fd
...
...
@@ -2,43 +2,7 @@
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
replication:
replSetName: rs01
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
#
# {{ ansible_managed }}
#
{{ mongodb.config|to_nice_yaml }}
This diff is collapsed.
Click to expand it.
vars/main.yml
+
1
−
0
View file @
d4f673fd
packages
:
pkg
:
"
python3-pip"
:
{}
"
mongodb-org"
:
{}
repos
:
mongodb
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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