From f954bc0a5a7b0229de7d1ae419f02e34c546cb13 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Mon, 9 Apr 2018 12:27:53 +0300 Subject: [PATCH] Remove jinja2 dependency of do While `do` looks cleaner, forcing this extra option in ansible.cfg seems to be more invasive. It would be better to keep the traditional approach of `set dummy = ` instead. --- ansible.cfg | 1 - .../kubernetes/node/templates/kubelet.standard.env.j2 | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index 6f381690e..d3102a6f4 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -13,4 +13,3 @@ callback_whitelist = profile_tasks roles_path = roles:$VIRTUAL_ENV/usr/local/share/kubespray/roles:$VIRTUAL_ENV/usr/local/share/ansible/roles:/usr/share/kubespray/roles deprecation_warnings=False inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo, .creds -jinja2_extensions = jinja2.ext.do diff --git a/roles/kubernetes/node/templates/kubelet.standard.env.j2 b/roles/kubernetes/node/templates/kubelet.standard.env.j2 index 5fef2476e..e9d7e960f 100644 --- a/roles/kubernetes/node/templates/kubelet.standard.env.j2 +++ b/roles/kubernetes/node/templates/kubelet.standard.env.j2 @@ -83,20 +83,20 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}" {# Kubelet node labels #} {% set role_node_labels = [] %} {% if inventory_hostname in groups['kube-master'] %} -{% do role_node_labels.append('node-role.kubernetes.io/master=true') %} +{% set dummy = role_node_labels.append('node-role.kubernetes.io/master=true') %} {% if not standalone_kubelet|bool %} -{% do role_node_labels.append('node-role.kubernetes.io/node=true') %} +{% set dummy = role_node_labels.append('node-role.kubernetes.io/node=true') %} {% endif %} {% else %} -{% do role_node_labels.append('node-role.kubernetes.io/node=true') %} +{% set dummy = role_node_labels.append('node-role.kubernetes.io/node=true') %} {% endif %} {% if inventory_hostname in groups['kube-ingress']|default([]) %} -{% do role_node_labels.append('node-role.kubernetes.io/ingress=true') %} +{% set dummy = role_node_labels.append('node-role.kubernetes.io/ingress=true') %} {% endif %} {% set inventory_node_labels = [] %} {% if node_labels is defined %} {% for labelname, labelvalue in node_labels.iteritems() %} -{% do inventory_node_labels.append(labelname + '=' + labelvalue) %} +{% set dummy = inventory_node_labels.append(labelname + '=' + labelvalue) %} {% endfor %} {% endif %} {% set all_node_labels = role_node_labels + inventory_node_labels %}