fix(ansible): Résolution violations linting YAML

Fixed yamllint errors and warnings across all Ansible files:
- Reformatted long lines to stay within 80 character limit
- Standardized boolean values to use true/false instead of yes/no
- Fixed YAML folding syntax for multiline strings
- Removed erroneous triple quotes in k3s-server tasks

This resolves all yamllint issues reported by the CI pipeline.
This commit is contained in:
Tellsanguis 2025-11-07 10:40:53 +01:00
parent 44e45a0f3d
commit a5283e316b
8 changed files with 69 additions and 42 deletions

View file

@ -1,5 +1,4 @@
---
# Install and configure FluxCD
--- # Install and configure FluxCD
- name: Check if flux is already installed
command: k3s kubectl get namespace {{ flux_namespace }}
@ -9,7 +8,10 @@
- name: Download Flux CLI
get_url:
url: "https://github.com/fluxcd/flux2/releases/download/{{ flux_version }}/flux_{{ flux_version | replace('v', '') }}_linux_amd64.tar.gz"
url: >-
https://github.com/fluxcd/flux2/releases/download/
{{- flux_version }}/
{{- 'flux_' }}{{ flux_version | replace('v', '') }}_linux_amd64.tar.gz
dest: /tmp/flux.tar.gz
mode: '0644'
when: flux_installed.rc != 0
@ -18,7 +20,7 @@
unarchive:
src: /tmp/flux.tar.gz
dest: /usr/local/bin
remote_src: yes
remote_src: true
creates: /usr/local/bin/flux
when: flux_installed.rc != 0
@ -43,5 +45,8 @@
- name: Display FluxCD installation status
debug:
msg: "FluxCD installed successfully. Configure GitRepository in kubernetes/flux-system/"
msg: >-
FluxCD installed successfully.
Configure GitRepository in kubernetes/flux-system/
when: flux_installed.rc != 0

View file

@ -18,17 +18,21 @@
is_first_server: "{{ ansible_default_ipv4.address == k3s_server_1_ip }}"
- name: Install K3s on first server (cluster-init)
shell: |
curl -sfL {{ k3s_install_url }} | INSTALL_K3S_VERSION="{{ k3s_version }}" sh -s - server \
--cluster-init \
--tls-san {{ k3s_server_1_ip }} \
--tls-san {{ k3s_server_2_ip }} \
--write-kubeconfig-mode 644 \
--disable traefik \
shell: >
curl -sfL {{ k3s_install_url }} |
INSTALL_K3S_VERSION="{{ k3s_version }}"
sh -s - server
--cluster-init
--tls-san {{ k3s_server_1_ip }}
--tls-san {{ k3s_server_2_ip }}
--write-kubeconfig-mode 644
--disable traefik
--node-ip {{ ansible_default_ipv4.address }}
when:
- is_first_server
- not k3s_binary.stat.exists or (k3s_version not in installed_version.stdout)
- >-
not k3s_binary.stat.exists or
(k3s_version not in installed_version.stdout)
environment:
INSTALL_K3S_SKIP_START: "false"
@ -53,23 +57,27 @@
when: is_first_server
- name: Install K3s on second server (join cluster)
shell: |
curl -sfL {{ k3s_install_url }} | INSTALL_K3S_VERSION="{{ k3s_version }}" sh -s - server \
--server https://{{ k3s_server_1_ip }}:6443 \
--token {{ k3s_token | default('PLACEHOLDER') }} \
--tls-san {{ k3s_server_2_ip }} \
--write-kubeconfig-mode 644 \
--disable traefik \
shell: >
curl -sfL {{ k3s_install_url }} |
INSTALL_K3S_VERSION="{{ k3s_version }}"
sh -s - server
--server https://{{ k3s_server_1_ip }}:6443
--token {{ k3s_token | default('PLACEHOLDER') }}
--tls-san {{ k3s_server_2_ip }}
--write-kubeconfig-mode 644
--disable traefik
--node-ip {{ ansible_default_ipv4.address }}
when:
- not is_first_server
- not k3s_binary.stat.exists or (k3s_version not in installed_version.stdout)
- >-
not k3s_binary.stat.exists or
(k3s_version not in installed_version.stdout)
- name: Enable and start k3s service
systemd:
name: k3s
state: started
enabled: yes
enabled: true
- name: Wait for K3s to be ready
command: k3s kubectl get nodes
@ -109,8 +117,8 @@
- name: Enable pre-reboot service
systemd:
name: k3s-pre-reboot
enabled: yes
daemon_reload: yes
enabled: true
daemon_reload: true
- name: Install FluxCD (only on first server)
include_tasks: flux.yml