Replace tracker playbook with container

This commit is contained in:
Joakim Soderlund 2023-08-27 11:54:51 +02:00
parent c3854bdb1f
commit e81530eeaf
13 changed files with 16 additions and 180 deletions

View file

@ -1,10 +0,0 @@
---
#
# OpenTracker defaults.
#
opentracker:
user: tracker
home: /var/lib/tracker
repo: /var/lib/tracker/repo
conf: /etc/opentracker

View file

@ -1 +0,0 @@
|1|g3eQLNbOEXgmpTukEKu+dM+7IKs=|XIQfqI0+JM9+Cr3e+6XxuzYbp2k= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAniRprCbiuO7GNUyT6quk6OrA8xFHrSI64jL95T3zw6RhqSkN0OE9CJEpwa9MV3FRk+odeU/WmUDTGNr5LZgqjmK4RtEJAoh8h9hV1/9ZN1ca6HjqQZtWQriR3pk6Qk+BVeo8u0UaTApL52mDHDwX5/G5o7csRuAm7b55/d0qyx5ozLgzAk/anTHSzXKyL8r1ZBUQ+NUBrf70xk2TVEOdKUrwoCuV1eyBf2wzdSaaTh/Zi2w2sDp6ECpmQLQnwg4VyNZk4BNtdLklbzT+j/I5n86+mGf+1NHgMxqGVx50iE+mhg/E6QK+XR3HQ8b2rbBYGI8qv84j1QKhcHhzX5eCIw==

View file

@ -1,11 +0,0 @@
---
#
# OpenTracker handlers.
#
- name: Restart OpenTracker
systemd:
name: opentracker
enabled: yes
daemon_reload: yes
state: restarted

View file

@ -1,31 +0,0 @@
---
#
# Configures OpenTracker.
#
- name: Create config directory
file:
path: "{{ opentracker.conf }}"
state: directory
mode: 0755
- name: Copy config file
template:
src: config
dest: "{{ opentracker.conf }}/config"
mode: 0644
notify: Restart OpenTracker
- name: Copy whitelist file
copy:
src: whitelist
dest: "{{ opentracker.conf }}/whitelist"
mode: 0644
notify: Restart OpenTracker
- name: Install service
template:
src: service
dest: /etc/systemd/system/opentracker.service
mode: 0644
notify: Restart OpenTracker

View file

@ -1,13 +0,0 @@
---
#
# OpenTracker tasks.
#
- name: Prepare system
include: prep.yml
- name: Install OpenTracker
include: make.yml
- name: Configure OpenTracker
include: conf.yml

View file

@ -1,42 +0,0 @@
---
#
# Builds and installs OpenTracker.
#
- name: Clone OpenTracker
git:
repo: git://erdgeist.org/opentracker
dest: "{{ opentracker.repo }}"
force: yes
become: yes
become_user: "{{ opentracker.user }}"
register: result
- name: Build OpenTracker
make:
chdir: "{{ opentracker.repo }}"
target: opentracker
environment:
FEATURES: "-DWANT_ACCESSLIST_WHITE"
become: yes
become_user: "{{ opentracker.user }}"
when: result is changed
- name: Install OpenTracker
copy:
remote_src: yes
src: "{{ opentracker.repo }}/opentracker"
dest: /usr/local/bin/opentracker
mode: 0755
owner: root
group: root
notify: Restart OpenTracker
when: result is changed
- name: Clean OpenTracker
make:
chdir: "{{ opentracker.repo }}"
target: clean
become: yes
become_user: "{{ opentracker.user }}"
when: result is changed

View file

@ -1,46 +0,0 @@
---
#
# Prepares system for OpenTracker.
#
- name: Install build dependencies
apt:
name: "{{ item }}"
state: present
with_items:
- build-essential
- git
- libowfat-dev
- zlib1g-dev
- name: Create UNIX group
group:
name: "{{ opentracker.user }}"
system: yes
state: present
- name: Create UNIX user
user:
name: "{{ opentracker.user }}"
group: "{{ opentracker.user }}"
home: "{{ opentracker.home }}"
createhome: yes
skeleton: yes
system: yes
state: present
- name: Create SSH directory
file:
path: "{{ opentracker.home }}/.ssh"
owner: "{{ opentracker.user }}"
group: "{{ opentracker.user }}"
mode: 0500
state: directory
- name: Configure SSH hosts
copy:
src: known_hosts
dest: "{{ opentracker.home }}/.ssh/known_hosts"
owner: "{{ opentracker.user }}"
group: "{{ opentracker.user }}"
mode: 0400

View file

@ -1,2 +0,0 @@
access.whitelist {{ opentracker.conf }}/whitelist
tracker.redirect_url http://www.fimfarchive.net/

View file

@ -1,14 +0,0 @@
[Unit]
Description=OpenTracker
After=network-online.target
[Service]
Type=simple
User={{ opentracker.user }}
Group={{ opentracker.user }}
WorkingDirectory={{ opentracker.home }}
ExecStart=/usr/local/bin/opentracker -f "{{ opentracker.conf }}/config"
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -1,10 +0,0 @@
---
#
# Configures trackers.
#
- name: Tracker
hosts: trackers
roles:
- common
- opentracker

View file

@ -0,0 +1,14 @@
FROM docker.io/library/debian:bookworm-slim
RUN apt-get -y update \
&& apt-get -y full-upgrade \
&& apt-get -y install opentracker \
&& rm -r /var/lib/apt/lists/*
COPY opentracker.conf whitelist.txt /etc/opentracker/
EXPOSE 6969/tcp
EXPOSE 6969/udp
USER 6969:6969
CMD ["/usr/bin/opentracker", "-f", "/etc/opentracker/opentracker.conf"]

View file

@ -0,0 +1,2 @@
access.whitelist /etc/opentracker/whitelist.txt
tracker.redirect_url http://www.fimfarchive.net/