Skip to content

Instantly share code, notes, and snippets.

@ivankovnatsky
Last active August 19, 2022 11:46
Show Gist options
  • Save ivankovnatsky/6c165eebd82909478398f665134f1e8f to your computer and use it in GitHub Desktop.
Save ivankovnatsky/6c165eebd82909478398f665134f1e8f to your computer and use it in GitHub Desktop.
# Ubuntu 20.10 and newer
sudo apt-get -y update
sudo apt-get -y install podman neovim sysstat
# Ubuntu 22.04
cat <<EOF >/etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list
# Enable Ubuntu proposed archive
deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe
EOF
apt install tmux neovim htop -y
apt install ansible -y # version 2.10.7+merged+base+2.10.8+dfsg-1, or
apt install ansible-core -y # version 2.12.0-1
apt-get update
apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
mkdir -p /etc/apt/keyrings
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
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
mkdir -p $HOME/.docker/cli-plugins
wget https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64 -P $HOME/.docker/cli-plugins
docker buildx install
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
apt install qemu-system -y
apt-get install qemu binfmt-support qemu-user-static -y
docker login -u=ikovnatsky -p=$(cat /tmp/docker-password) docker.io
mkdir ~/iac/
cd ~/iac/
cat > inventory << EOF
[local]
localhost ansible_connection=local ansible_python_interpreter=auto_silent
EOF
cat > main.yaml << EOF
- hosts: localhost
tasks:
- name: Install packages
ansible.builtin.apt:
name: "{{ item }}"
state: present
with_items:
- docker.io
EOF
cat > /etc/systemd/system/syncthing.service << EOF
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
[Service]
User=root
ExecStart=/usr/bin/syncthing -no-browser -gui-address="0.0.0.0:8384" -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=multi-user.target
EOF
# create user for syncthing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment