Initialise repository structure and placeholder files. Generic functionality works i guess, need to come up with a better solution for compose templates

This commit is contained in:
boris committed 2026-07-08 10:29:51 +01:00
commit 53695f4fff
411 files changed
+7817

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
# pterodactyl
Deploys the Pterodactyl panel with MariaDB and Redis. Wings/node deployment can
be added as a separate role when game nodes are introduced.
Tags: `pterodactyl`, `config`, `compose`, `firewall`.
+23
View File
@@ -0,0 +1,23 @@
---
pterodactyl_dir: /srv/docker/pterodactyl
pterodactyl_panel_image: ghcr.io/pterodactyl/panel:latest
pterodactyl_db_image: mariadb:10.11
pterodactyl_cache_image: redis:7-alpine
pterodactyl_http_port: 8081
pterodactyl_domain: panel.example.invalid
pterodactyl_routing_mode: "{{ nbops_service_routing_mode }}"
pterodactyl_traefik_network: "{{ nbops_proxy_network }}"
pterodactyl_traefik_entrypoint: "{{ nbops_traefik_entrypoint }}"
pterodactyl_traefik_tls: "{{ nbops_traefik_tls }}"
pterodactyl_app_key: "{{ vault_pterodactyl_app_key | default('CHANGE_ME_IN_VAULT') }}"
pterodactyl_db_password: "{{ vault_pterodactyl_db_password | default('CHANGE_ME_IN_VAULT') }}"
pterodactyl_env:
APP_URL: "https://{{ pterodactyl_domain }}"
APP_KEY: "{{ pterodactyl_app_key }}"
DB_HOST: database
DB_DATABASE: panel
DB_USERNAME: pterodactyl
DB_PASSWORD: "{{ pterodactyl_db_password }}"
REDIS_HOST: cache
pterodactyl_tcp_ports:
- "{{ pterodactyl_http_port }}"
+1
View File
@@ -0,0 +1 @@
+6
View File
@@ -0,0 +1,6 @@
---
- name: restart pterodactyl
community.docker.docker_compose_v2:
project_src: "{{ pterodactyl_dir }}"
state: restarted
+51
View File
@@ -0,0 +1,51 @@
---
- name: Create Pterodactyl directory
ansible.builtin.file:
path: "{{ pterodactyl_dir }}"
state: directory
owner: root
group: root
mode: "0755"
tags: [pterodactyl]
- name: Render Pterodactyl environment
ansible.builtin.template:
src: env.j2
dest: "{{ pterodactyl_dir }}/.env"
owner: root
group: root
mode: "0600"
no_log: true
tags: [pterodactyl, config]
- name: Ensure Pterodactyl proxy network exists
community.docker.docker_network:
name: "{{ pterodactyl_traefik_network }}"
state: present
when: pterodactyl_routing_mode == "traefik"
tags: [pterodactyl, docker]
- name: Render Pterodactyl Compose file
ansible.builtin.template:
src: compose.yaml.j2
dest: "{{ pterodactyl_dir }}/compose.yaml"
owner: root
group: root
mode: "0644"
notify: restart pterodactyl
tags: [pterodactyl, compose]
- name: Allow Pterodactyl ports
community.general.ufw:
rule: allow
port: "{{ item }}"
proto: tcp
loop: "{{ pterodactyl_tcp_ports }}"
when: pterodactyl_routing_mode == "host"
tags: [pterodactyl, firewall]
- name: Start Pterodactyl
community.docker.docker_compose_v2:
project_src: "{{ pterodactyl_dir }}"
state: present
tags: [pterodactyl, compose]
@@ -0,0 +1,47 @@
services:
panel:
image: {{ pterodactyl_panel_image }}
restart: unless-stopped
env_file: .env
{% if pterodactyl_routing_mode == "host" %}
ports:
- "{{ pterodactyl_http_port }}:80"
{% endif %}
{% if pterodactyl_routing_mode == "traefik" %}
# internal HTTP service port: 80; not published on the Docker host
labels:
- traefik.enable=true
- traefik.http.routers.pterodactyl.rule=Host(`{{ pterodactyl_domain }}`)
- traefik.http.routers.pterodactyl.entrypoints={{ pterodactyl_traefik_entrypoint }}
- traefik.http.routers.pterodactyl.tls={{ pterodactyl_traefik_tls | bool | ternary('true', 'false') }}
- traefik.http.services.pterodactyl.loadbalancer.server.port=80
networks:
- default
- {{ pterodactyl_traefik_network }}
{% endif %}
volumes:
- ./var:/app/var
- ./nginx:/etc/nginx/http.d
- ./certs:/etc/letsencrypt
- ./logs:/app/storage/logs
depends_on:
- database
- cache
database:
image: {{ pterodactyl_db_image }}
restart: unless-stopped
environment:
MYSQL_DATABASE: panel
MYSQL_USER: pterodactyl
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
volumes:
- ./database:/var/lib/mysql
cache:
image: {{ pterodactyl_cache_image }}
restart: unless-stopped
{% if pterodactyl_routing_mode == "traefik" %}
networks:
{{ pterodactyl_traefik_network }}:
external: true
{% endif %}
+5
View File
@@ -0,0 +1,5 @@
MYSQL_PASSWORD={{ pterodactyl_db_password }}
{% for key, value in pterodactyl_env.items() %}
{{ key }}={{ value }}
{% endfor %}