---
- name: Restart etcd
  hosts: oo_etcd_to_config
  serial: 1
  tasks:
    - name: restart etcd
      service:
        name: "{{ 'etcd_container' if openshift.common.etcd_runtime == 'docker' else 'etcd' }}"
        state: restarted
      when:
        - not g_etcd_certificates_expired | default(false) | bool

- name: Restart etcd
  hosts: oo_etcd_to_config
  tasks:
    - name: stop etcd
      service:
        name: "{{ 'etcd_container' if openshift.common.etcd_runtime == 'docker' else 'etcd' }}"
        state: stopped
      when:
        - g_etcd_certificates_expired | default(false) | bool
    - name: start etcd
      service:
        name: "{{ 'etcd_container' if openshift.common.etcd_runtime == 'docker' else 'etcd' }}"
        state: started
      when:
        - g_etcd_certificates_expired | default(false) | bool