Skip to content

Commit 87321e3

Browse files
committed
Ansible lint fixes, cleanup, and exclusions
1 parent f14833b commit 87321e3

11 files changed

+30
-65
lines changed

.ansible-lint

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# .ansible-lint
22
skip_list:
3-
- '208'
3+
- '208'
4+
- command-instead-of-module # Using command rather than module.
5+
- command-instead-of-shell # Use shell only when shell functionality is required.
6+
- no-changed-when # Commands should not change things if nothing needs doing.
7+
- risky-shell-pipe # Shells that use pipes should set the pipefail option.
8+
- literal-compare # Don't compare to literal True/False.

roles/netbootxyz/tasks/generate_checksums.yml

+4-12
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
---
22
- name: Register a listing of all created iPXE bootloaders
3-
command: ls -I {{ checksums_filename }} {{ netbootxyz_root }}/ipxe/
3+
ansible.builtin.command: ls -I {{ checksums_filename }} {{ netbootxyz_root }}/ipxe/
44
register: netboot_disks
5-
tags:
6-
- skip_ansible_lint
75

86
- name: Generate date
9-
command: date
7+
ansible.builtin.command: date
108
register: current_date
11-
tags:
12-
- skip_ansible_lint
139

1410
- name: Gather stat listing of directory
15-
command: sha256sum -b {{ item }}
11+
ansible.builtin.command: sha256sum -b {{ item }}
1612
with_items:
1713
- "{{ netboot_disks.stdout_lines }}"
1814
args:
1915
chdir: "{{ netbootxyz_root }}/ipxe/"
2016
register: netboot_disks_stat
21-
tags:
22-
- skip_ansible_lint
2317

2418
- name: Generate ipxe disk checksums
2519
ansible.builtin.template:
2620
src: checksums.txt.j2
2721
dest: "{{ netbootxyz_root }}/ipxe/{{ checksums_filename }}"
2822

2923
- name: Generate site name banner for index
30-
shell: toilet -f standard {{ site_name }} --html | grep span
24+
ansible.builtin.shell: toilet -f standard {{ site_name }} --html | grep span
3125
register: index_title
32-
tags:
33-
- skip_ansible_lint
3426
when: ansible_os_family == "Debian"
3527

3628
- name: Generate netboot.xyz index template

roles/netbootxyz/tasks/generate_disks_arm.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@
2727
# iPXE workaround
2828
# http://lists.ipxe.org/pipermail/ipxe-devel/2018-August/006254.html
2929
# apply patch to fix arm64 builds on amd64 builds
30-
- name: iPXE Workaround for arm
31-
shell: sed -i '/WORKAROUND_CFLAGS/d' arch/arm64/Makefile
30+
- name: Workaround in iPXE for arm
31+
ansible.builtin.shell: sed -i '/WORKAROUND_CFLAGS/d' arch/arm64/Makefile
3232
args:
3333
chdir: "{{ ipxe_source_dir }}/src"
34-
tags:
35-
- skip_ansible_lint
3634

3735
- name: Compile iPXE bootloaders for EFI arm64
38-
shell: |
36+
ansible.builtin.shell: |
3937
make clean
4038
make CROSS_COMPILE=aarch64-linux-gnu- \
4139
ARCH=arm64 \
@@ -46,12 +44,10 @@
4644
bin-arm64-efi/snponly.efi
4745
args:
4846
chdir: "{{ ipxe_source_dir }}/src"
49-
tags:
50-
- skip_ansible_lint
5147
when: ipxe_debug_enabled | bool == false
5248

5349
- name: Compile iPXE bootloader for EFI arm64 with debug flags
54-
shell: |
50+
ansible.builtin.shell: |
5551
make clean
5652
make CROSS_COMPILE=aarch64-linux-gnu- \
5753
ARCH=arm64 \
@@ -61,8 +57,6 @@
6157
bin-arm64-efi/snp.efi
6258
args:
6359
chdir: "{{ ipxe_source_dir }}/src"
64-
tags:
65-
- skip_ansible_lint
6660
when: ipxe_debug_enabled | bool
6761

6862
- name: Copy iPXE arm64 EFI builds to http directory

roles/netbootxyz/tasks/generate_disks_efi.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
when: generate_signatures | bool
2626

2727
- name: Compile iPXE bootloader for EFI
28-
shell: |
28+
ansible.builtin.shell: |
2929
make clean
3030
make EMBED={{ bootloader_filename }} \
3131
TRUST={{ trust_files }} \
@@ -34,12 +34,10 @@
3434
bin-x86_64-efi/snponly.efi
3535
args:
3636
chdir: "{{ ipxe_source_dir }}/src"
37-
tags:
38-
- skip_ansible_lint
3937
when: ipxe_debug_enabled | bool == false
4038

4139
- name: Compile iPXE bootloader for EFI with debug flags
42-
shell: |
40+
ansible.builtin.shell: |
4341
make clean
4442
make EMBED={{ bootloader_filename }} \
4543
DEBUG={{ ipxe_debug_options }} \
@@ -49,8 +47,6 @@
4947
bin-x86_64-efi/snponly.efi
5048
args:
5149
chdir: "{{ ipxe_source_dir }}/src"
52-
tags:
53-
- skip_ansible_lint
5450
when: ipxe_debug_enabled | bool
5551

5652
- name: Copy iPXE EFI builds to http directory
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
---
22

33
- name: Generate hybrid ISO image
4-
shell: |
4+
ansible.builtin.shell: |
55
./util/genfsimg -o {{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}.iso \
66
-s {{ bootloader_filename }} \
77
{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}.efi \
88
{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}.lkrn
99
args:
1010
chdir: "{{ ipxe_source_dir }}/src"
11-
tags:
12-
- skip_ansible_lint
1311

1412
- name: Generate hybrid USB image
15-
shell: |
13+
ansible.builtin.shell: |
1614
./util/genfsimg -o {{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}.img \
1715
-s {{ bootloader_filename }} \
1816
{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}.efi \
1917
{{ netbootxyz_root }}/ipxe/{{ bootloader_filename }}.lkrn
2018
args:
2119
chdir: "{{ ipxe_source_dir }}/src"
22-
tags:
23-
- skip_ansible_lint

roles/netbootxyz/tasks/generate_disks_legacy.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
when: generate_signatures | bool
2222

2323
- name: Compile iPXE bootloader for Legacy BIOS
24-
shell: |
24+
ansible.builtin.shell: |
2525
make clean
2626
make EMBED={{ bootloader_filename }} \
2727
TRUST={{ trust_files }} \
@@ -32,12 +32,10 @@
3232
bin/undionly.kpxe
3333
args:
3434
chdir: "{{ ipxe_source_dir }}/src"
35-
tags:
36-
- skip_ansible_lint
3735
when: ipxe_debug_enabled | bool == false
3836

3937
- name: Compile iPXE bootloader for Legacy BIOS with debug flags
40-
shell: |
38+
ansible.builtin.shell: |
4139
make clean
4240
make EMBED={{ bootloader_filename }} \
4341
DEBUG={{ ipxe_debug_options }} \
@@ -49,8 +47,6 @@
4947
bin/undionly.kpxe
5048
args:
5149
chdir: "{{ ipxe_source_dir }}/src"
52-
tags:
53-
- skip_ansible_lint
5450
when: ipxe_debug_enabled | bool
5551

5652
- name: Copy iPXE files for Legacy BIOS to http directory

roles/netbootxyz/tasks/generate_disks_linux.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,24 @@
2525
when: generate_signatures | bool
2626

2727
- name: Compile iPXE Linux bootloader for Legacy BIOS
28-
shell: |
28+
ansible.builtin.shell: |
2929
make clean
3030
make EMBED={{ bootloader_filename }} \
3131
TRUST={{ trust_files }} \
3232
bin-x86_64-linux/slirp.linux
3333
args:
3434
chdir: "{{ ipxe_source_dir }}/src"
35-
tags:
36-
- skip_ansible_lint
3735
when: ipxe_debug_enabled | bool == false
3836

3937
- name: Compile iPXE Linux bootloader for Legacy BIOS with debug flags
40-
shell: |
38+
ansible.builtin.shell: |
4139
make clean
4240
make EMBED={{ bootloader_filename }} \
4341
DEBUG={{ ipxe_debug_options }} \
4442
TRUST={{ trust_files }} \
4543
bin-x86_64-linux/slirp.linux
4644
args:
4745
chdir: "{{ ipxe_source_dir }}/src"
48-
tags:
49-
- skip_ansible_lint
5046
when: ipxe_debug_enabled | bool
5147

5248
- name: Copy iPXE linux binary for Legacy BIOS to http directory

roles/netbootxyz/tasks/generate_disks_rpi.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,10 @@
4949
dest: "{{ pipxe_source_dir }}/Makefile"
5050

5151
- name: Compile iPXE bootloader for RPI build
52-
shell: |
52+
ansible.builtin.shell: |
5353
make
5454
args:
5555
chdir: "{{ pipxe_source_dir }}"
56-
tags:
57-
- skip_ansible_lint
5856

5957
- name: Copy iPXE RPI builds to http directory
6058
ansible.builtin.copy:

roles/netbootxyz/tasks/generate_menus.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,11 @@
6060
- generate_version_file | bool
6161

6262
- name: Generate netboot.xyz source files templates
63-
template:
63+
ansible.builtin.template:
6464
src: "{{ item.src }}"
65-
dest: "{{ netbootxyz_root }}/{{ item.path | regex_replace('.j2','') }}"
66-
with_community.general.filetree: "templates/menu/"
65+
dest: "{{ netbootxyz_root }}/{{ item.path | regex_replace('.j2', '') }}"
66+
with_community.general.filetree: "{{ 'templates/menu/' }}"
6767
when: item.state == "file"
68-
tags:
69-
- skip_ansible_lint
7068

7169
- name: Generate local-vars.ipxe if enabled
7270
ansible.builtin.template:

roles/netbootxyz/tasks/generate_menus_custom.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
- "{{ netbootxyz_root }}/custom"
1010

1111
- name: Generate custom user menu templates
12-
template:
12+
ansible.builtin.template:
1313
src: "{{ item.src }}"
14-
dest: "{{ netbootxyz_root }}/custom/{{ item.path | regex_replace('.j2','') }}"
14+
dest: "{{ netbootxyz_root }}/custom/{{ item.path | regex_replace('.j2', '') }}"
1515
with_community.general.filetree: "{{ custom_templates_dir }}"
1616
when: item.state == "file"
17-
tags:
18-
- skip_ansible_lint
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
22
- name: Gather list of source files
3-
command: ls {{ netbootxyz_root }}
3+
ansible.builtin.command: ls {{ netbootxyz_root }}
44
register: source_files
5-
tags:
6-
- skip_ansible_lint
75

86
- name: Create directories for signatures
97
ansible.builtin.file:
@@ -13,7 +11,7 @@
1311
- "{{ sigs_dir }}"
1412

1513
- name: Generate signatures for source files
16-
shell: |
14+
ansible.builtin.shell: |
1715
openssl cms -sign -binary -noattr -in {{ netbootxyz_root }}/{{ item }} \
1816
-signer {{ codesign_cert_filename }} -inkey {{ codesign_key_filename }} -certfile {{ cert_file_filename }} -outform DER \
1917
-out {{ sigs_dir }}/{{ item }}.sig
@@ -22,5 +20,3 @@
2220
warn: false
2321
with_items:
2422
- "{{ source_files.stdout_lines }}"
25-
tags:
26-
- skip_ansible_lint

0 commit comments

Comments
 (0)