Added initial user-data file.
This commit is contained in:
@ -1,67 +0,0 @@
|
|||||||
#================================================================
|
|
||||||
# Package installation
|
|
||||||
#================================================================
|
|
||||||
preset=server
|
|
||||||
firmware_packages=1
|
|
||||||
packages=nano,curl,htop,git,smartmontools,fail2ban,knockd,iptables,glusterfs-server,sed,iptables-persistent,rsync
|
|
||||||
#================================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#================================================================
|
|
||||||
# Localisation
|
|
||||||
#================================================================
|
|
||||||
keyboad_layout=us
|
|
||||||
locales=en_NZ.UTF-8
|
|
||||||
timezone=Pacific/Auckland
|
|
||||||
system_default_locale=en_NZ.UTF-8
|
|
||||||
#================================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#================================================================
|
|
||||||
# Security hardening
|
|
||||||
#================================================================
|
|
||||||
ssh_pwlogin=0
|
|
||||||
root_ssh_pwlogin=0
|
|
||||||
|
|
||||||
# Provide an ssh public key
|
|
||||||
user_ssh_pubkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC2t1GmNmhoV2WvrA5dKS9nhLlBExD949coqQnYnqvgQ7l+ODRXxifg8wcnp7PXTcs6CW3tlwA6W5LWMK5gtjNXfZH9jpMPD2m1p7koysoYmC2eMWREF+IN4dS1MsaL9VU1WrqolP3qbvI2WWmECrzA0xakDhAZXuIzl3HRng1YeQV8gi8YoG9Jm0ZXd+RMqxBGyUw1+O4o1NfFwQ9dIUNFRyUScl/yzQv0AfXqOi2IrdA5IpdtlpAZsD1cnB3kUFlluxaqCuXQKGO1wPo3wTh2Po+upCyMi2XXCakVXgRaIuBLvmZPYVMYlwbbDL0dMexhc+pccgJ3sE0JDzm1+oe2uY9pIIsnfrD6fzjN+JO0rbGtrWpERf0amIzJFj4i7zvPk4eY7OskYSInf7Qj5He8eLv0VBBxQc2ikDTPQtS/cIomLXA1tAsA1dqHNl438AHG4r4NaPNDAoRUql3BOYEZjyza5eV8b26Yw3s/x64g4oc0Zhoc6/UB7zmbou0a1w+oC1qXloJIYnYb6ntiaZKt5HLuUUP7V0WIMRco35Rt1NtaKKwqmo7z40VwvYPWTtaNwm3GFmMi9E603TudzuJB+katlfROXFOI/8Ks5S1juFAMcI+KVo0Ndl0G9iYRbZyrHB+HdxS1HVaWn4CTy9WCvQBHWB/cr1dnjVviqAZ0iw== james@james-ultrabook"
|
|
||||||
#================================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#================================================================
|
|
||||||
# Setup my user
|
|
||||||
#================================================================
|
|
||||||
username=james
|
|
||||||
userpw=[PASSWORD HERE]
|
|
||||||
userperms_admin=1
|
|
||||||
usergpu=1
|
|
||||||
rootpw=[PASSWORD HERE]
|
|
||||||
#================================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#================================================================
|
|
||||||
# Optimise system power and ram usage
|
|
||||||
#================================================================
|
|
||||||
gpu_mem=32
|
|
||||||
cmdline="dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 elevator=deadline fsck.repair=yes cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory"
|
|
||||||
#================================================================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#================================================================
|
|
||||||
# Configure networking
|
|
||||||
#================================================================
|
|
||||||
hostname=rasp-worker2
|
|
||||||
ifname=wlan0
|
|
||||||
ip_addr=192.168.43.122
|
|
||||||
ip_netmask=255.255.255.0
|
|
||||||
ip_gateway=192.168.43.1
|
|
||||||
ip_nameservers=1.1.1.1
|
|
||||||
wlan_country=NZ
|
|
||||||
wlan_ssid="James Phone"
|
|
||||||
wlan_psk="[PASSWORD HERE]"
|
|
||||||
#================================================================
|
|
||||||
36
readme.org
36
readme.org
@ -47,22 +47,15 @@ To simplify the sd card creation process we can use the open source [[https://gi
|
|||||||
|
|
||||||
#+NAME: Download rpi-imager utility
|
#+NAME: Download rpi-imager utility
|
||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
echo Downloading latest release zip from github
|
echo Downloading latest release zip from github
|
||||||
curl -s https://api.github.com/repos/raspberrypi/rpi-imager/releases/latest \
|
curl -s https://api.github.com/repos/raspberrypi/rpi-imager/releases/latest \
|
||||||
| grep "browser_download_url.*exe" \
|
| grep "browser_download_url.*exe" \
|
||||||
| cut -d : -f 2,3 \
|
| cut -d : -f 2,3 \
|
||||||
| tr -d \" \
|
| tr -d \" \
|
||||||
| wget -O /mnt/c/Users/$USER/Downloads/imager.exe -i -
|
| wget -O /mnt/c/Users/$USER/Downloads/imager.exe -i -
|
||||||
|
|
||||||
echo Checking file is now present
|
echo Checking file is now present
|
||||||
ls -l /mnt/c/Users/$USER/Downloads/imager.exe
|
ls -l /mnt/c/Users/$USER/Downloads/imager.exe
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS: Download rpi-imager utility
|
|
||||||
#+begin_src bash
|
|
||||||
Downloading latest release zip from github
|
|
||||||
Checking file is now present
|
|
||||||
-rwxrwxrwx 1 james james 19770592 Mar 30 07:00 /mnt/c/Users/james/Downloads/imager.exe
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
With the software downloaded, let's fire it up the installer and get it setup.
|
With the software downloaded, let's fire it up the installer and get it setup.
|
||||||
@ -95,33 +88,18 @@ Once you've selected the operating system and sd card, click ~WRITE~. The proces
|
|||||||
|
|
||||||
** Apply custom install configuration
|
** Apply custom install configuration
|
||||||
|
|
||||||
Our next step after downloading the latest release is to apply our own installation configuration using a simple txt file.
|
Our next step after downloading the latest release is to apply our own installation configuration using a simple plain text [[https://cloud-init.io/][cloud-init]] file.
|
||||||
|
|
||||||
There is great documentation online showing what configuration options are available [[https://github.com/malignus/raspberrypi-ua-netinst/blob/master/doc/INSTALL_CUSTOM.md][here]].
|
There is great documentation online showing what configuration options are available [[https://cloudinit.readthedocs.io/en/latest/topics/modules.html][here]].
|
||||||
|
|
||||||
For our purposes we just over-write the file downloaded and extracted in the previous step with one we have prepared earlier :)
|
For our purposes we just over-write the default cloud init ~user-data~ file on our newly created sd card with a custom ~user-data~ from this repository.
|
||||||
|
|
||||||
#+NAME: Overwrite installer configuration file
|
#+NAME: Overwrite installer configuration file
|
||||||
#+begin_src tmate
|
#+begin_src tmate
|
||||||
echo Display wordcount of file after copy to validate update wordcount of original file for comparison
|
|
||||||
wc installer/raspberrypi-ua-netinst/config/installer-config.txt
|
|
||||||
|
|
||||||
echo Overwriting /installer/raspberrypi-ua-netinst/config/installer-config.txt
|
echo Overwriting /installer/raspberrypi-ua-netinst/config/installer-config.txt
|
||||||
cp installer-config.txt installer/raspberrypi-ua-netinst/config/
|
cp installer-config.txt installer/raspberrypi-ua-netinst/config/
|
||||||
|
|
||||||
echo Display wordcount of file after copy to validate update
|
|
||||||
wc installer/raspberrypi-ua-netinst/config/installer-config.txt
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+RESULTS: Overwrite installer configuration file
|
|
||||||
#+begin_example
|
|
||||||
Display wordcount of original file for comparison
|
|
||||||
3 23 157 installer/raspberrypi-ua-netinst/config/installer-config.txt
|
|
||||||
Overwriting /installer/raspberrypi-ua-netinst/config/installer-config.txt
|
|
||||||
Display wordcount of file after copy to validate update
|
|
||||||
67 85 2863 installer/raspberrypi-ua-netinst/config/installer-config.txt
|
|
||||||
#+end_example
|
|
||||||
|
|
||||||
|
|
||||||
** Apply custom post install script
|
** Apply custom post install script
|
||||||
|
|
||||||
|
|||||||
43
user-data
Executable file
43
user-data
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#cloud-config
|
||||||
|
|
||||||
|
# ==================================================================
|
||||||
|
# Add users to the system
|
||||||
|
# ==================================================================
|
||||||
|
users:
|
||||||
|
- name: james
|
||||||
|
gecos: James Blair
|
||||||
|
primary_group: james
|
||||||
|
groups: users, admin
|
||||||
|
ssh_authorized_keys:
|
||||||
|
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCsYhu2xE5cxq+sA7bNyHjZUk9IHKXHsd58ZCFLfCHbK5nnWLgJwxFnF1NzBylyOJviJ2v54VYQoXvsWLTbehlyH/kqJS8icmo0iu2mUFcp09n/3NcGw2BJefwMbK+mofxBBR78RRNI8DG3yk7Apa19BrLpFWaL/VljGidgR61WhPH7FbXjTh5NuQR494LG3yBRn16yIPNN+xZhf0TW7uoVCiSr77kFELgrTqjpPyoYiYLZZdKqJZ7PDgOEcLq5oDEZfYME8sGRPyufGByH7tnK9fgFaZ9wW747wTNN2naUIhCNzJLxKgr8fMMRBXuqeUjk+5/EzxGFXjxE+4a+dhD51OO5mSN1ctG/061HIQjJwZ2Zk6CACypBEv6nLVREaMqKQtcEPPooZ2SK4SdiMtwC8XLCZ6wRQDVskMentI1uy3bbCwV9AG0auiLA3sfbyKI8093p5NLsLEiR+BScu4/tLx7kzPetl89QOKzTI60GXzBaSnBXhAtQTijZZFrOGbQ1NQ1deWb6pT8foOPOs3P2F0a4Y/nY/xlomBuNqTI48Vi8MZJjhTvAe8BF+Y7C8HlSaCZeH1DrnymkbLhpXvVH7Tuir/DLOyhrwnXqNuxpMyWsfy5UrTfe67GP2+jzriFxteTMbvZjmgbF2UDMYs5U59NaYPdAYxjwdzH5nHoIWw== james@james-desktop
|
||||||
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||||
|
# ==================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ==================================================================
|
||||||
|
# Add packages to the system
|
||||||
|
# ==================================================================
|
||||||
|
package_upgrade: true
|
||||||
|
packages:
|
||||||
|
- nano
|
||||||
|
- curl
|
||||||
|
- htop
|
||||||
|
- git
|
||||||
|
- smartmontools
|
||||||
|
- fail2ban
|
||||||
|
- knockd
|
||||||
|
- glusterfs-server
|
||||||
|
- sed
|
||||||
|
- rsync
|
||||||
|
# ==================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#================================================================
|
||||||
|
# Localisation
|
||||||
|
#================================================================
|
||||||
|
user-data:
|
||||||
|
timezone: Pacific/Auckland
|
||||||
|
locale: en_NZ
|
||||||
|
#================================================================
|
||||||
Reference in New Issue
Block a user