Skip to content

Always update Vagrant Boxes before using #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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