project: resolve ansible-lint key-order rule (#10314)

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
This commit is contained in:
Arthur Outhenin-Chalandre
2023-08-10 09:57:27 +02:00
committed by GitHub
parent 2a7c9d27b2
commit d21bfb84ad
22 changed files with 100 additions and 109 deletions

View File

@@ -62,6 +62,9 @@
when: calicoctl_sh_exists.stat.exists
- name: Check that current calico version is enough for upgrade
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when: calicoctl_sh_exists.stat.exists and calico_ready.rc == 0
block:
- name: Get current calico version
shell: "set -o pipefail && {{ bin_dir }}/calicoctl.sh version | grep 'Client Version:' | awk '{ print $3}'"
@@ -78,9 +81,6 @@
Your version of calico is not fresh enough for upgrade.
Minimum version is {{ calico_min_version_required }} supported by the previous kubespray release.
But current version is {{ calico_version_on_server.stdout }}.
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when: calicoctl_sh_exists.stat.exists and calico_ready.rc == 0
- name: "Check that cluster_id is set if calico_rr enabled"
assert:
@@ -121,13 +121,13 @@
delegate_to: "{{ groups['kube_control_plane'][0] }}"
- name: "Check ipip and vxlan mode defined correctly"
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
assert:
that:
- "calico_ipip_mode in ['Always', 'CrossSubnet', 'Never']"
- "calico_vxlan_mode in ['Always', 'CrossSubnet', 'Never']"
msg: "calico inter host encapsulation mode is not 'Always', 'CrossSubnet' or 'Never'"
run_once: True
delegate_to: "{{ groups['kube_control_plane'][0] }}"
- name: "Check ipip and vxlan mode if simultaneously enabled"
assert:

View File

@@ -120,6 +120,9 @@
- enable_dual_stack_networks
- name: Calico | kdd specific configuration
when:
- inventory_hostname in groups['kube_control_plane']
- calico_datastore == "kdd"
block:
- name: Calico | Check if extra directory is needed
stat:
@@ -154,11 +157,10 @@
retries: 5
when:
- inventory_hostname == groups['kube_control_plane'][0]
when:
- inventory_hostname in groups['kube_control_plane']
- calico_datastore == "kdd"
- name: Calico | Configure Felix
when:
- inventory_hostname == groups['kube_control_plane'][0]
block:
- name: Calico | Get existing FelixConfiguration
command: "{{ bin_dir }}/calicoctl.sh get felixconfig default -o json"
@@ -200,10 +202,10 @@
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
stdin: "{{ _felix_config is string | ternary(_felix_config, _felix_config | to_json) }}"
changed_when: False
when:
- inventory_hostname == groups['kube_control_plane'][0]
- name: Calico | Configure Calico IP Pool
when:
- inventory_hostname == groups['kube_control_plane'][0]
block:
- name: Calico | Get existing calico network pool
command: "{{ bin_dir }}/calicoctl.sh get ippool {{ calico_pool_name }} -o json"
@@ -240,10 +242,11 @@
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
stdin: "{{ _calico_pool is string | ternary(_calico_pool, _calico_pool | to_json) }}"
changed_when: False
when:
- inventory_hostname == groups['kube_control_plane'][0]
- name: Calico | Configure Calico IPv6 Pool
when:
- inventory_hostname == groups['kube_control_plane'][0]
- enable_dual_stack_networks | bool
block:
- name: Calico | Get existing calico ipv6 network pool
command: "{{ bin_dir }}/calicoctl.sh get ippool {{ calico_pool_name }}-ipv6 -o json"
@@ -280,9 +283,6 @@
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
stdin: "{{ _calico_pool_ipv6 is string | ternary(_calico_pool_ipv6, _calico_pool_ipv6 | to_json) }}"
changed_when: False
when:
- inventory_hostname == groups['kube_control_plane'][0]
- enable_dual_stack_networks | bool
- name: Populate Service External IPs
set_fact:
@@ -305,6 +305,8 @@
run_once: yes
- name: Calico | Configure Calico BGP
when:
- inventory_hostname == groups['kube_control_plane'][0]
block:
- name: Calico | Get existing BGP Configuration
command: "{{ bin_dir }}/calicoctl.sh get bgpconfig default -o json"
@@ -345,8 +347,6 @@
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
stdin: "{{ _bgp_config is string | ternary(_bgp_config, _bgp_config | to_json) }}"
changed_when: False
when:
- inventory_hostname == groups['kube_control_plane'][0]
- name: Calico | Create calico manifests
template:

View File

@@ -6,6 +6,9 @@
failed_when: false
- name: Gather calico facts
tags:
- facts
when: calico_cni_config_slurp.content is defined
block:
- name: Set fact calico_cni_config from slurped CNI config
set_fact:
@@ -16,7 +19,6 @@
when:
- "'plugins' in calico_cni_config"
- "'etcd_endpoints' in calico_cni_config.plugins.0"
when: calico_cni_config_slurp.content is defined
- name: Calico | Get kubelet hostname
shell: >-
@@ -43,5 +45,3 @@
paths:
- ../vars
skip: true
tags:
- facts

View File

@@ -33,11 +33,11 @@
- not cni_config_slurp.failed
- name: Kube-router | Set host_subnet variable
set_fact:
host_subnet: "{{ cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | first }}"
when:
- cni_config is defined
- cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | length > 0
set_fact:
host_subnet: "{{ cni_config | json_query('plugins[?bridge==`kube-bridge`].ipam.subnet') | first }}"
- name: Kube-router | Create cni config
template:

View File

@@ -28,6 +28,7 @@
when: ansible_os_family in ["Debian"]
- name: Install macvlan config on RH distros
when: ansible_os_family == "RedHat"
block:
- name: Macvlan | Install macvlan script on centos
copy:
@@ -59,9 +60,8 @@
- {src: centos-postup-macvlan.cfg, dst: post-up-mac0 }
notify: Macvlan | restart network
when: ansible_os_family == "RedHat"
- name: Install macvlan config on Flatcar
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
block:
- name: Macvlan | Install service nat via gateway on Flatcar Container Linux
template:
@@ -88,8 +88,6 @@
- {src: coreos-network-macvlan.cfg, dst: macvlan.network }
notify: Macvlan | restart network
when: ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
- name: Macvlan | Install cni definition for Macvlan
template:
src: 10-macvlan.conf.j2