27 lines
856 B
YAML
27 lines
856 B
YAML
---
|
|
- name: Copying the mongodb replication set bootstrap script
|
|
template:
|
|
src: bootstrap_cluster.js.j2
|
|
dest: /tmp/mongodb_bootstrap_replication_set.js
|
|
delegate_to: localhost
|
|
run_once: True
|
|
|
|
- name: Bootstrapping the mongodb replication set
|
|
become: true
|
|
command: >
|
|
docker exec -t mongodb mongo --host {{ api_interface_address }} --port {{ mongodb_port }} --quiet --eval
|
|
'{{ lookup('file','/tmp/mongodb_bootstrap_replication_set.js') }}'
|
|
register: bootstrap_mongodb_cluster
|
|
failed_when: (bootstrap_mongodb_cluster.stdout|from_json).ok != 1
|
|
delegate_to: "{{ groups['mongodb'][0] }}"
|
|
run_once: True
|
|
|
|
- name: Deleting the mongodb replication set bootstrap script
|
|
file:
|
|
path: /tmp/mongodb_bootstrap_replication_set.js
|
|
state: absent
|
|
delegate_to: localhost
|
|
changed_when: false
|
|
failed_when: false
|
|
run_once: True
|