Skip to content

Commit cb87bbc

Browse files
committedMay 14, 2022
style(metal): fix Ansible lint
1 parent 9ae548d commit cb87bbc

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed
 

‎.tekton/pipeline.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ spec:
5757
- ansible-lint
5858
args:
5959
- -v
60+
- --force-color
6061
- name: yaml
6162
command:
6263
- yamllint

‎metal/group_vars/all.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
ansible_user: root
22
ansible_ssh_private_key_file: ~/.ssh/id_ed25519
3-
ssh_public_key: "{{lookup('file', '~/.ssh/id_ed25519.pub') }}"
3+
ssh_public_key: "{{ lookup('file', '~/.ssh/id_ed25519.pub') }}"
44
dns_server: "8.8.8.8"
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
- name: Install packages for automatic upgrade
2-
dnf:
2+
ansible.builtin.dnf:
33
name:
44
- dnf-automatic
55
- dnf-utils
66

77
- name: Copy automatic upgrade config file
8-
copy:
8+
ansible.builtin.copy:
99
src: automatic.conf
1010
dest: /etc/dnf/automatic.conf
1111
mode: 0644
1212

1313
- name: Enable automatic upgrade service
14-
systemd:
14+
ansible.builtin.systemd:
1515
name: dnf-automatic.timer
1616
state: started
1717
enabled: true

‎metal/roles/k3s/tasks/main.yml

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
- name: Download k3s binary
2-
get_url:
2+
ansible.builtin.get_url:
33
url: https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/k3s
44
checksum: sha256:https://github.com/k3s-io/k3s/releases/download/{{ k3s_version }}/sha256sum-amd64.txt
55
dest: "{{ role_path }}/files/bin/k3s"
6+
mode: 0755
67
delegate_to: localhost
78
run_once: true
89
register: k3s_binary
910

1011
- name: Copy k3s binary to nodes
11-
copy:
12+
ansible.builtin.copy:
1213
src: bin/k3s
1314
dest: /usr/local/bin/k3s
1415
owner: root
1516
group: root
1617
mode: 0755
1718

1819
- name: Ensure config directories exist
19-
file:
20+
ansible.builtin.file:
2021
path: "{{ item }}"
2122
state: directory
2223
mode: 0755
@@ -26,32 +27,32 @@
2627

2728
- name: Check if k3s token file exists on the first node
2829
run_once: true
29-
stat:
30+
ansible.builtin.stat:
3031
path: "{{ k3s_token_file }}"
3132
register: k3s_token_file_stat
3233

3334
- name: Generate k3s token file on the first node if not exist yet
3435
run_once: true
3536
when: not k3s_token_file_stat.stat.exists
36-
copy:
37+
ansible.builtin.copy:
3738
content: "{{ lookup('community.general.random_string', length=32) }}"
3839
dest: "{{ k3s_token_file }}"
3940
mode: 0600
4041

4142
- name: Get k3s token from the first node
4243
run_once: true
43-
slurp:
44+
ansible.builtin.slurp:
4445
src: "{{ k3s_token_file }}"
4546
register: k3s_token_base64
4647

4748
- name: Ensure all nodes has the same token
48-
copy:
49+
ansible.builtin.copy:
4950
content: "{{ k3s_token_base64.content | b64decode }}"
5051
dest: "{{ k3s_token_file }}"
5152
mode: 0600
5253

5354
- name: Copy k3s config files
54-
template:
55+
ansible.builtin.template:
5556
src: "{{ item.src }}"
5657
dest: "{{ item.dest }}"
5758
mode: 0644
@@ -62,7 +63,7 @@
6263
dest: "{{ k3s_service_file }}"
6364

6465
- name: Enable k3s service
65-
systemd:
66+
ansible.builtin.systemd:
6667
name: k3s
6768
enabled: true
6869
state: started
@@ -72,12 +73,12 @@
7273

7374
- name: Get Kubernetes config file
7475
run_once: true
75-
slurp:
76+
ansible.builtin.slurp:
7677
src: /etc/rancher/k3s/k3s.yaml
7778
register: kubeconfig_base64
7879

7980
- name: Write Kubernetes config file with the correct cluster address
80-
copy:
81+
ansible.builtin.copy:
8182
content: "{{ kubeconfig_base64.content | b64decode | replace('127.0.0.1', hostvars[groups['masters'][0]].ansible_host) }}"
8283
dest: "{{ playbook_dir }}/kubeconfig.yaml"
8384
mode: 0600

‎metal/roles/pxe_server/tasks/main.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
- name: Download boot image
2-
get_url:
2+
ansible.builtin.get_url:
33
url: "{{ iso_url }}"
44
dest: "{{ role_path }}/files/data/iso/{{ iso_url | basename }}"
55
checksum: "{{ iso_checksum }}"
6+
mode: 0644
67
register: iso
78

89
- name: Extract boot image
9-
command:
10+
ansible.builtin.command:
1011
cmd: "xorriso -osirrox on -indev {{ iso.dest }} -extract / {{ role_path }}/files/data/os"
1112
creates: "{{ role_path }}/files/data/os/.treeinfo"
1213

1314
- name: Generate DHCP config
14-
template:
15+
ansible.builtin.template:
1516
src: dhcpd.conf.j2
1617
dest: "{{ role_path }}/files/data/pxe-config/dhcpd.conf"
1718
mode: 0644
1819

1920
- name: Generate GRUB config
20-
template:
21+
ansible.builtin.template:
2122
src: grub.cfg.j2
2223
dest: "{{ role_path }}/files/data/pxe-config/grub.cfg"
2324
mode: 0644
2425

2526
- name: Generate init config for each machine
26-
template:
27+
ansible.builtin.template:
2728
src: kickstart.ks.j2
2829
dest: "{{ role_path }}/files/data/init-config/{{ hostvars[item]['mac'] }}.ks"
2930
mode: 0644
3031
loop: "{{ groups['metal'] }}"
3132

3233
- name: Start the ephemeral PXE server
33-
docker_compose:
34+
community.docker.docker_compose:
3435
project_src: "{{ role_path }}/files"
3536
state: present
3637
restarted: true

‎metal/roles/wake/tasks/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
delegate_to: localhost
55

66
- name: Wait for the machines to come online
7-
wait_for_connection:
7+
ansible.builtin.wait_for_connection:
88
timeout: 600

0 commit comments

Comments
 (0)