diff options
Diffstat (limited to '')
-rw-r--r-- | ansible/playbook.yaml | 10 | ||||
-rw-r--r-- | ansible/roles/caddy/files/Caddyfile | 7 | ||||
-rw-r--r-- | ansible/roles/caddy/handlers/main.yml | 6 | ||||
-rw-r--r-- | ansible/roles/caddy/tasks/main.yml | 15 | ||||
-rw-r--r-- | ansible/roles/common/tasks/main.yml | 11 | ||||
-rw-r--r-- | ansible/roles/docker-compose/tasks/main.yaml | 6 | ||||
-rw-r--r-- | ansible/roles/docker/tasks/main.yml | 22 | ||||
-rw-r--r-- | ansible/roles/sourcehut/tasks/main.yml | 33 | ||||
-rw-r--r-- | terraform/plan9-cluster.hcl | 52 |
9 files changed, 162 insertions, 0 deletions
diff --git a/ansible/playbook.yaml b/ansible/playbook.yaml new file mode 100644 index 0000000..7f760b2 --- /dev/null +++ b/ansible/playbook.yaml @@ -0,0 +1,10 @@ +--- +- hosts: all + become: true + roles: + - common + - docker + - docker-compose + - caddy + - sourcehut + - soft-serve diff --git a/ansible/roles/caddy/files/Caddyfile b/ansible/roles/caddy/files/Caddyfile new file mode 100644 index 0000000..837efa5 --- /dev/null +++ b/ansible/roles/caddy/files/Caddyfile @@ -0,0 +1,7 @@ +sourcehut.example.com { + reverse_proxy localhost:8000 +} +git.example.com { + reverse_proxy localhost:2222 +} + diff --git a/ansible/roles/caddy/handlers/main.yml b/ansible/roles/caddy/handlers/main.yml new file mode 100644 index 0000000..f265424 --- /dev/null +++ b/ansible/roles/caddy/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: Reload Caddy + systemd: + name: caddy + state: reloaded + diff --git a/ansible/roles/caddy/tasks/main.yml b/ansible/roles/caddy/tasks/main.yml new file mode 100644 index 0000000..5caaa18 --- /dev/null +++ b/ansible/roles/caddy/tasks/main.yml @@ -0,0 +1,15 @@ +--- +- name: Install Caddy + shell: | + apt install -y debian-keyring debian-archive-keyring apt-transport-https + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list + apt update + apt install caddy + +- name: Setup Caddy for SourceHut and Soft-Serve + copy: + src: Caddyfile + dest: /etc/caddy/Caddyfile + notify: Reload Caddy + diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml new file mode 100644 index 0000000..986f438 --- /dev/null +++ b/ansible/roles/common/tasks/main.yml @@ -0,0 +1,11 @@ +--- +- name: Install dependencies + apt: + name: + - apt-transport-https + - ca-certificates + - curl + - software-properties-common + - git + state: present + update_cache: yes diff --git a/ansible/roles/docker-compose/tasks/main.yaml b/ansible/roles/docker-compose/tasks/main.yaml new file mode 100644 index 0000000..6386f2d --- /dev/null +++ b/ansible/roles/docker-compose/tasks/main.yaml @@ -0,0 +1,6 @@ +--- +- name: Install Docker Compose + get_url: + url: https://github.com/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` + dest: /usr/local/bin/docker-compose + mode: '0755' diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml new file mode 100644 index 0000000..38ad4dd --- /dev/null +++ b/ansible/roles/docker/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: Add Docker GPG key + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + +- name: Add Docker repository + apt_repository: + repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable + state: present + +- name: Install Docker + apt: + name: docker-ce + state: present + update_cache: yes + +- name: Start and enable Docker service + systemd: + name: docker + state: started + enabled: true diff --git a/ansible/roles/sourcehut/tasks/main.yml b/ansible/roles/sourcehut/tasks/main.yml new file mode 100644 index 0000000..047ac06 --- /dev/null +++ b/ansible/roles/sourcehut/tasks/main.yml @@ -0,0 +1,33 @@ +--- +- name: Clone SourceHut repositories + git: + repo: '{{ item }}' + dest: '/opt/sourcehut/{{ item | basename }}' + with_items: + - https://git.sr.ht/~sircmpwn/builds.sr.ht + - https://git.sr.ht/~sircmpwn/dispatch.sr.ht + - https://git.sr.ht/~sircmpwn/git.sr.ht + - https://git.sr.ht/~sircmpwn/hg.sr.ht + - https://git.sr.ht/~sircmpwn/lists.sr.ht + - https://git.sr.ht/~sircmpwn/meta.sr.ht + - https://git.sr.ht/~sircmpwn/mle.sr.ht + - https://git.sr.ht/~sircmpwn/patches.sr.ht + - https://git.sr.ht/~sircmpwn/paste.sr.ht + - https://git.sr.ht/~sircmpwn/todo.sr.ht + +- name: Configure SourceHut services + shell: | + cd /opt/sourcehut/{{ item | basename }} + docker-compose up -d + with_items: + - https://git.sr.ht/~sircmpwn/builds.sr.ht + - https://git.sr.ht/~sircmpwn/dispatch.sr.ht + - https://git.sr.ht/~sircmpwn/git.sr.ht + - https://git.sr.ht/~sircmpwn/hg.sr.ht + - https://git.sr.ht/~sircmpwn/lists.sr.ht + - https://git.sr.ht/~sircmpwn/meta.sr.ht + - https://git.sr.ht/~sircmpwn/mle.sr.ht + - https://git.sr.ht/~sircmpwn/patches.sr.ht + - https://git.sr.ht/~sircmpwn/paste.sr.ht + - https://git.sr.ht/~sircmpwn/todo.sr.ht + diff --git a/terraform/plan9-cluster.hcl b/terraform/plan9-cluster.hcl new file mode 100644 index 0000000..93b9eec --- /dev/null +++ b/terraform/plan9-cluster.hcl @@ -0,0 +1,52 @@ +provider "libvirt" { + uri = "qemu:///system" +} + +resource "libvirt_volume" "plan9_image" { + name = "plan9-image" + pool = "default" + source = "/path/to/plan9.iso" + format = "raw" +} + +resource "libvirt_network" "plan9_network" { + name = "plan9-network" + mode = "nat" + addresses = ["192.168.123.0/24"] +} + +resource "libvirt_domain" "plan9_node" { + count = 3 + name = "plan9-node-${count.index + 1}" + memory = "512" + vcpu = 1 + + network_interface { + network_name = libvirt_network.plan9_network.name + } + + disk { + volume_id = libvirt_volume.plan9_image.id + } + + console { + type = "pty" + target_type = "serial" + target_port = "0" + } + + graphics { + type = "vnc" + listen_type = "address" + listen_address = "127.0.0.1" + } + + # Cloud-init is not applicable for Plan 9; manual configuration will be required +} + +output "plan9_node_ips" { + value = { + for i in libvirt_domain.plan9_node: i.name => i.network_interface[0].addresses[0] + } +} + |