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.
This commit is contained in:
Matthew Mosesohn 2018-04-09 12:27:53 +03:00
parent 7b8359df4d
commit f954bc0a5a
2 changed files with 5 additions and 6 deletions

View file

@ -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 roles_path = roles:$VIRTUAL_ENV/usr/local/share/kubespray/roles:$VIRTUAL_ENV/usr/local/share/ansible/roles:/usr/share/kubespray/roles
deprecation_warnings=False deprecation_warnings=False
inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo, .creds inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo, .creds
jinja2_extensions = jinja2.ext.do

View file

@ -83,20 +83,20 @@ KUBELET_HOSTNAME="--hostname-override={{ kube_override_hostname }}"
{# Kubelet node labels #} {# Kubelet node labels #}
{% set role_node_labels = [] %} {% set role_node_labels = [] %}
{% if inventory_hostname in groups['kube-master'] %} {% 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 %} {% 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 %} {% endif %}
{% else %} {% 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 %} {% endif %}
{% if inventory_hostname in groups['kube-ingress']|default([]) %} {% 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 %} {% endif %}
{% set inventory_node_labels = [] %} {% set inventory_node_labels = [] %}
{% if node_labels is defined %} {% if node_labels is defined %}
{% for labelname, labelvalue in node_labels.iteritems() %} {% for labelname, labelvalue in node_labels.iteritems() %}
{% do inventory_node_labels.append(labelname + '=' + labelvalue) %} {% set dummy = inventory_node_labels.append(labelname + '=' + labelvalue) %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% set all_node_labels = role_node_labels + inventory_node_labels %} {% set all_node_labels = role_node_labels + inventory_node_labels %}