mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-28 09:39:12 +03:00
project: fix var-spacing ansible rule (#10266)
* project: fix var-spacing ansible rule Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix spacing on the beginning/end of jinja template Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix spacing of default filter Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix spacing between filter arguments Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix double space at beginning/end of jinja Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> * project: fix remaining jinja[spacing] ansible-lint warning Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch> --------- Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>
This commit is contained in:
committed by
GitHub
parent
f8b93fa88a
commit
5d00b851ce
@@ -168,7 +168,7 @@
|
||||
- name: "Check if inventory match current cluster configuration"
|
||||
assert:
|
||||
that:
|
||||
- calico_pool_conf.spec.blockSize|int == (calico_pool_blocksize | default(kube_network_node_prefix) | int)
|
||||
- calico_pool_conf.spec.blockSize | int == (calico_pool_blocksize | default(kube_network_node_prefix) | int)
|
||||
- calico_pool_conf.spec.cidr == (calico_pool_cidr | default(kube_pods_subnet))
|
||||
- not calico_pool_conf.spec.ipipMode is defined or calico_pool_conf.spec.ipipMode == calico_ipip_mode
|
||||
- not calico_pool_conf.spec.vxlanMode is defined or calico_pool_conf.spec.vxlanMode == calico_vxlan_mode
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
- block:
|
||||
- name: Calico | Check if extra directory is needed
|
||||
stat:
|
||||
path: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds/{{ 'kdd' if (calico_version is version('v3.22.3','<')) else 'crd' }}"
|
||||
path: "{{ local_release_dir }}/calico-{{ calico_version }}-kdd-crds/{{ 'kdd' if (calico_version is version('v3.22.3', '<')) else 'crd' }}"
|
||||
register: kdd_path
|
||||
- name: Calico | Set kdd path when calico < v3.22.3
|
||||
set_fact:
|
||||
@@ -196,7 +196,7 @@
|
||||
- name: Calico | Configure calico FelixConfiguration
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _felix_config is string | ternary(_felix_config, _felix_config|to_json) }}"
|
||||
stdin: "{{ _felix_config is string | ternary(_felix_config, _felix_config | to_json) }}"
|
||||
changed_when: False
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
@@ -222,7 +222,7 @@
|
||||
"cidr": "{{ calico_pool_cidr | default(kube_pods_subnet) }}",
|
||||
"ipipMode": "{{ calico_ipip_mode }}",
|
||||
"vxlanMode": "{{ calico_vxlan_mode }}",
|
||||
"natOutgoing": {{ nat_outgoing|default(false) }}
|
||||
"natOutgoing": {{ nat_outgoing | default(false) }}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
- name: Calico | Configure calico network pool
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _calico_pool is string | ternary(_calico_pool, _calico_pool|to_json) }}"
|
||||
stdin: "{{ _calico_pool is string | ternary(_calico_pool, _calico_pool | to_json) }}"
|
||||
changed_when: False
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
@@ -261,7 +261,7 @@
|
||||
"cidr": "{{ calico_pool_cidr_ipv6 | default(kube_pods_subnet_ipv6) }}",
|
||||
"ipipMode": "{{ calico_ipip_mode_ipv6 }}",
|
||||
"vxlanMode": "{{ calico_vxlan_mode_ipv6 }}",
|
||||
"natOutgoing": {{ nat_outgoing_ipv6|default(false) }}
|
||||
"natOutgoing": {{ nat_outgoing_ipv6 | default(false) }}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
- name: Calico | Configure calico ipv6 network pool
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _calico_pool_ipv6 is string | ternary(_calico_pool_ipv6, _calico_pool_ipv6|to_json) }}"
|
||||
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]
|
||||
@@ -282,13 +282,13 @@
|
||||
|
||||
- name: Populate Service External IPs
|
||||
set_fact:
|
||||
_service_external_ips: "{{ _service_external_ips|default([]) + [ {'cidr': item} ] }}"
|
||||
_service_external_ips: "{{ _service_external_ips | default([]) + [{'cidr': item}] }}"
|
||||
with_items: "{{ calico_advertise_service_external_ips }}"
|
||||
run_once: yes
|
||||
|
||||
- name: Populate Service LoadBalancer IPs
|
||||
set_fact:
|
||||
_service_loadbalancer_ips: "{{ _service_loadbalancer_ips|default([]) + [ {'cidr': item} ] }}"
|
||||
_service_loadbalancer_ips: "{{ _service_loadbalancer_ips | default([]) + [{'cidr': item}] }}"
|
||||
with_items: "{{ calico_advertise_service_loadbalancer_ips }}"
|
||||
run_once: yes
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
set_fact:
|
||||
nodeToNodeMeshEnabled: "false"
|
||||
when:
|
||||
- peer_with_router|default(false) or peer_with_calico_rr|default(false)
|
||||
- peer_with_router | default(false) or peer_with_calico_rr | default(false)
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
run_once: yes
|
||||
|
||||
@@ -309,6 +309,7 @@
|
||||
|
||||
- name: Calico | Set kubespray BGP Configuration
|
||||
set_fact:
|
||||
# noqa: jinja[spacing]
|
||||
_bgp_config: >
|
||||
{
|
||||
"kind": "BGPConfiguration",
|
||||
@@ -319,12 +320,12 @@
|
||||
"spec": {
|
||||
"listenPort": {{ calico_bgp_listen_port }},
|
||||
"logSeverityScreen": "Info",
|
||||
{% if not calico_no_global_as_num|default(false) %}"asNumber": {{ global_as_num }},{% endif %}
|
||||
"nodeToNodeMeshEnabled": {{ nodeToNodeMeshEnabled|default('true') }} ,
|
||||
{% if calico_advertise_cluster_ips|default(false) %}
|
||||
{% if not calico_no_global_as_num | default(false) %}"asNumber": {{ global_as_num }},{% endif %}
|
||||
"nodeToNodeMeshEnabled": {{ nodeToNodeMeshEnabled | default('true') }} ,
|
||||
{% if calico_advertise_cluster_ips | default(false) %}
|
||||
"serviceClusterIPs": [{"cidr": "{{ kube_service_addresses }}" } {{ ',{"cidr":"' + kube_service_addresses_ipv6 + '"}' if enable_dual_stack_networks else '' }}],{% endif %}
|
||||
{% if calico_advertise_service_loadbalancer_ips|length > 0 %}"serviceLoadBalancerIPs": {{ _service_loadbalancer_ips }},{% endif %}
|
||||
"serviceExternalIPs": {{ _service_external_ips|default([]) }}
|
||||
{% if calico_advertise_service_loadbalancer_ips | length > 0 %}"serviceLoadBalancerIPs": {{ _service_loadbalancer_ips }},{% endif %}
|
||||
"serviceExternalIPs": {{ _service_external_ips | default([]) }}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +338,7 @@
|
||||
- name: Calico | Set up BGP Configuration
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _bgp_config is string | ternary(_bgp_config, _bgp_config|to_json) }}"
|
||||
stdin: "{{ _bgp_config is string | ternary(_bgp_config, _bgp_config | to_json) }}"
|
||||
changed_when: False
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
@@ -464,8 +465,8 @@
|
||||
|
||||
- include_tasks: peer_with_calico_rr.yml
|
||||
when:
|
||||
- peer_with_calico_rr|default(false)
|
||||
- peer_with_calico_rr | default(false)
|
||||
|
||||
- include_tasks: peer_with_router.yml
|
||||
when:
|
||||
- peer_with_router|default(false)
|
||||
- peer_with_router | default(false)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
# revert when it's already a string
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin | to_json) }}"
|
||||
vars:
|
||||
stdin: >
|
||||
{"apiVersion": "projectcalico.org/v3",
|
||||
@@ -38,7 +38,7 @@
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
# revert when it's already a string
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin | to_json) }}"
|
||||
vars:
|
||||
stdin: >
|
||||
{"apiVersion": "projectcalico.org/v3",
|
||||
@@ -64,7 +64,7 @@
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
# revert when it's already a string
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin | to_json) }}"
|
||||
vars:
|
||||
stdin: >
|
||||
{"apiVersion": "projectcalico.org/v3",
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
- name: Calico | Configure peering with router(s) at global scope
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin | to_json) }}"
|
||||
vars:
|
||||
stdin: >
|
||||
{"apiVersion": "projectcalico.org/v3",
|
||||
"kind": "BGPPeer",
|
||||
"metadata": {
|
||||
"name": "global-{{ item.name | default(item.router_id|replace(':','-')) }}"
|
||||
"name": "global-{{ item.name | default(item.router_id | replace(':', '-')) }}"
|
||||
},
|
||||
"spec": {
|
||||
"asNumber": "{{ item.as }}",
|
||||
@@ -19,14 +19,14 @@
|
||||
until: output.rc == 0
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
with_items:
|
||||
- "{{ peers|selectattr('scope','defined')|selectattr('scope','equalto', 'global')|list|default([]) }}"
|
||||
- "{{ peers | selectattr('scope', 'defined') | selectattr('scope', 'equalto', 'global') | list | default([]) }}"
|
||||
when:
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
|
||||
- name: Calico | Configure node asNumber for per node peering
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin | to_json) }}"
|
||||
vars:
|
||||
stdin: >
|
||||
{"apiVersion": "projectcalico.org/v3",
|
||||
@@ -52,26 +52,26 @@
|
||||
- name: Calico | Configure peering with router(s) at node scope
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin|to_json) }}"
|
||||
stdin: "{{ stdin is string | ternary(stdin, stdin | to_json) }}"
|
||||
vars:
|
||||
stdin: >
|
||||
{"apiVersion": "projectcalico.org/v3",
|
||||
"kind": "BGPPeer",
|
||||
"metadata": {
|
||||
"name": "{{ inventory_hostname }}-{{ item.name | default(item.router_id|replace(':','-')) }}"
|
||||
"name": "{{ inventory_hostname }}-{{ item.name | default(item.router_id | replace(':', '-')) }}"
|
||||
},
|
||||
"spec": {
|
||||
"asNumber": "{{ item.as }}",
|
||||
"node": "{{ inventory_hostname }}",
|
||||
"peerIP": "{{ item.router_id }}",
|
||||
"sourceAddress": "{{ item.sourceaddress|default('UseNodeIP') }}"
|
||||
"sourceAddress": "{{ item.sourceaddress | default('UseNodeIP') }}"
|
||||
}}
|
||||
register: output
|
||||
retries: 4
|
||||
until: output.rc == 0
|
||||
delay: "{{ retry_stagger | random + 3 }}"
|
||||
with_items:
|
||||
- "{{ peers|selectattr('scope','undefined')|list|default([]) | union(peers|selectattr('scope','defined')|selectattr('scope','equalto', 'node')|list|default([])) }}"
|
||||
- "{{ peers | selectattr('scope', 'undefined') | list | default([]) | union(peers | selectattr('scope', 'defined') | selectattr('scope', 'equalto', 'node') | list | default([])) }}"
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when:
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
|
||||
@@ -32,12 +32,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_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"
|
||||
- defaults.yml
|
||||
paths:
|
||||
- ../vars
|
||||
|
||||
Reference in New Issue
Block a user