From 188bae142ba47d16113232770dfecbb8e9fddaf1 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Wed, 20 Sep 2017 14:30:09 +0100 Subject: [PATCH] Fix wait for hosts in CI (#1679) Also fix usage of failed_when and handling exit code. --- roles/bootstrap-os/tasks/bootstrap-coreos.yml | 12 ++++++------ roles/kubernetes/master/tasks/static-pod-setup.yml | 2 +- tests/cloud_playbooks/create-gce.yml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/bootstrap-os/tasks/bootstrap-coreos.yml b/roles/bootstrap-os/tasks/bootstrap-coreos.yml index 2a2271055..18747f139 100644 --- a/roles/bootstrap-os/tasks/bootstrap-coreos.yml +++ b/roles/bootstrap-os/tasks/bootstrap-coreos.yml @@ -7,7 +7,7 @@ - name: Bootstrap | Run bootstrap.sh script: bootstrap.sh - when: (need_bootstrap | failed) + when: need_bootstrap.rc != 0 - set_fact: ansible_python_interpreter: "/opt/bin/python" @@ -19,31 +19,31 @@ failed_when: false changed_when: false check_mode: no - when: (need_bootstrap | failed) + when: need_bootstrap.rc != 0 tags: facts - name: Bootstrap | Copy get-pip.py copy: src: get-pip.py dest: ~/get-pip.py - when: (need_pip | failed) + when: need_pip != 0 - name: Bootstrap | Install pip shell: "{{ansible_python_interpreter}} ~/get-pip.py" - when: (need_pip | failed) + when: need_pip != 0 - name: Bootstrap | Remove get-pip.py file: path: ~/get-pip.py state: absent - when: (need_pip | failed) + when: need_pip != 0 - name: Bootstrap | Install pip launcher copy: src: runner dest: /opt/bin/pip mode: 0755 - when: (need_pip | failed) + when: need_pip != 0 - name: Install required python modules pip: diff --git a/roles/kubernetes/master/tasks/static-pod-setup.yml b/roles/kubernetes/master/tasks/static-pod-setup.yml index 0f600b244..b94c07431 100644 --- a/roles/kubernetes/master/tasks/static-pod-setup.yml +++ b/roles/kubernetes/master/tasks/static-pod-setup.yml @@ -31,7 +31,7 @@ register: create_system_ns until: create_system_ns.rc == 0 changed_when: False - when: kubesystem|failed and inventory_hostname == groups['kube-master'][0] + when: kubesystem.rc != 0 and inventory_hostname == groups['kube-master'][0] tags: apps - name: Write kube-scheduler kubeconfig diff --git a/tests/cloud_playbooks/create-gce.yml b/tests/cloud_playbooks/create-gce.yml index 11cd9a646..2b4822723 100644 --- a/tests/cloud_playbooks/create-gce.yml +++ b/tests/cloud_playbooks/create-gce.yml @@ -63,4 +63,4 @@ gather_facts: false tasks: - name: Wait for SSH to come up. - local_action: wait_for host={{ansible_host}} port=22 delay=60 timeout=240 state=started + local_action: wait_for host={{inventory_hostname}} port=22 delay=60 timeout=240 state=started