Add VPS notes and ansible playbook
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
silo.podman.enable = false;
|
||||
home.packages = with pkgs; [
|
||||
ansible
|
||||
openssh
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[defaults]
|
||||
inventory = inventory.ini
|
||||
host_key_checking = False
|
||||
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
[vps]
|
||||
135.125.232.253 ansible_user=ubuntu ansible_python_interpreter=/usr/bin/python3
|
||||
@@ -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
|
||||
```
|
||||
Reference in New Issue
Block a user