Implement compatible yamllint, make octals explicit (#332)

* Implement compatible yamllint, make octals explicit

Signed-off-by: Derek Nola <derek.nola@suse.com>

* Replace yum with dnf, yum is deprecated

Signed-off-by: Derek Nola <derek.nola@suse.com>

---------

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2024-06-04 09:56:07 -07:00
committed by GitHub
parent 8120b7c0d1
commit af29159231
6 changed files with 33 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
--- ---
warn_list: warn_list:
- var-naming[no-role-prefix] - var-naming[no-role-prefix]
- yaml[comments-indentation] - yaml[comments-indentation]
- yaml[line-length] - yaml[line-length]

View File

@@ -6,4 +6,12 @@ rules:
max: 180 max: 180
level: warning level: warning
truthy: truthy:
allowed-values: ['true', 'false'] allowed-values: ["true", "false"]
braces:
max-spaces-inside: 1
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
comments:
min-spaces-from-content: 1
comments-indentation: false

View File

@@ -15,7 +15,7 @@
url: https://get.k3s.io/ url: https://get.k3s.io/
timeout: 120 timeout: 120
dest: "{{ airgap_dir }}/k3s-install.sh" dest: "{{ airgap_dir }}/k3s-install.sh"
mode: 0755 mode: "0755"
- name: Distribute K3s install script - name: Distribute K3s install script
ansible.builtin.copy: ansible.builtin.copy:
@@ -23,7 +23,7 @@
dest: /usr/local/bin/k3s-install.sh dest: /usr/local/bin/k3s-install.sh
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
- name: Distribute K3s binary - name: Distribute K3s binary
ansible.builtin.copy: ansible.builtin.copy:
@@ -31,7 +31,7 @@
dest: /usr/local/bin/k3s dest: /usr/local/bin/k3s
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
- name: Distribute K3s SELinux RPM - name: Distribute K3s SELinux RPM
ansible.builtin.copy: ansible.builtin.copy:
@@ -39,7 +39,7 @@
dest: /tmp/ dest: /tmp/
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
with_fileglob: with_fileglob:
- "{{ airgap_dir }}/k3s-selinux*.rpm" - "{{ airgap_dir }}/k3s-selinux*.rpm"
register: selinux_copy register: selinux_copy
@@ -49,7 +49,7 @@
when: when:
- ansible_os_family == 'RedHat' - ansible_os_family == 'RedHat'
- selinux_copy.skipped is false - selinux_copy.skipped is false
ansible.builtin.yum: ansible.builtin.dnf:
name: "{{ selinux_copy.results[0].dest }}" name: "{{ selinux_copy.results[0].dest }}"
state: present state: present
disable_gpg_check: true disable_gpg_check: true
@@ -57,7 +57,7 @@
- name: Make images directory - name: Make images directory
ansible.builtin.file: ansible.builtin.file:
path: "/var/lib/rancher/k3s/agent/images/" path: "/var/lib/rancher/k3s/agent/images/"
mode: 0755 mode: "0755"
state: directory state: directory
- name: Determine Architecture - name: Determine Architecture
@@ -71,7 +71,7 @@
dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }} dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }}
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
with_first_found: with_first_found:
- files: - files:
- "{{ airgap_dir }}/k3s-airgap-images-amd64.tar.zst" - "{{ airgap_dir }}/k3s-airgap-images-amd64.tar.zst"
@@ -86,7 +86,7 @@
dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }} dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }}
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
with_first_found: with_first_found:
- files: - files:
- "{{ airgap_dir }}/k3s-airgap-images-arm64.tar.zst" - "{{ airgap_dir }}/k3s-airgap-images-arm64.tar.zst"
@@ -101,7 +101,7 @@
dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }} dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }}
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
with_first_found: with_first_found:
- files: - files:
- "{{ airgap_dir }}/k3s-airgap-images-arm.tar.zst" - "{{ airgap_dir }}/k3s-airgap-images-arm.tar.zst"

View File

@@ -24,7 +24,7 @@
dest: /usr/local/bin/k3s-install.sh dest: /usr/local/bin/k3s-install.sh
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
- name: Download K3s binary - name: Download K3s binary
ansible.builtin.command: ansible.builtin.command:

View File

@@ -24,7 +24,7 @@
dest: /usr/local/bin/k3s-install.sh dest: /usr/local/bin/k3s-install.sh
owner: root owner: root
group: root group: root
mode: 0755 mode: "0755"
- name: Download K3s binary - name: Download K3s binary
ansible.builtin.command: ansible.builtin.command:
@@ -46,13 +46,13 @@
- name: Make config directory - name: Make config directory
ansible.builtin.file: ansible.builtin.file:
path: "/etc/rancher/k3s" path: "/etc/rancher/k3s"
mode: 0755 mode: "0755"
state: directory state: directory
- name: Copy config values - name: Copy config values
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ server_config_yaml }}" content: "{{ server_config_yaml }}"
dest: "/etc/rancher/k3s/config.yaml" dest: "/etc/rancher/k3s/config.yaml"
mode: 0644 mode: "0644"
- name: Init first server node - name: Init first server node
when: inventory_hostname == groups['server'][0] when: inventory_hostname == groups['server'][0]
@@ -64,7 +64,7 @@
dest: "{{ systemd_dir }}/k3s.service" dest: "{{ systemd_dir }}/k3s.service"
owner: root owner: root
group: root group: root
mode: 0644 mode: "0644"
- name: Copy K3s service file [HA] - name: Copy K3s service file [HA]
when: groups['server'] | length > 1 when: groups['server'] | length > 1
@@ -73,7 +73,7 @@
dest: "{{ systemd_dir }}/k3s.service" dest: "{{ systemd_dir }}/k3s.service"
owner: root owner: root
group: root group: root
mode: 0644 mode: "0644"
- name: Add service environment variables - name: Add service environment variables
when: extra_service_envs is defined when: extra_service_envs is defined
@@ -154,7 +154,7 @@
dest: "{{ systemd_dir }}/k3s.service" dest: "{{ systemd_dir }}/k3s.service"
owner: root owner: root
group: root group: root
mode: 0644 mode: "0644"
- name: Enable and check K3s service - name: Enable and check K3s service
ansible.builtin.systemd: ansible.builtin.systemd:

View File

@@ -215,7 +215,7 @@
- name: Make rancher directory - name: Make rancher directory
ansible.builtin.file: ansible.builtin.file:
path: "/var/lib/rancher" path: "/var/lib/rancher"
mode: 0755 mode: "0755"
state: directory state: directory
- name: Create symlink - name: Create symlink
ansible.builtin.file: ansible.builtin.file:
@@ -230,13 +230,13 @@
- name: Make manifests directory - name: Make manifests directory
ansible.builtin.file: ansible.builtin.file:
path: "/var/lib/rancher/k3s/server/manifests" path: "/var/lib/rancher/k3s/server/manifests"
mode: 0700 mode: "0700"
state: directory state: directory
- name: Copy manifests - name: Copy manifests
ansible.builtin.copy: ansible.builtin.copy:
src: "{{ item }}" src: "{{ item }}"
dest: "/var/lib/rancher/k3s/server/manifests" dest: "/var/lib/rancher/k3s/server/manifests"
mode: 0600 mode: "0600"
loop: "{{ extra_manifests }}" loop: "{{ extra_manifests }}"
- name: Setup optional private registry configuration - name: Setup optional private registry configuration
@@ -245,10 +245,10 @@
- name: Make k3s config directory - name: Make k3s config directory
ansible.builtin.file: ansible.builtin.file:
path: "/etc/rancher/k3s" path: "/etc/rancher/k3s"
mode: 0755 mode: "0755"
state: directory state: directory
- name: Copy config values - name: Copy config values
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ registries_config_yaml }}" content: "{{ registries_config_yaml }}"
dest: "/etc/rancher/k3s/registries.yaml" dest: "/etc/rancher/k3s/registries.yaml"
mode: 0644 mode: "0644"