From 8e687edeb036db3d2f3b2c050bc12f8b7f9322c9 Mon Sep 17 00:00:00 2001 From: mrkuz Date: Sun, 14 Jun 2026 16:36:25 +0200 Subject: [PATCH] Add VPS notes and ansible playbook --- .silo/home.nix | 4 +++ ansible/ansible.cfg | 3 +++ ansible/docker.yml | 62 +++++++++++++++++++++++++++++++++++++++++++ ansible/inventory.ini | 2 ++ vps.md | 21 +++++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 ansible/ansible.cfg create mode 100644 ansible/docker.yml create mode 100644 ansible/inventory.ini create mode 100644 vps.md diff --git a/.silo/home.nix b/.silo/home.nix index 756a317..53c3393 100644 --- a/.silo/home.nix +++ b/.silo/home.nix @@ -1,4 +1,8 @@ { config, pkgs, ... }: { silo.podman.enable = false; + home.packages = with pkgs; [ + ansible + openssh + ]; } diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..f824e8e --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +inventory = inventory.ini +host_key_checking = False \ No newline at end of file diff --git a/ansible/docker.yml b/ansible/docker.yml new file mode 100644 index 0000000..98c7922 --- /dev/null +++ b/ansible/docker.yml @@ -0,0 +1,62 @@ +--- +- name: Install Docker on VPS + hosts: vps + become: true + tasks: + - name: Update apt cache + apt: + update_cache: yes + + - name: Install prerequisites + apt: + name: + - ca-certificates + - curl + - gnupg + state: present + + - name: Ensure keyrings directory exists + file: + path: /etc/apt/keyrings + state: directory + mode: '0755' + + - name: Download Docker GPG key + get_url: + url: https://download.docker.com/linux/ubuntu/gpg + dest: /etc/apt/keyrings/docker.asc + mode: '0644' + + - name: Add Docker APT repository + ansible.builtin.deb822_repository: + name: docker + types: deb + uris: https://download.docker.com/linux/ubuntu + suites: "{{ ansible_facts['distribution_release'] }}" + components: stable + signed_by: /etc/apt/keyrings/docker.asc + + - name: Install Docker packages + apt: + name: + - docker-ce + - docker-ce-cli + - containerd.io + - docker-buildx-plugin + - docker-compose-plugin + state: present + + - name: Add ubuntu user to docker group + user: + name: ubuntu + groups: docker + append: yes + + - name: Start and enable Docker services + systemd: + name: "{{ item }}" + state: started + enabled: yes + loop: + - containerd + - docker \ No newline at end of file diff --git a/ansible/inventory.ini b/ansible/inventory.ini new file mode 100644 index 0000000..40f3441 --- /dev/null +++ b/ansible/inventory.ini @@ -0,0 +1,2 @@ +[vps] +135.125.232.253 ansible_user=ubuntu ansible_python_interpreter=/usr/bin/python3 \ No newline at end of file diff --git a/vps.md b/vps.md new file mode 100644 index 0000000..e54973b --- /dev/null +++ b/vps.md @@ -0,0 +1,21 @@ +# VPS + +- IP: 135.125.232.253 +- OS: Ubuntu 26.04 LTS +- Default user: ubuntu + +# Manual steps + +Copy ssh key: `ssh-copy-id ubuntu@135.125.232.2` + +# DNS + +| Type | Host | Value | TTL | +| --- | --- | --- | --- | +| A | `*` | 135.125.232.253 | Automatic| + +# Ansible + +```bash +cd ansible && ansible-playbook docker.yml +```