Skip to content

Commit

Permalink
Fixed an issue where without a default GW, ansible_default_ipv4 would…
Browse files Browse the repository at this point in the history
… return an empty dict which passed as a valid fallback_ip dict item (kubernetes-sigs#5394)
  • Loading branch information
eddebc authored and LuckySB committed Apr 9, 2020
1 parent 2797d17 commit b2ed09a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion roles/kubespray-defaults/defaults/main/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,13 @@ contiv_global_as: "65002"
contiv_global_neighbor_as: "500"

# Set 127.0.0.1 as fallback IP if we do not have host facts for host
# ansible_default_ipv4 isn't what you think.
# Thanks https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10
fallback_ips_base: |
---
{% for item in groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([])|unique %}
{{ item }}: "{{ hostvars[item].get('ansible_default_ipv4', {'address': '127.0.0.1'})['address'] }}"
{% set found = hostvars[item].get('ansible_default_ipv4') %}
{{ item }}: "{{ found.get('address', '127.0.0.1') }}"
{% endfor %}
fallback_ips: "{{ fallback_ips_base | from_yaml }}"

Expand Down

0 comments on commit b2ed09a

Please sign in to comment.