mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 05:45:06 +03:00
Do not use ‘yes/no’ for boolean values (#11472)
Consistent boolean values in ansible playbooks
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
service:
|
||||
name: calico-rr
|
||||
state: stopped
|
||||
enabled: no
|
||||
enabled: false
|
||||
failed_when: false
|
||||
|
||||
- name: Calico-rr | Delete obsolete files
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
that:
|
||||
- ipip is not defined
|
||||
msg: "'ipip' configuration variable is deprecated, please configure your inventory with 'calico_ipip_mode' set to 'Always' or 'CrossSubnet' according to your specific needs"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: Stop if legacy encapsulation variables are detected (ipip_mode)
|
||||
@@ -12,7 +12,7 @@
|
||||
that:
|
||||
- ipip_mode is not defined
|
||||
msg: "'ipip_mode' configuration variable is deprecated, please configure your inventory with 'calico_ipip_mode' set to 'Always' or 'CrossSubnet' according to your specific needs"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: Stop if legacy encapsulation variables are detected (calcio_ipam_autoallocateblocks)
|
||||
@@ -20,7 +20,7 @@
|
||||
that:
|
||||
- calcio_ipam_autoallocateblocks is not defined
|
||||
msg: "'calcio_ipam_autoallocateblocks' configuration variable is deprecated, it's a typo, please configure your inventory with 'calico_ipam_autoallocateblocks' set to 'true' or 'false' according to your specific needs"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
msg: "When using cloud_provider azure and network_plugin calico calico_ipip_mode must be 'Never' and calico_vxlan_mode 'Always' or 'CrossSubnet'"
|
||||
when:
|
||||
- cloud_provider is defined and cloud_provider == 'azure'
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: Stop if supported Calico versions
|
||||
@@ -40,21 +40,21 @@
|
||||
that:
|
||||
- "calico_version in calico_crds_archive_checksums.keys()"
|
||||
msg: "Calico version not supported {{ calico_version }} not in {{ calico_crds_archive_checksums.keys() }}"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: Check if calicoctl.sh exists
|
||||
stat:
|
||||
path: "{{ bin_dir }}/calicoctl.sh"
|
||||
register: calicoctl_sh_exists
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: Check if calico ready
|
||||
command: "{{ bin_dir }}/calicoctl.sh get ClusterInformation default"
|
||||
register: calico_ready
|
||||
run_once: True
|
||||
ignore_errors: True
|
||||
run_once: true
|
||||
ignore_errors: true
|
||||
retries: 5
|
||||
delay: 10
|
||||
until: calico_ready.rc == 0
|
||||
@@ -62,7 +62,7 @@
|
||||
when: calicoctl_sh_exists.stat.exists
|
||||
|
||||
- name: Check that current calico version is enough for upgrade
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
when: calicoctl_sh_exists.stat.exists and calico_ready.rc == 0
|
||||
block:
|
||||
@@ -91,7 +91,7 @@
|
||||
when:
|
||||
- peer_with_calico_rr
|
||||
- inventory_hostname == groups['kube_control_plane'][0]
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check that calico_rr nodes are in k8s_cluster group"
|
||||
@@ -101,7 +101,7 @@
|
||||
msg: "calico_rr must be a child group of k8s_cluster group"
|
||||
when:
|
||||
- '"calico_rr" in group_names'
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check vars defined correctly"
|
||||
@@ -110,7 +110,7 @@
|
||||
- "calico_pool_name is defined"
|
||||
- "calico_pool_name is match('^[a-zA-Z0-9-_\\\\.]{2,63}$')"
|
||||
msg: "calico_pool_name contains invalid characters"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check calico network backend defined correctly"
|
||||
@@ -118,11 +118,11 @@
|
||||
that:
|
||||
- "calico_network_backend in ['bird', 'vxlan', 'none']"
|
||||
msg: "calico network backend is not 'bird', 'vxlan' or 'none'"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check ipip and vxlan mode defined correctly"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
assert:
|
||||
that:
|
||||
@@ -137,7 +137,7 @@
|
||||
msg: "IP in IP and VXLAN mode is mutualy exclusive modes"
|
||||
when:
|
||||
- "calico_ipip_mode in ['Always', 'CrossSubnet']"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check ipip and vxlan mode if simultaneously enabled"
|
||||
@@ -147,23 +147,23 @@
|
||||
msg: "IP in IP and VXLAN mode is mutualy exclusive modes"
|
||||
when:
|
||||
- "calico_vxlan_mode in ['Always', 'CrossSubnet']"
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Get Calico {{ calico_pool_name }} configuration"
|
||||
command: "{{ bin_dir }}/calicoctl.sh get ipPool {{ calico_pool_name }} -o json"
|
||||
failed_when: False
|
||||
changed_when: False
|
||||
check_mode: no
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
check_mode: false
|
||||
register: calico
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Set calico_pool_conf"
|
||||
set_fact:
|
||||
calico_pool_conf: '{{ calico.stdout | from_json }}'
|
||||
when: calico.rc == 0 and calico.stdout
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check if inventory match current cluster configuration"
|
||||
@@ -176,7 +176,7 @@
|
||||
msg: "Your inventory doesn't match the current cluster configuration"
|
||||
when:
|
||||
- calico_pool_conf is defined
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check kdd calico_datastore if calico_apiserver_enabled"
|
||||
@@ -185,7 +185,7 @@
|
||||
msg: "When using calico apiserver you need to use the kubernetes datastore"
|
||||
when:
|
||||
- calico_apiserver_enabled
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check kdd calico_datastore if typha_enabled"
|
||||
@@ -194,7 +194,7 @@
|
||||
msg: "When using typha you need to use the kubernetes datastore"
|
||||
when:
|
||||
- typha_enabled
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
- name: "Check ipip mode is Never for calico ipv6"
|
||||
@@ -204,5 +204,5 @@
|
||||
msg: "Calico doesn't support ipip tunneling for the IPv6"
|
||||
when:
|
||||
- enable_dual_stack_networks
|
||||
run_once: True
|
||||
run_once: true
|
||||
delegate_to: "{{ groups['kube_control_plane'][0] }}"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
src: "{{ downloads.calicoctl.dest }}"
|
||||
dest: "{{ bin_dir }}/calicoctl"
|
||||
mode: "0755"
|
||||
remote_src: yes
|
||||
remote_src: true
|
||||
|
||||
- name: Calico | Create calico certs directory
|
||||
file:
|
||||
@@ -31,7 +31,7 @@
|
||||
dest: "{{ calico_cert_dir }}/{{ item.d }}"
|
||||
state: hard
|
||||
mode: "0640"
|
||||
force: yes
|
||||
force: true
|
||||
with_items:
|
||||
- {s: "{{ kube_etcd_cacert_file }}", d: "ca_cert.crt"}
|
||||
- {s: "{{ kube_etcd_cert_file }}", d: "cert.crt"}
|
||||
@@ -61,7 +61,7 @@
|
||||
- name: Calico | wait for etcd
|
||||
uri:
|
||||
url: "{{ etcd_access_addresses.split(',') | first }}/health"
|
||||
validate_certs: no
|
||||
validate_certs: false
|
||||
client_cert: "{{ calico_cert_dir }}/cert.crt"
|
||||
client_key: "{{ calico_cert_dir }}/key.pem"
|
||||
register: result
|
||||
@@ -165,8 +165,8 @@
|
||||
- name: Calico | Get existing FelixConfiguration
|
||||
command: "{{ bin_dir }}/calicoctl.sh get felixconfig default -o json"
|
||||
register: _felix_cmd
|
||||
ignore_errors: True
|
||||
changed_when: False
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Set kubespray FelixConfiguration
|
||||
set_fact:
|
||||
@@ -201,7 +201,7 @@
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _felix_config is string | ternary(_felix_config, _felix_config | to_json) }}"
|
||||
changed_when: False
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Configure Calico IP Pool
|
||||
when:
|
||||
@@ -210,8 +210,8 @@
|
||||
- name: Calico | Get existing calico network pool
|
||||
command: "{{ bin_dir }}/calicoctl.sh get ippool {{ calico_pool_name }} -o json"
|
||||
register: _calico_pool_cmd
|
||||
ignore_errors: True
|
||||
changed_when: False
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Set kubespray calico network pool
|
||||
set_fact:
|
||||
@@ -251,7 +251,7 @@
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _calico_pool is string | ternary(_calico_pool, _calico_pool | to_json) }}"
|
||||
changed_when: False
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Configure Calico IPv6 Pool
|
||||
when:
|
||||
@@ -261,8 +261,8 @@
|
||||
- name: Calico | Get existing calico ipv6 network pool
|
||||
command: "{{ bin_dir }}/calicoctl.sh get ippool {{ calico_pool_name }}-ipv6 -o json"
|
||||
register: _calico_pool_ipv6_cmd
|
||||
ignore_errors: True
|
||||
changed_when: False
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Set kubespray calico network pool
|
||||
set_fact:
|
||||
@@ -302,19 +302,19 @@
|
||||
command:
|
||||
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
|
||||
changed_when: false
|
||||
|
||||
- name: Populate Service External IPs
|
||||
set_fact:
|
||||
_service_external_ips: "{{ _service_external_ips | default([]) + [{'cidr': item}] }}"
|
||||
with_items: "{{ calico_advertise_service_external_ips }}"
|
||||
run_once: yes
|
||||
run_once: true
|
||||
|
||||
- name: Populate Service LoadBalancer IPs
|
||||
set_fact:
|
||||
_service_loadbalancer_ips: "{{ _service_loadbalancer_ips | default([]) + [{'cidr': item}] }}"
|
||||
with_items: "{{ calico_advertise_service_loadbalancer_ips }}"
|
||||
run_once: yes
|
||||
run_once: true
|
||||
|
||||
- name: "Determine nodeToNodeMesh needed state"
|
||||
set_fact:
|
||||
@@ -322,7 +322,7 @@
|
||||
when:
|
||||
- peer_with_router | default(false) or peer_with_calico_rr | default(false)
|
||||
- inventory_hostname in groups['k8s_cluster']
|
||||
run_once: yes
|
||||
run_once: true
|
||||
|
||||
- name: Calico | Configure Calico BGP
|
||||
when:
|
||||
@@ -331,8 +331,8 @@
|
||||
- name: Calico | Get existing BGP Configuration
|
||||
command: "{{ bin_dir }}/calicoctl.sh get bgpconfig default -o json"
|
||||
register: _bgp_config_cmd
|
||||
ignore_errors: True
|
||||
changed_when: False
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Set kubespray BGP Configuration
|
||||
set_fact:
|
||||
@@ -366,7 +366,7 @@
|
||||
command:
|
||||
cmd: "{{ bin_dir }}/calicoctl.sh apply -f -"
|
||||
stdin: "{{ _bgp_config is string | ternary(_bgp_config, _bgp_config | to_json) }}"
|
||||
changed_when: False
|
||||
changed_when: false
|
||||
|
||||
- name: Calico | Create calico manifests
|
||||
template:
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
file: _copr:copr.fedorainfracloud.org:jdoss:wireguard
|
||||
description: Copr repo for wireguard owned by jdoss
|
||||
baseurl: "{{ calico_wireguard_repo }}"
|
||||
gpgcheck: yes
|
||||
gpgcheck: true
|
||||
gpgkey: https://download.copr.fedorainfracloud.org/results/jdoss/wireguard/pubkey.gpg
|
||||
skip_if_unavailable: yes
|
||||
enabled: yes
|
||||
repo_gpgcheck: no
|
||||
skip_if_unavailable: true
|
||||
enabled: true
|
||||
repo_gpgcheck: false
|
||||
when:
|
||||
- ansible_os_family in ['RedHat']
|
||||
- ansible_distribution not in ['Fedora']
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
- name: Reset | check vxlan.calico network device
|
||||
stat:
|
||||
path: /sys/class/net/vxlan.calico
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: vxlan
|
||||
|
||||
- name: Reset | remove the network vxlan.calico device created by calico
|
||||
@@ -14,9 +14,9 @@
|
||||
- name: Reset | check dummy0 network device
|
||||
stat:
|
||||
path: /sys/class/net/dummy0
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: dummy0
|
||||
|
||||
- name: Reset | remove the network device created by calico
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
dest: "{{ cilium_cert_dir }}/{{ item.d }}"
|
||||
mode: "0644"
|
||||
state: hard
|
||||
force: yes
|
||||
force: true
|
||||
loop:
|
||||
- {s: "{{ kube_etcd_cacert_file }}", d: "ca_cert.crt"}
|
||||
- {s: "{{ kube_etcd_cert_file }}", d: "cert.crt"}
|
||||
@@ -94,4 +94,4 @@
|
||||
src: "{{ local_release_dir }}/cilium"
|
||||
dest: "{{ bin_dir }}/cilium"
|
||||
mode: "0755"
|
||||
remote_src: yes
|
||||
remote_src: true
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
- name: "Reset | check if network device {{ iface }} is present"
|
||||
stat:
|
||||
path: "/sys/class/net/{{ iface }}"
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: device_remains
|
||||
|
||||
- name: "Reset | remove network device {{ iface }}"
|
||||
|
||||
@@ -13,4 +13,4 @@
|
||||
dest: "/opt/cni/bin"
|
||||
mode: "0755"
|
||||
owner: "{{ cni_bin_owner }}"
|
||||
remote_src: yes
|
||||
remote_src: true
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
- name: Reset | check cni network device
|
||||
stat:
|
||||
path: /sys/class/net/cni0
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: cni
|
||||
|
||||
- name: Reset | remove the network device created by the flannel
|
||||
@@ -14,9 +14,9 @@
|
||||
- name: Reset | check flannel network device
|
||||
stat:
|
||||
path: /sys/class/net/flannel.1
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: flannel
|
||||
|
||||
- name: Reset | remove the network device created by the flannel
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
- name: Reset | check kube-dummy-if network device
|
||||
stat:
|
||||
path: /sys/class/net/kube-dummy-if
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: kube_dummy_if
|
||||
|
||||
- name: Reset | remove the network device created by kube-router
|
||||
@@ -14,9 +14,9 @@
|
||||
- name: Check kube-bridge exists
|
||||
stat:
|
||||
path: /sys/class/net/kube-bridge
|
||||
get_attributes: no
|
||||
get_checksum: no
|
||||
get_mime: no
|
||||
get_attributes: false
|
||||
get_checksum: false
|
||||
get_mime: false
|
||||
register: kube_bridge_if
|
||||
|
||||
- name: Reset | donw the network bridge create by kube-router
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
ansible.posix.sysctl:
|
||||
name: net.ipv4.conf.all.arp_notify
|
||||
value: 1
|
||||
sysctl_set: yes
|
||||
sysctl_set: true
|
||||
sysctl_file: "{{ sysctl_file_path }}"
|
||||
state: present
|
||||
reload: yes
|
||||
reload: true
|
||||
|
||||
Reference in New Issue
Block a user