You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.5 KiB

  1. ---
  2. - name: Set no_proxy to all assigned cluster IPs and hostnames
  3. set_fact:
  4. no_proxy_prepare: >-
  5. {%- if loadbalancer_apiserver is defined -%}
  6. {{ apiserver_loadbalancer_domain_name| default('') }},
  7. {{ loadbalancer_apiserver.address | default('') }},
  8. {%- endif -%}
  9. {%- if no_proxy_exclude_workers | default(false) -%}
  10. {% set cluster_or_master = 'kube_control_plane' %}
  11. {%- else -%}
  12. {% set cluster_or_master = 'k8s_cluster' %}
  13. {%- endif -%}
  14. {%- for item in (groups[cluster_or_master] + groups['etcd']|default([]) + groups['calico_rr']|default([]))|unique -%}
  15. {{ hostvars[item]['access_ip'] | default(hostvars[item]['ip'] | default(fallback_ips[item])) }},
  16. {%- if item != hostvars[item].get('ansible_hostname', '') -%}
  17. {{ hostvars[item]['ansible_hostname'] }},
  18. {{ hostvars[item]['ansible_hostname'] }}.{{ dns_domain }},
  19. {%- endif -%}
  20. {{ item }},{{ item }}.{{ dns_domain }},
  21. {%- endfor -%}
  22. {%- if additional_no_proxy is defined -%}
  23. {{ additional_no_proxy }},
  24. {%- endif -%}
  25. 127.0.0.1,localhost,{{ kube_service_addresses }},{{ kube_pods_subnet }},svc,svc.{{ dns_domain }}
  26. delegate_to: localhost
  27. connection: local
  28. delegate_facts: yes
  29. become: no
  30. run_once: yes
  31. - name: Populates no_proxy to all hosts
  32. set_fact:
  33. no_proxy: "{{ hostvars.localhost.no_proxy_prepare }}"
  34. proxy_env: "{{ proxy_env | combine({
  35. 'no_proxy': hostvars.localhost.no_proxy_prepare,
  36. 'NO_PROXY': hostvars.localhost.no_proxy_prepare
  37. }) }}"