public_docs/rpi/user-data.yaml

65 lines
1.5 KiB
YAML

#cloud-config
ssh_import_id:
- lp:arif-ali
## Update apt database and upgrade packages on first boot
package_update: true
package_upgrade: true
byobu_by_default: enable
## Install additional packages on first boot
packages:
- aptitude
- byobu
- git
- linux-modules-extra-raspi
- nano
- openssh-server
- rpi-eeprom
- rsync
- salt-minion
- snapd
- ubuntu-minimal
- ubuntu-release-upgrader-core
## Write arbitrary files to the file-system (including binaries!)
write_files:
- path: /root/reset.sh
content: |
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
hold_apps="byobu git linux-modules-extra-raspi nano openssh-server rpi-eeprom rsync salt-minion snapd ubuntu-release-upgrader-core"
sudo -E apt-get update
sudo -E aptitude markauto '~i!~nubuntu-minimal'
sudo -E apt-mark hold ${hold_apps}
sudo -E apt-get -yq autoremove
dpkg -l | grep ^rc | awk '{print $2}' | xargs -i sudo -E dpkg --force-all -P "{}"
sudo -E apt-mark unhold ${hold_apps}
sudo -E apt-get -y install ${hold_apps}
sudo -E apt-get update
sudo -E apt-get -y upgrade
#sudo -E salt-call state.highstate
permissions: '0755'
owner: root:root
# Configure salt
salt_minion:
grains:
physical_type: rpi
# Runs any command that we need to run post install
runcmd:
- [ /root/reset.sh ]
- [ "snap", "set", "lxd", "criu.enable=true" ]
# Creates a 8GB swap file in /
swap:
filename: /swap.img
size: 8589934592