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

@ -55,25 +55,24 @@ packages:
- terminator
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, gdm ]
- [ systemctl, enable, NetworkManager ]
- [ systemctl, enable, rngd ]
- [ systemctl, enable, systemd-timesyncd.service ]
- systemctl enable apparmor
- systemctl enable auditd
- systemctl enable gdm
- systemctl enable NetworkManager
- systemctl enable rngd
- systemctl enable avahi-daemon
- systemctl enable systemd-timesyncd.service
write_files:
# Enable AppArmor in kernel parameters
- path: /etc/default/grub
append: true

View File

@ -46,9 +46,10 @@ packages:
# Install Graphical Interface
- plasma-meta
- sddm
- ark
- dolphin
- konsole
- ark
- okular
# Install Applications
- firefox
@ -56,25 +57,24 @@ packages:
- terminator
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, sddm ]
- [ systemctl, enable, NetworkManager ]
- [ systemctl, enable, rngd ]
- [ systemctl, enable, systemd-timesyncd.service ]
- systemctl enable apparmor
- systemctl enable auditd
- systemctl enable sddm
- systemctl enable NetworkManager
- systemctl enable rngd
- systemctl enable avahi-daemon
- systemctl enable systemd-timesyncd.service
write_files:
# Enable AppArmor in kernel parameters
- path: /etc/default/grub
append: true

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

View File

@ -145,9 +145,9 @@ trim() {
truncate --size=0 /swap/swapfile
fi
_msg "Fill root filesystem with 0 to reduce box size"
dd if=/dev/zero of=/EMPTY bs=1M || true
rm -f /EMPTY
# _msg "Fill root filesystem with 0 to reduce box size"
# dd if=/dev/zero of=/EMPTY bs=1M || true
# rm -f /EMPTY
# Block until the empty file has been removed, otherwise, Packer will
# try to kill the box while the disk is still full and that is bad.

View File

@ -37,15 +37,21 @@ runcmd:
- apt-get install -y -t bookworm-backports golang-go
write_files:
# Add backports repository
- path: /etc/apt/sources.list
append: true
content: deb http://deb.debian.org/debian bookworm-backports main contrib non-free
# 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'
owner: "root:root"
permissions: "0644"
content: |
[Match]
Name=en*

View File

@ -37,7 +37,7 @@ runcmd:
- apt-get install -y -t bookworm-backports golang-go
write_files:
# Add backports repository
- path: /etc/apt/sources.list
append: true
content: deb http://deb.debian.org/debian bookworm-backports main contrib non-free

View File

@ -35,7 +35,7 @@ runcmd:
- apt-get install -y -t bookworm-backports golang-go
write_files:
# Add backports repository
- path: /etc/apt/sources.list
append: true
content: deb http://deb.debian.org/debian bookworm-backports main contrib non-free
@ -48,8 +48,8 @@ write_files:
# Network configuration
- path: /etc/systemd/network/20-wired.network
owner: 'root:root'
permissions: '0644'
owner: "root:root"
permissions: "0644"
content: |
[Match]
Name=en*

View File

@ -22,7 +22,7 @@ main() {
install -Dm0644 $SRC/site.local /etc/apparmor.d/tunables/multiarch.d/site.local
install -Dm0755 $SRC/aa-update /usr/bin/aa-update
install -Dm0755 $SRC/aa-log-clean /usr/bin/aa-log-clean
cat $SRC/parser.conf >> /etc/apparmor/parser.conf
cat $SRC/parser.conf >>/etc/apparmor/parser.conf
chown -R "$SUDO_USER:$SUDO_USER" "/home/$SUDO_USER/.config/"
case "$DISTRIBUTION" in
arch) pacman --noconfirm -U $SRC/*.pkg.tar.zst ;;

View File

@ -28,7 +28,6 @@ packages:
- vim
write_files:
# Set some bash aliases
- path: /home/${username}/.bashrc
append: true

View File

@ -42,7 +42,6 @@ snap:
- install snapd-desktop-integration
runcmd:
# Remove default filesystem and related tools not used with the suggested
# storage layout. These may yet be required if different partitioning schemes
# are used.
@ -64,7 +63,6 @@ runcmd:
- apt-get -y autoremove
write_files:
# Setup shared directory
- path: /etc/fstab
append: true
@ -72,8 +70,8 @@ write_files:
0a31bc478ef8e2461a4b1cc10a24cc4 /home/user/Projects/apparmor.d virtiofs defaults 0 1
- path: /etc/systemd/network/20-wired.network
owner: 'root:root'
permissions: '0644'
owner: "root:root"
permissions: "0644"
content: |
[Match]
Name=en*

View File

@ -42,7 +42,6 @@ snap:
- install snapd-desktop-integration
runcmd:
# Remove default filesystem and related tools not used with the suggested
# storage layout. These may yet be required if different partitioning schemes
# are used.
@ -64,7 +63,6 @@ runcmd:
- apt-get -y autoremove
write_files:
# Setup shared directory
- path: /etc/fstab
append: true
@ -72,8 +70,8 @@ write_files:
0a31bc478ef8e2461a4b1cc10a24cc4 /home/user/Projects/apparmor.d virtiofs defaults 0 1
- path: /etc/systemd/network/20-wired.network
owner: 'root:root'
permissions: '0644'
owner: "root:root"
permissions: "0644"
content: |
[Match]
Name=en*

View File

@ -32,7 +32,6 @@ packages:
- vim
write_files:
# Setup shared directory
- path: /etc/fstab
append: true
@ -41,8 +40,8 @@ write_files:
# Network configuration
- path: /etc/systemd/network/20-wired.network
owner: 'root:root'
permissions: '0644'
owner: "root:root"
permissions: "0644"
content: |
[Match]
Name=en*