Skip to content

Commit

Permalink
Merge pull request #744 from dev-sec/fix_openbsd
Browse files Browse the repository at this point in the history
Always update Vagrant Boxes before using
  • Loading branch information
schurzi authored Feb 5, 2024
2 parents 66a48b4 + b0dff13 commit 02ad766
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/os_hardening_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ jobs:
path: ansible_collections/devsec/hardening
submodules: true

- name: Update Vagrant Box
run: |
vagrant box update --box ${{ matrix.molecule_distro }} || true
- name: Test with molecule
run: |
molecule --version
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ssh_hardening_bsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
path: ansible_collections/devsec/hardening
submodules: true

- name: Update Vagrant Box
run: |
vagrant box update --box generic/${{ matrix.molecule_distro }} || true
- name: Test with molecule
run: |
molecule --version
Expand Down
16 changes: 16 additions & 0 deletions molecule/os_hardening_vm/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
selection: hold
when: ansible_os_family == 'Debian'

# we need to free up space, since the /boot partition in some Vagrant images is
# pretty small and system updates might fail
- name: Find all initrd.img to delete them
ansible.builtin.find:
paths: /boot
patterns: "initrd.img*"
register: find_results
when: ansible_os_family == 'Debian'

- name: Delete all initrd.img to free space on /boot
ansible.builtin.file:
path: "{{ item['path'] }}"
state: absent
with_items: "{{ find_results['files'] }}"
when: ansible_os_family == 'Debian'

- name: Run the equivalent of "apt-get update && apt-get upgrade"
ansible.builtin.apt:
upgrade: safe
Expand Down

0 comments on commit 02ad766

Please sign in to comment.