kolla-ansible/ansible/roles/mongodb/tasks/bootstrap_cluster.yml
Bertrand Lallau 8e20a550af Fix warning during Mongodb bootstrap task
[WARNING]: when statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found:
{{ (bootstrap_mongodb_cluster.stdout|from_json).ok != 1 }}

Reason: Ansible 2.3.0 does not like delimiters in when statement.

Fix small typo

Change-Id: I69ea5f640b8e841e532eca97b7ed3959e9335967
Closes-Bug: #1714337
2017-08-31 20:01:19 +00:00

18 lines
756 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: Bootstrapping 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