- name: Enable at boot and start mongodb service: name=mongod.service enabled=yes state=started
- name: Add the admin user to the replicaset mongodb_user: database=admin name=admin password={{ mongo_admin_pass }} login_port={{ mongod_port }} roles='root' state=present ignore_errors: yes
- name: Create the file to initialize the replicaset template: src=repset_init.j2 dest=/tmp/repset_init.js
- name: Initialize the replication set on the primary shell: /usr/bin/mongo -u admin -p {{ mongo_admin_pass }} --authenticationDatabase admin /tmp/repset_init.js run_once: true- name: Create the unauthenticated mongodb configuration file
template: src=mongod_unauthenticated.conf.j2 dest=/etc/mongod.conf
- name: Enable at boot and start mongodb
service: name=mongod.service enabled=yes state=started
- name: Add the admin user to the replicaset
mongodb_user: database=admin name=admin password={{ mongo_admin_pass }} login_port={{ mongod_port }} roles='root' state=present
ignore_errors: yes
- name: Add the graylog user to the replicaset
mongodb_user: database=graylog name=gray password=gray login_port={{ mongod_port }} roles='dbOwner' state=present
ignore_errors: yes
- name: Create the file to initialize the replicaset
template: src=repset_init.j2 dest=/tmp/repset_init.js
- name: Initialize the replication set on the primary
shell: /usr/bin/mongo -u admin -p {{ mongo_admin_pass }} --authenticationDatabase admin /tmp/repset_init.js
run_once: true