Resolve ansible-lint name errors (#10253)

* project: fix ansible-lint name

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

* project: ignore jinja template error in names

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

* project: capitalize ansible name

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@proton.ch>

* project: update notify after name capitalization

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:
Arthur Outhenin-Chalandre
2023-07-26 16:36:22 +02:00
committed by GitHub
parent b9e3861385
commit 36e5d742dc
162 changed files with 842 additions and 675 deletions

View File

@@ -1,13 +1,13 @@
---
- name: reset_calico_cni
- name: Reset_calico_cni
command: /bin/true
when: calico_cni_config is defined
notify:
- delete 10-calico.conflist
- Delete 10-calico.conflist
- Calico | delete calico-node docker containers
- Calico | delete calico-node crio/containerd containers
- name: delete 10-calico.conflist
- name: Delete 10-calico.conflist
file:
path: /etc/cni/net.d/10-calico.conflist
state: absent

View File

@@ -1,7 +1,8 @@
---
# Workaround to retry a block of tasks, ansible doesn't have a direct way to do it,
# you can follow the block loop request in: https://github.com/ansible/ansible/issues/46203
- block:
- name: Calico-rr | Configure route reflector
block:
- name: Set the retry count
set_fact:
retry_count: "{{ 0 if retry_count is undefined else retry_count | int + 1 }}"

View File

@@ -119,7 +119,8 @@
- calico_pool_cidr_ipv6 is defined
- enable_dual_stack_networks
- block:
- name: Calico | kdd specific configuration
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' }}"
@@ -157,7 +158,8 @@
- inventory_hostname in groups['kube_control_plane']
- calico_datastore == "kdd"
- block:
- name: Calico | Configure Felix
block:
- name: Calico | Get existing FelixConfiguration
command: "{{ bin_dir }}/calicoctl.sh get felixconfig default -o json"
register: _felix_cmd
@@ -201,7 +203,8 @@
when:
- inventory_hostname == groups['kube_control_plane'][0]
- block:
- name: Calico | Configure Calico IP Pool
block:
- name: Calico | Get existing calico network pool
command: "{{ bin_dir }}/calicoctl.sh get ippool {{ calico_pool_name }} -o json"
register: _calico_pool_cmd
@@ -240,7 +243,8 @@
when:
- inventory_hostname == groups['kube_control_plane'][0]
- block:
- name: Calico | Configure Calico IPv6 Pool
block:
- 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
@@ -300,7 +304,8 @@
- inventory_hostname in groups['k8s_cluster']
run_once: yes
- block:
- name: Calico | Configure Calico BGP
block:
- name: Calico | Get existing BGP Configuration
command: "{{ bin_dir }}/calicoctl.sh get bgpconfig default -o json"
register: _bgp_config_cmd
@@ -463,10 +468,12 @@
- inventory_hostname == groups['kube_control_plane'][0]
- calico_datastore == "kdd"
- include_tasks: peer_with_calico_rr.yml
- name: Calico | Peer with Calico Route Reflector
include_tasks: peer_with_calico_rr.yml
when:
- peer_with_calico_rr | default(false)
- include_tasks: peer_with_router.yml
- name: Calico | Peer with the router
include_tasks: peer_with_router.yml
when:
- peer_with_router | default(false)

View File

@@ -1,6 +1,9 @@
---
- import_tasks: pre.yml
- name: Calico Pre tasks
import_tasks: pre.yml
- import_tasks: repos.yml
- name: Calico repos
import_tasks: repos.yml
- include_tasks: install.yml
- name: Calico install
include_tasks: install.yml

View File

@@ -5,7 +5,8 @@
register: calico_cni_config_slurp
failed_when: false
- block:
- name: Gather calico facts
block:
- name: Set fact calico_cni_config from slurped CNI config
set_fact:
calico_cni_config: "{{ calico_cni_config_slurp['content'] | b64decode | from_json }}"

View File

@@ -1,5 +1,5 @@
---
- name: reset | check vxlan.calico network device
- name: Reset | check vxlan.calico network device
stat:
path: /sys/class/net/vxlan.calico
get_attributes: no
@@ -7,11 +7,11 @@
get_mime: no
register: vxlan
- name: reset | remove the network vxlan.calico device created by calico
- name: Reset | remove the network vxlan.calico device created by calico
command: ip link del vxlan.calico
when: vxlan.stat.exists
- name: reset | check dummy0 network device
- name: Reset | check dummy0 network device
stat:
path: /sys/class/net/dummy0
get_attributes: no
@@ -19,11 +19,11 @@
get_mime: no
register: dummy0
- name: reset | remove the network device created by calico
- name: Reset | remove the network device created by calico
command: ip link del dummy0
when: dummy0.stat.exists
- name: reset | get and remove remaining routes set by bird
- name: Reset | get and remove remaining routes set by bird
shell: set -o pipefail && ip route show proto bird | xargs -i bash -c "ip route del {} proto bird "
args:
executable: /bin/bash

View File

@@ -1,6 +1,9 @@
---
- import_tasks: check.yml
- name: Cilium check
import_tasks: check.yml
- include_tasks: install.yml
- name: Cilium install
include_tasks: install.yml
- include_tasks: apply.yml
- name: Cilium apply
include_tasks: apply.yml

View File

@@ -1,5 +1,5 @@
---
- name: reset | check and remove devices if still present
- name: Reset | check and remove devices if still present
include_tasks: reset_iface.yml
vars:
iface: "{{ item }}"

View File

@@ -1,5 +1,5 @@
---
- name: "reset | check if network device {{ iface }} is present"
- name: "Reset | check if network device {{ iface }} is present"
stat:
path: "/sys/class/net/{{ iface }}"
get_attributes: no
@@ -7,6 +7,6 @@
get_mime: no
register: device_remains
- name: "reset | remove network device {{ iface }}"
- name: "Reset | remove network device {{ iface }}"
command: "ip link del {{ iface }}"
when: device_remains.stat.exists

View File

@@ -1,5 +1,5 @@
---
- name: reset | check cni network device
- name: Reset | check cni network device
stat:
path: /sys/class/net/cni0
get_attributes: no
@@ -7,11 +7,11 @@
get_mime: no
register: cni
- name: reset | remove the network device created by the flannel
- name: Reset | remove the network device created by the flannel
command: ip link del cni0
when: cni.stat.exists
- name: reset | check flannel network device
- name: Reset | check flannel network device
stat:
path: /sys/class/net/flannel.1
get_attributes: no
@@ -19,6 +19,6 @@
get_mime: no
register: flannel
- name: reset | remove the network device created by the flannel
- name: Reset | remove the network device created by the flannel
command: ip link del flannel.1
when: flannel.stat.exists

View File

@@ -1,5 +1,5 @@
---
- name: reset_kube_router
- name: Reset_kube_router
command: /bin/true
notify:
- Kube-router | delete kube-router docker containers

View File

@@ -1,19 +1,19 @@
---
- name: kube-router | Add annotations on kube_control_plane
- name: Kube-router | Add annotations on kube_control_plane
command: "{{ kubectl }} annotate --overwrite node {{ ansible_hostname }} {{ item }}"
with_items:
- "{{ kube_router_annotations_master }}"
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when: kube_router_annotations_master is defined and inventory_hostname in groups['kube_control_plane']
- name: kube-router | Add annotations on kube_node
- name: Kube-router | Add annotations on kube_node
command: "{{ kubectl }} annotate --overwrite node {{ ansible_hostname }} {{ item }}"
with_items:
- "{{ kube_router_annotations_node }}"
delegate_to: "{{ groups['kube_control_plane'][0] }}"
when: kube_router_annotations_node is defined and inventory_hostname in groups['kube_node']
- name: kube-router | Add common annotations on all servers
- name: Kube-router | Add common annotations on all servers
command: "{{ kubectl }} annotate --overwrite node {{ ansible_hostname }} {{ item }}"
with_items:
- "{{ kube_router_annotations_all }}"

View File

@@ -1,9 +1,9 @@
---
- name: kube-router | Create annotations
- name: Kube-router | Create annotations
import_tasks: annotate.yml
tags: annotate
- name: kube-router | Create config directory
- name: Kube-router | Create config directory
file:
path: /var/lib/kube-router
state: directory
@@ -11,49 +11,49 @@
recurse: true
mode: 0755
- name: kube-router | Create kubeconfig
- name: Kube-router | Create kubeconfig
template:
src: kubeconfig.yml.j2
dest: /var/lib/kube-router/kubeconfig
mode: 0644
owner: "{{ kube_owner }}"
notify:
- reset_kube_router
- Reset_kube_router
- name: kube-router | Slurp cni config
- name: Kube-router | Slurp cni config
slurp:
src: /etc/cni/net.d/10-kuberouter.conflist
register: cni_config_slurp
ignore_errors: true # noqa ignore-errors
- name: kube-router | Set cni_config variable
- name: Kube-router | Set cni_config variable
set_fact:
cni_config: "{{ cni_config_slurp.content | b64decode | from_json }}"
when:
- not cni_config_slurp.failed
- name: kube-router | Set host_subnet variable
- 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
- name: kube-router | Create cni config
- name: Kube-router | Create cni config
template:
src: cni-conf.json.j2
dest: /etc/cni/net.d/10-kuberouter.conflist
mode: 0644
owner: "{{ kube_owner }}"
notify:
- reset_kube_router
- Reset_kube_router
- name: kube-router | Delete old configuration
- name: Kube-router | Delete old configuration
file:
path: /etc/cni/net.d/10-kuberouter.conf
state: absent
- name: kube-router | Create manifest
- name: Kube-router | Create manifest
template:
src: kube-router.yml.j2
dest: "{{ kube_config_dir }}/kube-router.yml"

View File

@@ -1,5 +1,5 @@
---
- name: reset | check kube-dummy-if network device
- name: Reset | check kube-dummy-if network device
stat:
path: /sys/class/net/kube-dummy-if
get_attributes: no
@@ -7,11 +7,11 @@
get_mime: no
register: kube_dummy_if
- name: reset | remove the network device created by kube-router
- name: Reset | remove the network device created by kube-router
command: ip link del kube-dummy-if
when: kube_dummy_if.stat.exists
- name: check kube-bridge exists
- name: Check kube-bridge exists
stat:
path: /sys/class/net/kube-bridge
get_attributes: no
@@ -19,10 +19,10 @@
get_mime: no
register: kube_bridge_if
- name: reset | donw the network bridge create by kube-router
- name: Reset | donw the network bridge create by kube-router
command: ip link set kube-bridge down
when: kube_bridge_if.stat.exists
- name: reset | remove the network bridge create by kube-router
- name: Reset | remove the network bridge create by kube-router
command: ip link del kube-bridge
when: kube_bridge_if.stat.exists

View File

@@ -27,7 +27,8 @@
notify: Macvlan | restart network
when: ansible_os_family in ["Debian"]
- block:
- name: Install macvlan config on RH distros
block:
- name: Macvlan | Install macvlan script on centos
copy:
src: "{{ item }}"
@@ -60,7 +61,8 @@
when: ansible_os_family == "RedHat"
- block:
- name: Install macvlan config on Flatcar
block:
- name: Macvlan | Install service nat via gateway on Flatcar Container Linux
template:
src: coreos-service-nat_ouside.j2

View File

@@ -1,11 +1,11 @@
---
- name: ovn4nfv | Label control-plane node
- name: Ovn4nfv | Label control-plane node
command: >-
{{ kubectl }} label --overwrite node {{ groups['kube_control_plane'] | first }} ovn4nfv-k8s-plugin=ovn-control-plane
when:
- inventory_hostname == groups['kube_control_plane'][0]
- name: ovn4nfv | Create ovn4nfv-k8s manifests
- name: Ovn4nfv | Create ovn4nfv-k8s manifests
template:
src: "{{ item.file }}.j2"
dest: "{{ kube_config_dir }}/{{ item.file }}"