--- - name: create mongodb data directory file: name: /srv/mongodb state: directory - name: create bind mount for mongodb mount: src: /srv/mongodb path: /var/lib/mongodb fstype: none opts: bind,defaults state: mounted - name: install mongodb server apt: name: - mongodb - mongo-tools - python-pymongo state: present # - name: check if admin user already exists # command: > # mongo --quiet -u root -p {{ liquidtruth_root_password }} --eval 'db.version()' admin # register: mongodb_root_user_check # changed_when: false # check_mode: no # ignore_errors: true # no_log: true # - name: initialize authorization # include_tasks: mongodb_authorization.yml # when: mongodb_root_user_check