thingies
This commit is contained in:
parent
5f06a966aa
commit
3343de2dc0
12 changed files with 286 additions and 57 deletions
61
ansible/services/caddy_playbook.yml
Normal file
61
ansible/services/caddy_playbook.yml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
- name: Install and configure Caddy on Debian 12
|
||||
hosts: vipy
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Install required packages
|
||||
apt:
|
||||
name:
|
||||
- debian-keyring
|
||||
- debian-archive-keyring
|
||||
- apt-transport-https
|
||||
- curl
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Download Caddy GPG armored key
|
||||
ansible.builtin.get_url:
|
||||
url: https://dl.cloudsmith.io/public/caddy/stable/gpg.key
|
||||
dest: /tmp/caddy-stable-archive-keyring.asc
|
||||
mode: '0644'
|
||||
|
||||
- name: Convert ASCII armored key to binary keyring
|
||||
ansible.builtin.command:
|
||||
cmd: gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg /tmp/caddy-stable-archive-keyring.asc
|
||||
args:
|
||||
creates: /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
|
||||
- name: Ensure permissions on keyring file
|
||||
ansible.builtin.file:
|
||||
path: /usr/share/keyrings/caddy-stable-archive-keyring.gpg
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: Add Caddy repository list file
|
||||
ansible.builtin.get_url:
|
||||
url: https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt
|
||||
dest: /etc/apt/sources.list.d/caddy-stable.list
|
||||
mode: '0644'
|
||||
validate_certs: yes
|
||||
|
||||
- name: Update apt cache after adding repo
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install Caddy
|
||||
apt:
|
||||
name: caddy
|
||||
state: present
|
||||
|
||||
- name: Ensure Caddy service is enabled and started
|
||||
systemd:
|
||||
name: caddy
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: Allow HTTPS through UFW
|
||||
ufw:
|
||||
rule: allow
|
||||
port: '443'
|
||||
proto: tcp
|
||||
59
ansible/services/docker_playbook.yml
Normal file
59
ansible/services/docker_playbook.yml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
- name: Install Docker and Docker Compose on Debian 12
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
- name: Ensure required packages are installed
|
||||
apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
- lsb-release
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Add Docker GPG key
|
||||
ansible.builtin.apt_key:
|
||||
url: https://download.docker.com/linux/debian/gpg
|
||||
state: present
|
||||
|
||||
- name: Add Docker repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: "deb [arch=amd64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
|
||||
state: present
|
||||
filename: docker
|
||||
|
||||
- name: Update apt cache after adding Docker repo
|
||||
apt:
|
||||
update_cache: yes
|
||||
|
||||
- name: Install Docker Engine and CLI
|
||||
apt:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
state: latest
|
||||
|
||||
- name: Ensure Docker is started and enabled
|
||||
systemd:
|
||||
name: docker
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: Add user to docker group
|
||||
user:
|
||||
name: "{{ ansible_user }}"
|
||||
groups: docker
|
||||
append: yes
|
||||
|
||||
- name: Create symlink for docker-compose (optional CLI alias)
|
||||
file:
|
||||
src: /usr/libexec/docker/cli-plugins/docker-compose
|
||||
dest: /usr/local/bin/docker-compose
|
||||
state: link
|
||||
when: ansible_facts['os_family'] == "Debian"
|
||||
ignore_errors: true # In case the plugin path differs slightly
|
||||
51
ansible/services/uptime_kuma_playbook.yml
Normal file
51
ansible/services/uptime_kuma_playbook.yml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
- name: Deploy Uptime Kuma with Docker Compose and configure Caddy reverse proxy
|
||||
hosts: vipy
|
||||
become: yes
|
||||
vars:
|
||||
uptime_kuma_dir: /opt/uptime-kuma
|
||||
uptime_kuma_port: 3001
|
||||
caddy_sites_dir: /etc/caddy/sites-enabled
|
||||
uptime_kuma_domain: uptime.example.com # Change to your domain
|
||||
|
||||
tasks:
|
||||
- name: Create uptime kuma directory
|
||||
file:
|
||||
path: "{{ uptime_kuma_dir }}"
|
||||
state: directory
|
||||
owner: {{ ansible_user }}
|
||||
group: {{ ansible_user }}
|
||||
mode: '0755'
|
||||
|
||||
- name: Create docker-compose.yml for uptime kuma
|
||||
copy:
|
||||
dest: "{{ uptime_kuma_dir }}/docker-compose.yml"
|
||||
content: |
|
||||
version: "3"
|
||||
services:
|
||||
uptime-kuma:
|
||||
image: louislam/uptime-kuma:latest
|
||||
container_name: uptime-kuma
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "{{ uptime_kuma_port }}:3001"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
|
||||
- name: Deploy uptime kuma container with docker compose
|
||||
command: docker-compose up -d
|
||||
args:
|
||||
chdir: "{{ uptime_kuma_dir }}"
|
||||
|
||||
- name: Create Caddy reverse proxy configuration for uptime kuma
|
||||
copy:
|
||||
dest: "{{ caddy_sites_dir }}/uptime-kuma.conf"
|
||||
content: |
|
||||
{{ uptime_kuma_domain }} {
|
||||
reverse_proxy localhost:{{ uptime_kuma_port }}
|
||||
}
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
|
||||
- name: Reload Caddy to apply new config
|
||||
command: systemctl reload caddy
|
||||
Loading…
Add table
Add a link
Reference in a new issue