27 lines
996 B
YAML
27 lines
996 B
YAML
---
|
|
- name: Starting mongodb container
|
|
kolla_docker:
|
|
action: "start_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
image: "{{ mongodb_image_full }}"
|
|
name: "mongodb"
|
|
privileged: True
|
|
volumes:
|
|
- "{{ node_config_directory }}/mongodb/:{{ container_config_directory }}/:ro"
|
|
- "/etc/localtime:/etc/localtime:ro"
|
|
- "kolla_logs:/var/log/kolla/"
|
|
- "mongodb:/var/lib/mongodb"
|
|
|
|
- name: Waiting for the mongodb startup
|
|
wait_for: host={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} port={{ mongodb_port }}
|
|
|
|
- name: Checking current replication status
|
|
command: "docker exec -t mongodb mongo {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} --quiet --eval rs.status().ok"
|
|
register: mongodb_replication_status
|
|
changed_when: false
|
|
delegate_to: "{{ groups['mongodb'][0] }}"
|
|
run_once: True
|
|
|
|
- include: "bootstrap_cluster.yml"
|
|
when: mongodb_replication_status.stdout != "1"
|