--- # INPUT r_etcd_upgrade_version - name: Verify cluster is healthy pre-upgrade command: "{{ etcdctlv2 }} cluster-health" - name: Get current image shell: "grep 'ExecStart=' {{ etcd_service_file }} | awk '{print $NF}'" register: current_image - name: Set new_etcd_image set_fact: new_etcd_image: "{{ current_image.stdout | regex_replace('/etcd.*$','/etcd:' ~ r_etcd_upgrade_version ) }}" - name: Pull new etcd image command: "docker pull {{ new_etcd_image }}" - name: Update to latest etcd image replace: dest: "{{ etcd_service_file }}" regexp: "{{ current_image.stdout }}$" replace: "{{ new_etcd_image }}" - import_tasks: validate_etcd_conf.yml - name: restart etcd command: /usr/local/bin/master-restart etcd - name: Verify cluster is healthy command: "{{ etcdctlv2 }} cluster-health" register: etcdctl until: etcdctl.rc == 0 retries: 3 delay: 10