kolla-ansible/ansible/roles/mongodb/tasks/bootstrap_cluster.yml
Bertrand Lallau afdd11b9a2 Generalize api_interface_address variable usage
Useful api_interface_address variable has been define here:
https://github.com/openstack/kolla-ansible/blob/master/ansible/group_vars/all.yml#L57
In order to simplify codebase we must use it as much as possible.

Change-Id: I18fec19bf69e05a22a4142a9cd1165eccd022455
2017-05-23 08:35:15 +00:00

18 lines
763 B
YAML

---
- name: Copying the mongodb replication set bootstrap script
local_action: template src=bootstrap_cluster.js.j2 dest=/tmp/mongodb_bootstrap_replication_set.js
run_once: True
- name: Bootstraping the mongodb replication set
command: "docker exec -t mongodb mongo {{ api_interface_address }} --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
local_action: file path=/tmp/mongodb_bootstrap_replication_set.js state=absent
changed_when: false
failed_when: false
run_once: True