40b635b9c5
Change-Id: If3828170c00a9c5327b94d9253be93aefa147db9 Partially-implements: blueprint better-reconfigure
39 lines
1.6 KiB
YAML
39 lines
1.6 KiB
YAML
---
|
|
- name: Restart mongodb container
|
|
vars:
|
|
service_name: "mongodb"
|
|
service: "{{ mongodb_services[service_name] }}"
|
|
config_json: "{{ mongodb_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
mongodb_conf: "{{ mongodb_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
mongodb_container: "{{ check_mongodb_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
|
kolla_docker:
|
|
action: "recreate_or_restart_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
name: "{{ service.container_name }}"
|
|
image: "{{ service.image }}"
|
|
privileged: "{{ service.privileged | default(False) }}"
|
|
volumes: "{{ service.volumes }}"
|
|
when:
|
|
- action != "config"
|
|
- inventory_hostname in groups[service.group]
|
|
- service.enabled | bool
|
|
- config_json.changed | bool
|
|
or mongodb_conf.changed | bool
|
|
or mongodb_container.changed | bool
|
|
notify:
|
|
- Waiting for the mongodb startup
|
|
- Checking current replication status
|
|
|
|
- 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"
|