tests(packer): cleanup cloud init files.

This commit is contained in:
Alexandre Pujol 2024-03-15 14:55:46 +00:00
parent c3c61a9270
commit 3fc4c29968
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
12 changed files with 79 additions and 76 deletions

View file

@ -37,37 +37,21 @@ packages:
- wget
runcmd:
# Regenerate grub.cfg
- [ grub-mkconfig, -o, /boot/grub/grub.cfg ]
- grub-mkconfig -o /boot/grub/grub.cfg
# Remove swapfile
- [ swapoff, -a ]
- [ rm, -rf, /swap/ ]
- [ sed, -e, "/swap/d", -i, /etc/fstab ]
- swapoff -a
- rm -rf /swap/
- sed -e "/swap/d" -i /etc/fstab
# Enable core services
- [ systemctl, enable, apparmor ]
- [ systemctl, enable, auditd ]
- [ systemctl, enable, rngd ]
- [ systemctl, enable, systemd-timesyncd.service ]
- systemctl enable apparmor
- systemctl enable auditd
- systemctl enable rngd
- systemctl enable systemd-timesyncd.service
write_files:
# Network configuration
- path: /etc/systemd/network/20-wired.network
owner: 'root:root'
permissions: '0644'
content: |
[Match]
Name=en*
[Network]
DHCP=yes
[DHCPv4]
RouteMetric=10
# Enable AppArmor in kernel parameters
- path: /etc/default/grub
append: true
@ -79,3 +63,23 @@ write_files:
append: true
content: |
[[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
# Setup shared directory
- path: /etc/fstab
append: true
content: |
0a31bc478ef8e2461a4b1cc10a24cc4 /home/user/Projects/apparmor.d virtiofs defaults 0 1
# Network configuration
- path: /etc/systemd/network/20-wired.network
owner: "root:root"
permissions: "0644"
content: |
[Match]
Name=en*
[Network]
DHCP=yes
[DHCPv4]
RouteMetric=10