From 5b021ed4387e9b2a4ffdf9322d09b542937abecb Mon Sep 17 00:00:00 2001 From: Anthony Haussmann Date: Tue, 27 Sep 2016 16:41:09 +0200 Subject: [PATCH] Change method to set use_hyperkube_cni var bool The precedent method returb a string "True\n" or "False\n", it seems to be an Ansible bug. New method return a boolean --- roles/network_plugin/calico/tasks/main.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/roles/network_plugin/calico/tasks/main.yml b/roles/network_plugin/calico/tasks/main.yml index 69f91949a..d0d5c47c9 100644 --- a/roles/network_plugin/calico/tasks/main.yml +++ b/roles/network_plugin/calico/tasks/main.yml @@ -22,16 +22,15 @@ changed_when: false notify: restart calico-node -- name: Calico | Determine hyperkube cni to use depending of the version of kube +- name: Calico | Do not use hyperkube cni if kube_version under v1.3.4 set_fact: - use_hyperkube_cni: > - {%- if kube_version | version_compare('v1.3.4','>=') -%} - true - {%- elif kube_version | version_compare('v1.3.4','<') -%} - false - {%- else -%} - {{ ErrorCannotRecognizeVersion }} - {%- endif -%} + use_hyperkube_cni: false + when: kube_version | version_compare('v1.3.4','<') + +- name: Calico | Use hyperkube cni if kube_version above v1.3.4 + set_fact: + use_hyperkube_cni: true + when: kube_version | version_compare('v1.3.4','>=') - name: Calico | Install calico cni bin command: rsync -piu "{{ local_release_dir }}/calico/bin/calico" "/opt/cni/bin/calico"