Skip to content

Instantly share code, notes, and snippets.

@leonsteinhaeuser
Last active October 3, 2023 23:20
Show Gist options
  • Save leonsteinhaeuser/2424af8b9ae81fffd3da04e06f26fda7 to your computer and use it in GitHub Desktop.
Save leonsteinhaeuser/2424af8b9ae81fffd3da04e06f26fda7 to your computer and use it in GitHub Desktop.

cloud init

This cloud init yaml bootstraps a server and sets up the necessary bits to get Docker running with all dependencies.

#cloud-config
package_update: true
package_upgrade: true
packages:
- curl
- vim
- apt-transport-https
- ca-certificates
- curl
- gnupg
- software-properties-common
runcmd:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu "$(lsb_release -cs)" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
- apt-get update -y
- apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
users:
- name: my-user
sudo: ALL=(ALL:ALL) NOPASSWD:ALL
groups: docker
lock_passwd: true
shell: /bin/bash
ssh_authorized_keys:
- "my ssh public key"
write_files:
- path: /home/my-user/.vimrc
owner: my-user:my-user
permissions: "0600"
defer: true
content: |
set paste
syntax on
- path: /etc/ssh/sshd_config.d/custom.conf
owner: root:root
permissions: "0644"
defer: true
content: |
Port 12345
PasswordAuthentication no
PermitRootLogin no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment