Mark Goddard 2e190597bb Fix missed kolla_action and kolla_serial
In change I78cb60168aaa40bb6439198283546b7faf33917c, action was changed
to kolla_action, and serial to kolla_serial, to avoid Ansible warnings
due to use of reserved keywords. In that change, some keywords were
missed, and some changes that were merged since then have not switched
to the new variables. This change fixes all current instances of those
issues.

Change-Id: I357dffdfcb2b405e280a962d366ee65eebf0a8d1
Implements: blueprint migrate-to-ansible-2-2-0
2018-05-16 13:13:06 +01:00

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:
- kolla_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"