You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.3 KiB
32 lines
1.3 KiB
---
|
|
# This playbook deploys the mongodb configurationdb servers
|
|
|
|
- name: Create data directory for mongoc configuration server
|
|
file: path=${mongodb_datadir_prefix}/configdb state=directory owner=mongod group=mongod
|
|
|
|
- name: Create the mongo configuration server startup file
|
|
template: src=../roles/mongoc/templates/mongoc.j2 dest=/etc/init.d/mongoc mode=0655
|
|
|
|
- name: Insert iptables rule for mongoc
|
|
lineinfile: dest=/etc/sysconfig/iptables state=present regexp="$mongoc_port" insertafter="^:OUTPUT " line="-A INPUT -p tcp --dport "$mongoc_port" -j ACCEPT"
|
|
|
|
- name: Apply iptable rule
|
|
service: name=iptables state=restarted
|
|
|
|
- name: Create the mongo configuration server file
|
|
template: src=../roles/mongoc/templates/mongoc.conf.j2 dest=/etc/mongoc.conf
|
|
|
|
- name: Create the script to add the admin user
|
|
template: src=../roles/mongoc/templates/adduser.j2 dest=/tmp/adduser.js
|
|
|
|
- name: Copy the keyfile for authentication
|
|
copy: src=../roles/mongod/files/secret dest=${mongodb_datadir_prefix}/secret owner=mongod group=mongod mode=0400
|
|
|
|
- name: Start the mongo configuration server service
|
|
command: creates=/var/lock/subsys/mongoc /etc/init.d/mongoc start
|
|
|
|
- name: pause
|
|
pause: seconds=20
|
|
|
|
- name: add the admin user
|
|
shell: /usr/bin/mongo localhost:7777/admin /tmp/adduser.js
|
|
|