Skip to content

Commit 7ad787d

Browse files
committed
fix: rm all autoremove true
1 parent 1af23d0 commit 7ad787d

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

ansible/tasks/clean-build-dependencies.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
# Protect packages that SSH and cloud-init depend on from autoremove
2-
# These must be marked as manually installed BEFORE any autoremove runs
3-
- name: Mark SSH and cloud-init dependencies as manually installed
4-
ansible.builtin.shell: |
5-
apt-mark manual openssh-server cloud-init python3-systemd python3-jinja2 python3-yaml python3-oauthlib python3-configobj || true
6-
changed_when: false
1+
# IMPORTANT: Do NOT use autoremove: true in these tasks!
2+
# Autoremove causes cascading removal of cloud-init and breaks SSH on the AMI.
3+
# Autoremove is handled safely in 90-cleanup.sh after apt-mark protection.
74

85
- name: Remove build dependencies
96
ansible.builtin.apt:
10-
autoremove: true
7+
autoremove: false
118
pkg:
129
- bison
1310
- build-essential
@@ -32,7 +29,6 @@
3229
# - Dev packages provide headers for building exploits
3330
# - salt-minion is a remote management agent (large attack surface)
3431
# - sshpass stores credentials in plaintext
35-
# NOTE: autoremove disabled here to prevent cascading removal of cloud-init deps
3632
- name: Remove high-security-risk packages
3733
ansible.builtin.apt:
3834
autoremove: false
@@ -64,10 +60,3 @@
6460
# Build tool leftovers
6561
- ansible-core
6662
state: 'absent'
67-
68-
# Run a final autoremove to clean up any remaining orphaned packages
69-
# This runs after apt-mark manual, so cloud-init deps are protected
70-
- name: Clean up orphaned packages
71-
ansible.builtin.apt:
72-
autoremove: true
73-
changed_when: false

0 commit comments

Comments
 (0)