From bd28224e55dc4274a21d2f6a4ebcfe011c3ac341 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 26 Aug 2023 20:40:30 +0200 Subject: [PATCH] more --- flake.nix | 1 + new/debug.html | 15 +++++++ new/playbooks/basic-setup.yml | 78 ++++++++++++++++++++--------------- new/vps2/Caddyfile | 10 +++++ 4 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 new/debug.html create mode 100644 new/vps2/Caddyfile diff --git a/flake.nix b/flake.nix index 6381636..6be2ff0 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,7 @@ certbot dig openssl + caddy ]; }; }); diff --git a/new/debug.html b/new/debug.html new file mode 100644 index 0000000..14d2ca3 --- /dev/null +++ b/new/debug.html @@ -0,0 +1,15 @@ + + +
+ + + +sorry, but there isn't anything cool here. this is my infra, you are not allowed here.
+if you do want to be allowed here, then uh.. still no.
+:3
+ + diff --git a/new/playbooks/basic-setup.yml b/new/playbooks/basic-setup.yml index 93e5ce0..647c1a9 100644 --- a/new/playbooks/basic-setup.yml +++ b/new/playbooks/basic-setup.yml @@ -2,46 +2,58 @@ - name: Basic Server setup hosts: all gather_facts: false - vars: - acme_challenge_type: http-01 - acme_directory: https://acme-v02.api.letsencrypt.org/directory - acme_version: 2 - acme_email: nilstrieb@gmail.com # don't spam me pls :( - letsencrypt_dir: /etc/letsencrypt - letsencrypt_keys_dir: /etc/letsencrypt/keys - letsencrypt_csrs_dir: /etc/letsencrypt/csrs - letsencrypt_certs_dir: /etc/letsencrypt/certs - letsencrypt_account_key: /etc/letsencrypt/account/account.key - domain_name: vps2.nilstrieb.dev tasks: - - name: Test ping - ansible.builtin.ping: - name: Install docker ansible.builtin.apt: name: docker.io state: present - - name: Install nginx + - name: Install keyring packages ansible.builtin.apt: - name: nginx + name: "{{ item }}" + with_items: + - debian-keyring + - debian-archive-keyring + - apt-transport-https + - name: Add caddy keyrings + ansible.builtin.shell: | + set -euo pipefail + + sudo rm /usr/share/keyrings/caddy-stable-archive-keyring.gpg + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg + curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list + + # todo: show ok/changed + args: + executable: /bin/bash + - name: Install caddy + ansible.builtin.apt: + name: caddy state: present - - name: Ensure nginx is started + args: + update_cache: true + - name: Ensure caddy is started ansible.builtin.service: - name: nginx + name: caddy state: started - - name: Create hello world file - ansible.builtin.copy: - dest: /var/www/html/index.html - content: | - - - - - - -