Skip to content

Commit 00c83d9

Browse files
authored
Merge pull request #2 from OpsKern/add-codeowners
Add CODEOWNERS for review enforcement
2 parents 6eceec5 + be89fcb commit 00c83d9

4 files changed

Lines changed: 25 additions & 6 deletions

File tree

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# All changes require owner review (public repo)
2+
* @thewismit
3+
4+
# CI/CD
5+
/.github/workflows/ @thewismit

playbooks/fleet-patch.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
ansible.builtin.set_fact:
7676
audit_data: "{{ audit_script.stdout | from_json }}"
7777

78-
- name: Create audit output directory
78+
- name: Create audit output directory # noqa: run-once[task]
7979
ansible.builtin.file:
8080
path: "{{ patch_audit_dir }}"
8181
state: directory
@@ -131,6 +131,7 @@
131131
- host_info | length > 0
132132
- host_info.type == 'qm'
133133
register: qm_snap
134+
changed_when: qm_snap.rc == 0
134135

135136
- name: Take LXC snapshot (pct)
136137
ansible.builtin.command:
@@ -141,6 +142,7 @@
141142
- host_info | length > 0
142143
- host_info.type == 'pct'
143144
register: pct_snap
145+
changed_when: pct_snap.rc == 0
144146

145147
- name: Verify snapshot exists
146148
ansible.builtin.command:
@@ -240,7 +242,8 @@
240242
tasks:
241243
- name: Check disk usage
242244
ansible.builtin.shell:
243-
cmd: "df -h / | awk 'NR==2 {print $5}' | tr -d '%'"
245+
cmd: "set -o pipefail; df -h / | awk 'NR==2 {print $5}' | tr -d '%'"
246+
executable: /bin/bash
244247
register: disk_pct
245248
changed_when: false
246249

@@ -304,7 +307,7 @@
304307
ansible.builtin.set_fact:
305308
smoke_all_passed: "{{ (svc_checks | rejectattr('passed') | list | length == 0) and (failed_units.stdout_lines | default([]) | length == 0) and (disk_pct.stdout | int <= 90) }}"
306309

307-
- name: Create smoke results directory
310+
- name: Create smoke results directory # noqa: run-once[task]
308311
ansible.builtin.file:
309312
path: "{{ smoke_results_dir }}"
310313
state: directory
@@ -314,8 +317,16 @@
314317
run_once: true
315318

316319
- name: Write smoke results
320+
vars:
321+
smoke_report:
322+
host: "{{ inventory_hostname }}"
323+
date: "{{ smoke_date }}"
324+
disk_pct: "{{ disk_pct.stdout | int }}"
325+
failed_units: "{{ failed_units.stdout_lines | default([]) }}"
326+
service_checks: "{{ svc_checks }}"
327+
all_passed: "{{ smoke_all_passed }}"
317328
ansible.builtin.copy:
318-
content: "{{ {'host': inventory_hostname, 'date': smoke_date, 'disk_pct': disk_pct.stdout | int, 'failed_units': failed_units.stdout_lines | default([]), 'service_checks': svc_checks, 'all_passed': smoke_all_passed} | to_nice_json }}"
329+
content: "{{ smoke_report | to_nice_json }}"
319330
dest: "{{ smoke_results_dir }}/{{ inventory_hostname }}-{{ smoke_date }}.json"
320331
mode: "0644"
321332
delegate_to: localhost
@@ -373,6 +384,7 @@
373384
cmd: "{{ host_info.type }} stop {{ host_info.vmid }}"
374385
delegate_to: "{{ host_info.pve_host }}"
375386
become: true
387+
changed_when: true
376388

377389
- name: Wait for guest to stop
378390
ansible.builtin.pause:
@@ -383,12 +395,14 @@
383395
cmd: "{{ host_info.type }} rollback {{ host_info.vmid }} {{ snapshot_name }}"
384396
delegate_to: "{{ host_info.pve_host }}"
385397
become: true
398+
changed_when: true
386399

387400
- name: Start guest
388401
ansible.builtin.command:
389402
cmd: "{{ host_info.type }} start {{ host_info.vmid }}"
390403
delegate_to: "{{ host_info.pve_host }}"
391404
become: true
405+
changed_when: true
392406

393407
- name: Wait for SSH to come back
394408
ansible.builtin.wait_for_connection:

remediation/host-recovery.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Remediation: attempt to recover an unresponsive VM/LXC via Proxmox
33
# Called by remediation-bridge with -e "target_host=<host>"
44

5-
- name: REMEDIATION | Recover {{ target_host | default('undefined') }} via Proxmox
5+
- name: "REMEDIATION | Recover via Proxmox — {{ target_host | default('undefined') }}"
66
hosts: localhost
77
connection: local
88
gather_facts: false

roles/server_hardening/tasks/users.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
mode: "0700"
1818

1919
- name: USERS | Deploy SSH authorized keys
20-
ansible.builtin.authorized_key:
20+
ansible.posix.authorized_key:
2121
user: "{{ hardening_ops_user }}"
2222
key: "{{ item }}"
2323
state: present

0 commit comments

Comments
 (0)