/ansible-module-mongodb_gridfs

Ansible module to manipulate MongoDB's gridfs files

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

Ansible mongodb_gridfs module

Puts or deletes a file from a MongoDB GridFS.

Requirements

  • PyMongo package

Install

$ ansible-galaxy install koichirok.mongodb_gridfs-module
# playbook.yml

- hosts: default
  roles:
  # After you call this role, you can use this module.
  - koichirok.mongodb_gridfs-module

Synopsis

Puts or deletes a file from a MongoDB GridFS.

Options

Parameter required default choices comments
collection fs The name of the root collection to put/delete the file from
content When used instead of `src', sets the contents of a file to the specified value.
database yes The name of the database to put/delete the file from
dest The path on the GridFS to put or delete
login_database database which specified by database option The database where login credentials are stored
login_host localhost The host running the database
login_password The password used to authenticate with
login_port 27017 The port to connect to
login_user The username used to authenticate with
replase False remove other files with same name after put.
replica_set Replica set to connect to (automatically connects to primary for writes)
src Local path to a file to put to the GridFS.
ssl Whether to use an SSL connection when connecting to the database
ssl_cert_reqs CERT_REQUIRED
  • CERT_REQUIRED
  • CERT_OPTIONAL
  • CERT_NONE
Specifies whether a certificate is required from the other side of the connection, and whether it will be validated if provided.
state present
  • present
  • absent
Whether to add (present'), or remove (absent')

Examples


- name: example put file to GridFS
  copy:
    database: login
    src: /srv/myfiles/foo.conf
    dest: /etc/foo.conf


Return Values

Notes

License

GPLv3