2016-07-21 01:22:56 +08:00
|
|
|
---
|
|
|
|
- name: Copying the mongodb replication set bootstrap script
|
2016-09-13 13:27:27 +02:00
|
|
|
local_action: template src=bootstrap_cluster.js.j2 dest=/tmp/mongodb_bootstrap_replication_set.js
|
2016-07-21 01:22:56 +08:00
|
|
|
run_once: True
|
|
|
|
|
2017-08-31 21:47:15 +02:00
|
|
|
- name: Bootstrapping the mongodb replication set
|
2017-04-18 09:10:44 +02:00
|
|
|
command: "docker exec -t mongodb mongo {{ api_interface_address }} --quiet --eval '{{ lookup('file','/tmp/mongodb_bootstrap_replication_set.js') }}'"
|
2016-07-21 01:22:56 +08:00
|
|
|
register: bootstrap_mongodb_cluster
|
2017-08-31 21:47:15 +02:00
|
|
|
failed_when: (bootstrap_mongodb_cluster.stdout|from_json).ok != 1
|
2016-07-21 01:22:56 +08:00
|
|
|
delegate_to: "{{ groups['mongodb'][0] }}"
|
|
|
|
run_once: True
|
|
|
|
|
|
|
|
- name: Deleting the mongodb replication set bootstrap script
|
2016-09-13 13:27:27 +02:00
|
|
|
local_action: file path=/tmp/mongodb_bootstrap_replication_set.js state=absent
|
2016-07-21 01:22:56 +08:00
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
run_once: True
|