Skip to content

Commit 89d8fb1

Browse files
linting
Signed-off-by: Frederick Witty <frederickw@mindpointgroup.com>
1 parent d8e78e0 commit 89d8fb1

5 files changed

Lines changed: 116 additions & 116 deletions

File tree

tasks/LE_audit_setup.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
22
- name: Pre Audit Setup | Set audit package name
33
block:
4-
- name: Pre Audit Setup | Set audit package name | 64bit
5-
when: ansible_facts.machine == "x86_64"
6-
ansible.builtin.set_fact:
7-
audit_pkg_arch_name: AMD64
4+
- name: Pre Audit Setup | Set audit package name | 64bit
5+
when: ansible_facts.machine == "x86_64"
6+
ansible.builtin.set_fact:
7+
audit_pkg_arch_name: AMD64
88

9-
- name: Pre Audit Setup | Set audit package name | ARM64
10-
when: (ansible_facts.machine == "arm64" or ansible_facts.machine == "aarch64")
11-
ansible.builtin.set_fact:
12-
audit_pkg_arch_name: ARM64
9+
- name: Pre Audit Setup | Set audit package name | ARM64
10+
when: (ansible_facts.machine == "arm64" or ansible_facts.machine == "aarch64")
11+
ansible.builtin.set_fact:
12+
audit_pkg_arch_name: ARM64
1313

1414
- name: Pre Audit Setup | Download audit binary
1515
when: get_audit_binary_method == 'download'
1616
ansible.builtin.get_url:
17-
url: "{{ audit_bin_url }}{{ audit_pkg_arch_name }}"
18-
dest: "{{ audit_bin }}"
19-
owner: root
20-
group: root
21-
checksum: "{{ audit_bin_version[audit_pkg_arch_name + '_checksum'] }}"
22-
mode: 'u+x,go-w'
17+
url: "{{ audit_bin_url }}{{ audit_pkg_arch_name }}"
18+
dest: "{{ audit_bin }}"
19+
owner: root
20+
group: root
21+
checksum: "{{ audit_bin_version[audit_pkg_arch_name + '_checksum'] }}"
22+
mode: 'u+x,go-w'
2323

2424
- name: Pre Audit Setup | Copy audit binary
2525
when: get_audit_binary_method == 'copy'
2626
ansible.builtin.copy:
27-
src: "{{ audit_bin_copy_location }}/goss-linux-{{ audit_pkg_arch_name }}"
28-
dest: "{{ audit_bin }}"
29-
owner: root
30-
group: root
31-
mode: 'u+x,go-w'
27+
src: "{{ audit_bin_copy_location }}/goss-linux-{{ audit_pkg_arch_name }}"
28+
dest: "{{ audit_bin }}"
29+
owner: root
30+
group: root
31+
mode: 'u+x,go-w'

tasks/audit_only.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
- name: Audit_only | Fetch audit files
44
when:
5-
- fetch_audit_output
6-
- audit_only
5+
- fetch_audit_output
6+
- audit_only
77
ansible.builtin.import_tasks:
8-
file: fetch_audit_output.yml
8+
file: fetch_audit_output.yml
99

1010
- name: Audit_only | Show Audit Summary
1111
when: audit_only
1212
ansible.builtin.debug:
13-
msg: "{{ audit_results.split('\n') }}"
13+
msg: "{{ audit_results.split('\n') }}"
1414

1515
- name: Audit_only | Stop task for host as audit_only selected
1616
when: audit_only

tasks/fetch_audit_output.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,43 @@
55
- name: "POST | FETCH | Fetch files and copy to controller"
66
when: audit_output_collection_method == "fetch"
77
ansible.builtin.fetch:
8-
src: "{{ item }}"
9-
dest: "{{ audit_output_destination }}"
10-
flat: true
8+
src: "{{ item }}"
9+
dest: "{{ audit_output_destination }}"
10+
flat: true
1111
changed_when: true
1212
failed_when: false
1313
register: discovered_audit_fetch_state
1414
loop:
15-
- "{{ pre_audit_outfile }}"
16-
- "{{ post_audit_outfile }}"
15+
- "{{ pre_audit_outfile }}"
16+
- "{{ post_audit_outfile }}"
1717
become: false
1818

1919
# Added this option for continuity but could be changed by adjusting the variable audit_conf_dest
2020
# Allowing backup to one location
2121
- name: "POST | FETCH | Copy files to location available to managed node"
2222
when: audit_output_collection_method == "copy"
2323
ansible.builtin.copy:
24-
src: "{{ item }}"
25-
dest: "{{ audit_output_destination }}"
26-
mode: 'u-x,go-wx'
27-
flat: true
24+
src: "{{ item }}"
25+
dest: "{{ audit_output_destination }}"
26+
mode: 'u-x,go-wx'
27+
flat: true
2828
failed_when: false
2929
register: discovered_audit_copy_state
3030
loop:
31-
- "{{ pre_audit_outfile }}"
32-
- "{{ post_audit_outfile }}"
31+
- "{{ pre_audit_outfile }}"
32+
- "{{ post_audit_outfile }}"
3333

3434
- name: "POST | FETCH | Fetch files and copy to controller | Warning if issues with fetch_audit_files"
3535
when:
36-
- (audit_output_collection_method == "fetch" and not discovered_audit_fetch_state.changed) or
37-
(audit_output_collection_method == "copy" and not discovered_audit_copy_state.changed)
36+
- (audit_output_collection_method == "fetch" and not discovered_audit_fetch_state.changed) or
37+
(audit_output_collection_method == "copy" and not discovered_audit_copy_state.changed)
3838
block:
39-
- name: "POST | FETCH | Fetch files and copy to controller | Warning if issues with fetch_audit_files"
40-
ansible.builtin.debug:
41-
msg: "Warning!! Unable to write to localhost {{ audit_output_destination }} for audit file copy"
39+
- name: "POST | FETCH | Fetch files and copy to controller | Warning if issues with fetch_audit_files"
40+
ansible.builtin.debug:
41+
msg: "Warning!! Unable to write to localhost {{ audit_output_destination }} for audit file copy"
4242

43-
- name: "POST | FETCH | Fetch files and copy to controller | Warning if issues with fetch_audit_files"
44-
vars:
45-
warn_control_id: "FETCH_AUDIT_FILES"
46-
ansible.builtin.import_tasks:
47-
file: warning_facts.yml
43+
- name: "POST | FETCH | Fetch files and copy to controller | Warning if issues with fetch_audit_files"
44+
vars:
45+
warn_control_id: "FETCH_AUDIT_FILES"
46+
ansible.builtin.import_tasks:
47+
file: warning_facts.yml

tasks/post_remediation_audit.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -m {{ audit_max_concurrent }} -o {{ post_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
55
changed_when: true
66
environment:
7-
AUDIT_BIN: "{{ audit_bin }}"
8-
AUDIT_CONTENT_LOCATION: "{{ audit_conf_dest | default('/opt') }}"
9-
AUDIT_FILE: goss.yml
7+
AUDIT_BIN: "{{ audit_bin }}"
8+
AUDIT_CONTENT_LOCATION: "{{ audit_conf_dest | default('/opt') }}"
9+
AUDIT_FILE: goss.yml
1010

1111
- name: Post Audit | Capture audit data if json format
1212
when: audit_format == "json"
1313
block:
14-
- name: Post Audit | Capture audit data if json format
15-
ansible.builtin.shell: grep -E '"summary-line.*Count:.*Failed' "{{ post_audit_outfile }}" | cut -d'"' -f4
16-
changed_when: false
17-
register: post_audit_summary
14+
- name: Post Audit | Capture audit data if json format
15+
ansible.builtin.shell: grep -E '"summary-line.*Count:.*Failed' "{{ post_audit_outfile }}" | cut -d'"' -f4
16+
changed_when: false
17+
register: post_audit_summary
1818

19-
- name: Post Audit | Set Fact for audit summary
20-
ansible.builtin.set_fact:
21-
post_audit_results: "{{ post_audit_summary.stdout }}"
19+
- name: Post Audit | Set Fact for audit summary
20+
ansible.builtin.set_fact:
21+
post_audit_results: "{{ post_audit_summary.stdout }}"
2222

2323
- name: Post Audit | Capture audit data if documentation format
2424
when: audit_format == "documentation"
2525
block:
26-
- name: Post Audit | Capture audit data if documentation format
27-
ansible.builtin.shell: tail -2 "{{ post_audit_outfile }}" | tac | tr '\n' ' '
28-
changed_when: false
29-
register: post_audit_summary
26+
- name: Post Audit | Capture audit data if documentation format
27+
ansible.builtin.shell: tail -2 "{{ post_audit_outfile }}" | tac | tr '\n' ' '
28+
changed_when: false
29+
register: post_audit_summary
3030

31-
- name: Post Audit | Set Fact for audit summary
32-
ansible.builtin.set_fact:
33-
post_audit_results: "{{ post_audit_summary.stdout }}"
31+
- name: Post Audit | Set Fact for audit summary
32+
ansible.builtin.set_fact:
33+
post_audit_results: "{{ post_audit_summary.stdout }}"

tasks/pre_remediation_audit.yml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,106 +4,106 @@
44
when: setup_audit
55
tags: setup_audit
66
ansible.builtin.include_tasks:
7-
file: LE_audit_setup.yml
7+
file: LE_audit_setup.yml
88

99
- name: Pre Audit Setup | Ensure existence of {{ audit_conf_dir }} # noqa name[template]
1010
ansible.builtin.file:
11-
path: "{{ audit_conf_dir }}"
12-
mode: 'go-w'
13-
state: directory
11+
path: "{{ audit_conf_dir }}"
12+
mode: 'go-w'
13+
state: directory
1414

1515
- name: Pre Audit Setup | If using git for content set up
1616
when: audit_content == 'git'
1717
block:
18-
- name: Pre Audit Setup | Install git
19-
ansible.builtin.package:
20-
name: git
21-
state: present
18+
- name: Pre Audit Setup | Install git
19+
ansible.builtin.package:
20+
name: git
21+
state: present
2222

23-
- name: Pre Audit Setup | Retrieve audit content files from git
24-
ansible.builtin.git:
25-
repo: "{{ audit_file_git }}"
26-
dest: "{{ audit_conf_dir }}"
27-
version: "{{ audit_git_version }}"
23+
- name: Pre Audit Setup | Retrieve audit content files from git
24+
ansible.builtin.git:
25+
repo: "{{ audit_file_git }}"
26+
dest: "{{ audit_conf_dir }}"
27+
version: "{{ audit_git_version }}"
2828

2929
- name: Pre Audit Setup | Copy to audit content files to server
3030
when: audit_content == 'copy'
3131
ansible.builtin.copy:
32-
src: "{{ audit_conf_source }}"
33-
dest: "{{ audit_conf_dest }}"
34-
mode: preserve
32+
src: "{{ audit_conf_source }}"
33+
dest: "{{ audit_conf_dest }}"
34+
mode: preserve
3535

3636
- name: Pre Audit Setup | Unarchive audit content files on server
3737
when: audit_content == 'archive'
3838
ansible.builtin.unarchive:
39-
src: "{{ audit_conf_source }}"
40-
dest: "{{ audit_conf_dest }}"
39+
src: "{{ audit_conf_source }}"
40+
dest: "{{ audit_conf_dest }}"
4141

4242
- name: Pre Audit Setup | Get audit content from url
4343
when: audit_content == 'get_url'
4444
ansible.builtin.unarchive:
45-
src: "{{ audit_conf_source }}"
46-
dest: "{{ audit_conf_dest }}/{{ benchmark }}-Audit"
47-
remote_src: "{{ (audit_conf_source is contains('http')) | ternary(true, false) }}"
48-
extra_opts: "{{ (audit_conf_source is contains('github')) | ternary('--strip-components=1', []) }}"
45+
src: "{{ audit_conf_source }}"
46+
dest: "{{ audit_conf_dest }}/{{ benchmark }}-Audit"
47+
remote_src: "{{ (audit_conf_source is contains('http')) | ternary(true, false) }}"
48+
extra_opts: "{{ (audit_conf_source is contains('github')) | ternary('--strip-components=1', []) }}"
4949

5050
- name: Pre Audit Setup | Check Goss is available
5151
when: run_audit
5252
block:
53-
- name: Pre Audit Setup | Check for goss file
54-
ansible.builtin.stat:
55-
path: "{{ audit_bin }}"
56-
register: prelim_goss_available
53+
- name: Pre Audit Setup | Check for goss file
54+
ansible.builtin.stat:
55+
path: "{{ audit_bin }}"
56+
register: prelim_goss_available
5757

58-
- name: Pre Audit Setup | If audit ensure goss is available
59-
when: not prelim_goss_available.stat.exists
60-
ansible.builtin.assert:
61-
that: prelim_goss_available['stat']['exists'] == true
62-
msg: "Audit has been selected: unable to find goss binary at {{ audit_bin }}"
58+
- name: Pre Audit Setup | If audit ensure goss is available
59+
when: not prelim_goss_available.stat.exists
60+
ansible.builtin.assert:
61+
that: prelim_goss_available['stat']['exists'] == true
62+
msg: "Audit has been selected: unable to find goss binary at {{ audit_bin }}"
6363

6464
- name: Pre Audit Setup | Copy ansible default vars values to test audit
6565
when: run_audit
6666
tags:
67-
- goss_template
68-
- run_audit
67+
- goss_template
68+
- run_audit
6969
ansible.builtin.template:
70-
src: ansible_vars_goss.yml.j2
71-
dest: "{{ audit_vars_path }}"
72-
mode: 'go-rwx'
70+
src: ansible_vars_goss.yml.j2
71+
dest: "{{ audit_vars_path }}"
72+
mode: 'go-rwx'
7373

7474
- name: Pre Audit | Run pre_remediation audit {{ benchmark }} # noqa name[template]
75-
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -m {{ audit_max_concurrent }} -o {{ pre_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
75+
ansible.builtin.shell: "umask 0022 && {{ audit_conf_dir }}/run_audit.sh -v {{ audit_vars_path }} -f {{ audit_format }} -m {{ audit_max_concurrent }} -o {{ pre_audit_outfile }} -g \"{{ group_names }}\"" # noqa yaml[line-length]
7676
changed_when: true
7777
environment:
78-
AUDIT_BIN: "{{ audit_bin }}"
79-
AUDIT_CONTENT_LOCATION: "{{ audit_conf_dest | default('/opt') }}"
80-
AUDIT_FILE: goss.yml
78+
AUDIT_BIN: "{{ audit_bin }}"
79+
AUDIT_CONTENT_LOCATION: "{{ audit_conf_dest | default('/opt') }}"
80+
AUDIT_FILE: goss.yml
8181

8282
- name: Pre Audit | Capture audit data if json format
8383
when: audit_format == "json"
8484
block:
85-
- name: Pre Audit | Capture audit data if json format
86-
ansible.builtin.shell: grep -E '\"summary-line.*Count:.*Failed' "{{ pre_audit_outfile }}" | cut -d'"' -f4
87-
changed_when: false
88-
register: pre_audit_summary
85+
- name: Pre Audit | Capture audit data if json format
86+
ansible.builtin.shell: grep -E '\"summary-line.*Count:.*Failed' "{{ pre_audit_outfile }}" | cut -d'"' -f4
87+
changed_when: false
88+
register: pre_audit_summary
8989

90-
- name: Pre Audit | Set Fact for audit summary
91-
ansible.builtin.set_fact:
92-
pre_audit_results: "{{ pre_audit_summary.stdout }}"
90+
- name: Pre Audit | Set Fact for audit summary
91+
ansible.builtin.set_fact:
92+
pre_audit_results: "{{ pre_audit_summary.stdout }}"
9393

9494
- name: Pre Audit | Capture audit data if documentation format
9595
when: audit_format == "documentation"
9696
block:
97-
- name: Pre Audit | Capture audit data if documentation format
98-
ansible.builtin.shell: tail -2 "{{ pre_audit_outfile }}" | tac | tr '\n' ' '
99-
changed_when: false
100-
register: pre_audit_summary
97+
- name: Pre Audit | Capture audit data if documentation format
98+
ansible.builtin.shell: tail -2 "{{ pre_audit_outfile }}" | tac | tr '\n' ' '
99+
changed_when: false
100+
register: pre_audit_summary
101101

102-
- name: Pre Audit | Set Fact for audit summary
103-
ansible.builtin.set_fact:
104-
pre_audit_results: "{{ pre_audit_summary.stdout }}"
102+
- name: Pre Audit | Set Fact for audit summary
103+
ansible.builtin.set_fact:
104+
pre_audit_results: "{{ pre_audit_summary.stdout }}"
105105

106106
- name: Audit_Only | Run Audit Only
107107
when: audit_only
108108
ansible.builtin.import_tasks:
109-
file: audit_only.yml
109+
file: audit_only.yml

0 commit comments

Comments
 (0)