mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-30 06:13:29 -02:30
Replace injected Ansible fact variables in network_plugin role (#13382)
This commit is contained in:
@@ -24,12 +24,12 @@
|
||||
include_vars: "{{ item }}"
|
||||
with_first_found:
|
||||
- files:
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower | replace('/', '_') }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_release }}.yml"
|
||||
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower | replace('/', '_') }}.yml"
|
||||
- "{{ ansible_distribution | lower }}.yml"
|
||||
- "{{ ansible_os_family | lower }}-{{ ansible_architecture }}.yml"
|
||||
- "{{ ansible_os_family | lower }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_version'] | lower | replace('/', '_') }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_release'] }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}-{{ ansible_facts['distribution_major_version'] | lower | replace('/', '_') }}.yml"
|
||||
- "{{ ansible_facts['distribution'] | lower }}.yml"
|
||||
- "{{ ansible_facts['os_family'] | lower }}-{{ ansible_facts['architecture'] }}.yml"
|
||||
- "{{ ansible_facts['os_family'] | lower }}.yml"
|
||||
- defaults.yml
|
||||
paths:
|
||||
- ../vars
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
enabled: true
|
||||
repo_gpgcheck: false
|
||||
when:
|
||||
- ansible_os_family in ['RedHat']
|
||||
- ansible_distribution not in ['Fedora']
|
||||
- ansible_facts['os_family'] in ['RedHat']
|
||||
- ansible_facts['distribution'] not in ['Fedora']
|
||||
- ansible_facts['distribution_major_version'] | int < 9
|
||||
|
||||
@@ -105,7 +105,7 @@ calico_nftable_mode: "Disabled"
|
||||
# Calico Wireguard support
|
||||
calico_wireguard_enabled: false
|
||||
calico_wireguard_packages: []
|
||||
calico_wireguard_repo: https://download.copr.fedorainfracloud.org/results/jdoss/wireguard/epel-{{ ansible_distribution_major_version }}-$basearch/
|
||||
calico_wireguard_repo: https://download.copr.fedorainfracloud.org/results/jdoss/wireguard/epel-{{ ansible_facts['distribution_major_version'] }}-$basearch/
|
||||
|
||||
# If you want to use non default IP_AUTODETECTION_METHOD, IP6_AUTODETECTION_METHOD for calico node set this option to one of:
|
||||
# * can-reach=DESTINATION
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
- name: Stop if kernel version is too low for Cilium Wireguard encryption
|
||||
assert:
|
||||
that: ansible_kernel.split('-')[0] is version('5.6.0', '>=')
|
||||
that: ansible_facts['kernel'].split('-')[0] is version('5.6.0', '>=')
|
||||
when:
|
||||
- kube_network_plugin == 'cilium' or cilium_deploy_additionally
|
||||
- cilium_encryption_enabled
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
- name: Flannel | Stop if kernel version is too low for Flannel Wireguard encryption
|
||||
assert:
|
||||
that: ansible_kernel.split('-')[0] is version('5.6.0', '>=')
|
||||
that: ansible_facts['kernel'].split('-')[0] is version('5.6.0', '>=')
|
||||
when:
|
||||
- kube_network_plugin == 'flannel'
|
||||
- flannel_backend_type == 'wireguard'
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
---
|
||||
- name: Kube-router | Add annotations on kube_control_plane
|
||||
command: "{{ kubectl }} annotate --overwrite node {{ ansible_hostname }} {{ item }}"
|
||||
command: "{{ kubectl }} annotate --overwrite node {{ ansible_facts['hostname'] }} {{ item }}"
|
||||
with_items:
|
||||
- "{{ kube_router_annotations_master }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: kube_router_annotations_master is defined and 'kube_control_plane' in group_names
|
||||
|
||||
- name: Kube-router | Add annotations on kube_node
|
||||
command: "{{ kubectl }} annotate --overwrite node {{ ansible_hostname }} {{ item }}"
|
||||
command: "{{ kubectl }} annotate --overwrite node {{ ansible_facts['hostname'] }} {{ item }}"
|
||||
with_items:
|
||||
- "{{ kube_router_annotations_node }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: kube_router_annotations_node is defined and 'kube_node' in group_names
|
||||
|
||||
- name: Kube-router | Add common annotations on all servers
|
||||
command: "{{ kubectl }} annotate --overwrite node {{ ansible_hostname }} {{ item }}"
|
||||
command: "{{ kubectl }} annotate --overwrite node {{ ansible_facts['hostname'] }} {{ item }}"
|
||||
with_items:
|
||||
- "{{ kube_router_annotations_all }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
service:
|
||||
# noqa: jinja[spacing]
|
||||
name: >-
|
||||
{% if ansible_os_family == "RedHat" -%}
|
||||
{% if ansible_facts['os_family'] == "RedHat" -%}
|
||||
network
|
||||
{%- elif ansible_distribution == "Ubuntu" and ansible_distribution_release == "bionic" -%}
|
||||
{%- elif ansible_facts['distribution'] == "Ubuntu" and ansible_facts['distribution_release'] == "bionic" -%}
|
||||
systemd-networkd
|
||||
{%- elif ansible_os_family == "Debian" -%}
|
||||
{%- elif ansible_facts['os_family'] == "Debian" -%}
|
||||
networking
|
||||
{%- endif %}
|
||||
state: restarted
|
||||
when: not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and kube_network_plugin not in ['calico']
|
||||
when: not ansible_facts['os_family'] in ["Flatcar", "Flatcar Container Linux by Kinvolk"] and kube_network_plugin not in ['calico']
|
||||
listen: Macvlan | restart network
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
dest: /etc/network/interfaces.d/60-mac0.cfg
|
||||
mode: "0644"
|
||||
notify: Macvlan | restart network
|
||||
when: ansible_os_family in ["Debian"]
|
||||
when: ansible_facts['os_family'] in ["Debian"]
|
||||
|
||||
- name: Install macvlan config on RH distros
|
||||
when: ansible_os_family == "RedHat"
|
||||
when: ansible_facts['os_family'] == "RedHat"
|
||||
block:
|
||||
- name: Macvlan | Install macvlan script on centos
|
||||
copy:
|
||||
@@ -61,7 +61,7 @@
|
||||
notify: Macvlan | restart network
|
||||
|
||||
- name: Install macvlan config on Flatcar
|
||||
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
||||
when: ansible_facts['os_family'] in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
|
||||
block:
|
||||
- name: Macvlan | Install service nat via gateway on Flatcar Container Linux
|
||||
template:
|
||||
|
||||
Reference in New Issue
Block a user