Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save OllionDavidCunliffe/99316a6af154e1cb113d25ea5a9c1a7e to your computer and use it in GitHub Desktop.
Save OllionDavidCunliffe/99316a6af154e1cb113d25ea5a9c1a7e to your computer and use it in GitHub Desktop.
#cloud-config
# vim: syntax=yaml
#
# The current version of cloud-init in the Hypriot rpi-64 is 0.7.9
# When dealing with cloud-init, it is SUPER important to know the version
# I have wasted many hours creating servers to find out the module I was
# trying to use wasn't in the cloud-init version I had
# Documentation: http://cloudinit.readthedocs.io/en/0.7.9/index.html
# Set your hostname here, the manage_etc_hosts will update the hosts file entries as well
hostname: ${HOSTNAME}
manage_etc_hosts: true
apt_preserve_sources_list: true
# You could modify this for your own user information
users:
- name: ${USERNAME}
gecos: "Grrrrr"
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
primary-group: users
groups: users,docker,adm,dialout,audio,plugdev,netdev,video
plain_text_passwd: ${PASSWORD}
ssh-import-id: None
lock_passwd: false
ssh_pwauth: true
chpasswd: { expire: false }
ssh-authorized-keys:
- ${SSH_PUBLIC_KEY}
# # Set the locale of the system
locale: "en_US.UTF-8"
# # Set the timezone
# # Value of 'timezone' must exist in /usr/share/zoneinfo
timezone: "${TIMEZONE}"
# # Update apt packages on first boot
# package_update: true
# package_upgrade: true
# package_reboot_if_required: true
package_upgrade: false
# # Install any additional apt packages you need here
packages:
- ntp
- ufw
- vim
# # WiFi connect to HotSpot
# To make wifi work with RPi3 and RPi0
# you also have to set "enable_uart=0" in config.txt
# See no-uart-config.txt for an example.
#
# # - use `wpa_passphrase SSID PASSWORD` to generate the psk
write_files:
- content: |
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
path: /etc/network/interfaces.d/wlan0
- content: |
country=${WIFI_COUNTRY}
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="${WIFI_SSID_NAME}"
psk=${WIFI_PASSWORD}
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
auth_alg=OPEN
}
path: /etc/wpa_supplicant/wpa_supplicant.conf
- content: |
persistent
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# static IP configuration:
interface eth0
static ip_address=${IP_ADDRESS}
# static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=${IP_ROUTE}
static domain_name_servers=${IP_DNS_SERVERS}
path: /etc/dhcpcd.conf
# These commands will be ran once on first boot only
runcmd:
# Pickup the hostname changes
- 'systemctl restart avahi-daemon'
# Activate WiFi interface
- 'ifup wlan0'
# Only move stuff to SWAP when you are completely OUT of RAM.
- 'echo vm.swappiness=0 | tee -a /etc/sysctl.conf'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment