Skip to content

Commit

Permalink
Implement compatible yamllint, make octals explicit (#332)
Browse files Browse the repository at this point in the history
* Implement compatible yamllint, make octals explicit

Signed-off-by: Derek Nola <[email protected]>

* Replace yum with dnf, yum is deprecated

Signed-off-by: Derek Nola <[email protected]>

---------

Signed-off-by: Derek Nola <[email protected]>
  • Loading branch information
dereknola authored Jun 4, 2024
1 parent 8120b7c commit af29159
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
warn_list:
- var-naming[no-role-prefix]
- yaml[comments-indentation]
- yaml[line-length]
- var-naming[no-role-prefix]
- yaml[comments-indentation]
- yaml[line-length]
10 changes: 9 additions & 1 deletion .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ rules:
max: 180
level: warning
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
18 changes: 9 additions & 9 deletions roles/airgap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@
url: https://get.k3s.io/
timeout: 120
dest: "{{ airgap_dir }}/k3s-install.sh"
mode: 0755
mode: "0755"

- name: Distribute K3s install script
ansible.builtin.copy:
src: "{{ airgap_dir }}/k3s-install.sh"
dest: /usr/local/bin/k3s-install.sh
owner: root
group: root
mode: 0755
mode: "0755"

- name: Distribute K3s binary
ansible.builtin.copy:
src: "{{ airgap_dir }}/k3s"
dest: /usr/local/bin/k3s
owner: root
group: root
mode: 0755
mode: "0755"

- name: Distribute K3s SELinux RPM
ansible.builtin.copy:
src: "{{ item }}"
dest: /tmp/
owner: root
group: root
mode: 0755
mode: "0755"
with_fileglob:
- "{{ airgap_dir }}/k3s-selinux*.rpm"
register: selinux_copy
Expand All @@ -49,15 +49,15 @@
when:
- ansible_os_family == 'RedHat'
- selinux_copy.skipped is false
ansible.builtin.yum:
ansible.builtin.dnf:
name: "{{ selinux_copy.results[0].dest }}"
state: present
disable_gpg_check: true

- name: Make images directory
ansible.builtin.file:
path: "/var/lib/rancher/k3s/agent/images/"
mode: 0755
mode: "0755"
state: directory

- name: Determine Architecture
Expand All @@ -71,7 +71,7 @@
dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }}
owner: root
group: root
mode: 0755
mode: "0755"
with_first_found:
- files:
- "{{ airgap_dir }}/k3s-airgap-images-amd64.tar.zst"
Expand All @@ -86,7 +86,7 @@
dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }}
owner: root
group: root
mode: 0755
mode: "0755"
with_first_found:
- files:
- "{{ airgap_dir }}/k3s-airgap-images-arm64.tar.zst"
Expand All @@ -101,7 +101,7 @@
dest: /var/lib/rancher/k3s/agent/images/{{ item | basename }}
owner: root
group: root
mode: 0755
mode: "0755"
with_first_found:
- files:
- "{{ airgap_dir }}/k3s-airgap-images-arm.tar.zst"
Expand Down
2 changes: 1 addition & 1 deletion roles/k3s_agent/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
dest: /usr/local/bin/k3s-install.sh
owner: root
group: root
mode: 0755
mode: "0755"

- name: Download K3s binary
ansible.builtin.command:
Expand Down
12 changes: 6 additions & 6 deletions roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
dest: /usr/local/bin/k3s-install.sh
owner: root
group: root
mode: 0755
mode: "0755"

- name: Download K3s binary
ansible.builtin.command:
Expand All @@ -46,13 +46,13 @@
- name: Make config directory
ansible.builtin.file:
path: "/etc/rancher/k3s"
mode: 0755
mode: "0755"
state: directory
- name: Copy config values
ansible.builtin.copy:
content: "{{ server_config_yaml }}"
dest: "/etc/rancher/k3s/config.yaml"
mode: 0644
mode: "0644"

- name: Init first server node
when: inventory_hostname == groups['server'][0]
Expand All @@ -64,7 +64,7 @@
dest: "{{ systemd_dir }}/k3s.service"
owner: root
group: root
mode: 0644
mode: "0644"

- name: Copy K3s service file [HA]
when: groups['server'] | length > 1
Expand All @@ -73,7 +73,7 @@
dest: "{{ systemd_dir }}/k3s.service"
owner: root
group: root
mode: 0644
mode: "0644"

- name: Add service environment variables
when: extra_service_envs is defined
Expand Down Expand Up @@ -154,7 +154,7 @@
dest: "{{ systemd_dir }}/k3s.service"
owner: root
group: root
mode: 0644
mode: "0644"

- name: Enable and check K3s service
ansible.builtin.systemd:
Expand Down
10 changes: 5 additions & 5 deletions roles/prereq/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
- name: Make rancher directory
ansible.builtin.file:
path: "/var/lib/rancher"
mode: 0755
mode: "0755"
state: directory
- name: Create symlink
ansible.builtin.file:
Expand All @@ -230,13 +230,13 @@
- name: Make manifests directory
ansible.builtin.file:
path: "/var/lib/rancher/k3s/server/manifests"
mode: 0700
mode: "0700"
state: directory
- name: Copy manifests
ansible.builtin.copy:
src: "{{ item }}"
dest: "/var/lib/rancher/k3s/server/manifests"
mode: 0600
mode: "0600"
loop: "{{ extra_manifests }}"

- name: Setup optional private registry configuration
Expand All @@ -245,10 +245,10 @@
- name: Make k3s config directory
ansible.builtin.file:
path: "/etc/rancher/k3s"
mode: 0755
mode: "0755"
state: directory
- name: Copy config values
ansible.builtin.copy:
content: "{{ registries_config_yaml }}"
dest: "/etc/rancher/k3s/registries.yaml"
mode: 0644
mode: "0644"

0 comments on commit af29159

Please sign in to comment.