Fix wait for hosts in CI (#1679)

Also fix usage of failed_when and handling exit code.
This commit is contained in:
Matthew Mosesohn 2017-09-20 14:30:09 +01:00 committed by GitHub
parent ef8e35e39b
commit 188bae142b
3 changed files with 8 additions and 8 deletions

View file

@ -7,7 +7,7 @@
- name: Bootstrap | Run bootstrap.sh - name: Bootstrap | Run bootstrap.sh
script: bootstrap.sh script: bootstrap.sh
when: (need_bootstrap | failed) when: need_bootstrap.rc != 0
- set_fact: - set_fact:
ansible_python_interpreter: "/opt/bin/python" ansible_python_interpreter: "/opt/bin/python"
@ -19,31 +19,31 @@
failed_when: false failed_when: false
changed_when: false changed_when: false
check_mode: no check_mode: no
when: (need_bootstrap | failed) when: need_bootstrap.rc != 0
tags: facts tags: facts
- name: Bootstrap | Copy get-pip.py - name: Bootstrap | Copy get-pip.py
copy: copy:
src: get-pip.py src: get-pip.py
dest: ~/get-pip.py dest: ~/get-pip.py
when: (need_pip | failed) when: need_pip != 0
- name: Bootstrap | Install pip - name: Bootstrap | Install pip
shell: "{{ansible_python_interpreter}} ~/get-pip.py" shell: "{{ansible_python_interpreter}} ~/get-pip.py"
when: (need_pip | failed) when: need_pip != 0
- name: Bootstrap | Remove get-pip.py - name: Bootstrap | Remove get-pip.py
file: file:
path: ~/get-pip.py path: ~/get-pip.py
state: absent state: absent
when: (need_pip | failed) when: need_pip != 0
- name: Bootstrap | Install pip launcher - name: Bootstrap | Install pip launcher
copy: copy:
src: runner src: runner
dest: /opt/bin/pip dest: /opt/bin/pip
mode: 0755 mode: 0755
when: (need_pip | failed) when: need_pip != 0
- name: Install required python modules - name: Install required python modules
pip: pip:

View file

@ -31,7 +31,7 @@
register: create_system_ns register: create_system_ns
until: create_system_ns.rc == 0 until: create_system_ns.rc == 0
changed_when: False 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 tags: apps
- name: Write kube-scheduler kubeconfig - name: Write kube-scheduler kubeconfig

View file

@ -63,4 +63,4 @@
gather_facts: false gather_facts: false
tasks: tasks:
- name: Wait for SSH to come up. - 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