enix.mongodb
enix.mongodb
This is a tool to set up and configure MongoDB and its extensions on Unix systems using Ansible.
Requirements
Supported Operating Systems:
- Ubuntu 16.04 "Xenial"
- Ubuntu 18.04 "Bionic"
- Debian 8 "Jessie"
- Debian 9 "Stretch"
- Debian 10 "Buster"
Role Variables
This role comes with many default settings. You can change these in your host/group variables, in your inventory, or in your playbook. For help with configurations, check the annotated defaults in defaults/main.yml
. All the variables start with mongodb__
.
mongodb__version
: The version of MongoDB to install. Defaults to 4.2. Available versions are 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4.mongodb__apt_localkey
: If your system is behind a proxy, it might have trouble getting the repository key. Setting this to true will use a local copy. Defaults to false.mongodb__packages
: The MongoDB packages to install. Defaults tomongodb-org
which installs everything. You can also select:mongodb-org-server
,mongodb-org-mongos
,mongodb-org-shell
,mongodb-org-tools
. More details can be found here.mongodb__conf_port
: The port that MongoDB will use. Defaults to 27017.mongodb__conf_bindIp
: The IP address that MongoDB will bind to. Defaults to 127.0.0.1.mongodb__conf_extra
: Additional configuration settings formongod.conf
. This needs to be in YAML format that the MongoDB service can understand.
mongodb__conf_extra: |
net.ipv6: false
systemLog:
verbosity: 2
logRotate: reopen
Dependencies
- None
Usage
To use this role, add it to your Ansible galaxy requirements file (requirements.yml
):
# mongodb from enix
- src: enix.mongodb
Then include it in your Ansible playbook:
- hosts: all
roles:
- role: enix.mongodb
mongodb__version: 4.2
mongodb__packages: ["mongodb-org-server", "mongodb-org-tools"]
You can also run it as a playbook. You will be prompted to choose hosts to set up, and you can customize further with --extra-vars
.
$ ansible-playbook -i inventory --extra-vars='{...}' main.yml
Future Improvements
- Add support for MongoDB clustering.
- Add support for sharding.
- Manage users and credentials.
Changelog
1.2.0
- Added support for Debian Buster.
- Included newer MongoDB versions (4.2, 4.4).
1.1.0
- Added support for using a local GnuPG key.
1.0.0
- Initial release of the role.
License
GPLv2
Author Information
Laurent Corbes laurent.corbes@enix.fr - enix.io