mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-22 05:17:59 +01:00
Add Ansible role for OpenTracker
This commit is contained in:
parent
c3dd45ed82
commit
ffceddedb3
11 changed files with 195 additions and 0 deletions
10
operations/opentracker/defaults/main.yml
Normal file
10
operations/opentracker/defaults/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
#
|
||||
# OpenTracker defaults.
|
||||
#
|
||||
|
||||
opentracker:
|
||||
user: tracker
|
||||
home: /var/lib/tracker
|
||||
repo: /var/lib/tracker/repo
|
||||
conf: /etc/opentracker
|
1
operations/opentracker/files/known_hosts
Normal file
1
operations/opentracker/files/known_hosts
Normal file
|
@ -0,0 +1 @@
|
|||
|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==
|
26
operations/opentracker/files/whitelist
Normal file
26
operations/opentracker/files/whitelist
Normal file
|
@ -0,0 +1,26 @@
|
|||
0f551b756aca80513dc6e7cad16436ff3b672c89
|
||||
25c7ede4f78672f627a697b14e0c34c3f77cbecb
|
||||
2f8055a042556f5dd71eb2d7b168e25429da5c89
|
||||
4fcdc8d87d8cad6f0e3d9e34d273f672bdbbf791
|
||||
5220e682c8b8e2c1de5de1618121f86a897b3897
|
||||
558ab9ad2acb5b5c808737eea548e3e04256d5a6
|
||||
5638b744a69a8181489d48464e2deac16339fb81
|
||||
698a6c7ace63ea126039127a868e8066a77b173b
|
||||
71875b5d4cb7fd3d6849b7eff922178147f62de9
|
||||
7b3b7c967596b443a45ab13432e92fd3e35bb440
|
||||
7eebe9c650bc9c57664849ba65f8056e0cd69661
|
||||
81dc470986a2776b70ebf2c92f4812bbfa202a40
|
||||
82557e5e1dea61b470d9a65e94ffbe53cecd9f43
|
||||
834620626e594a3268f7708afae0ef51ba368752
|
||||
9a2da0808262d130556ede7e45904e614b124d73
|
||||
a21b5051ec22ed64fb180d3abb5b4a4cb9ece3de
|
||||
aac951bc59cbfbea3cb557a7c8585a82c367529a
|
||||
b7d75c6dfea294ac1e8521701b36bb87f3314066
|
||||
bbac0709dbe0e31fb7c2f63913240debce495fc0
|
||||
bbcf64ca21534a74fe4d4118c2efab13eb834e26
|
||||
c283bf37bc1284214cab01d8e84fc211143d7a25
|
||||
d3af40550af57d9a151aa138fa513942b195232a
|
||||
d684d814af85c3eae13a083e8c92b97b6f86e03d
|
||||
e877d26b8853bbb308529c4f1fd6c76e7e2099f7
|
||||
f3fc9ad2270605042ff6a598e8bd9b75d8690d35
|
||||
fd4ab37e04bf28b889132e72927d6620b53a3866
|
10
operations/opentracker/handlers/main.yml
Normal file
10
operations/opentracker/handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
#
|
||||
# OpenTracker handlers.
|
||||
#
|
||||
|
||||
- name: Restart OpenTracker
|
||||
service:
|
||||
name: opentracker
|
||||
enabled: yes
|
||||
state: restarted
|
31
operations/opentracker/tasks/conf.yml
Normal file
31
operations/opentracker/tasks/conf.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
#
|
||||
# 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
|
13
operations/opentracker/tasks/main.yml
Normal file
13
operations/opentracker/tasks/main.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
#
|
||||
# OpenTracker tasks.
|
||||
#
|
||||
|
||||
- name: Prepare system
|
||||
include: prep.yml
|
||||
|
||||
- name: Install OpenTracker
|
||||
include: make.yml
|
||||
|
||||
- name: Configure OpenTracker
|
||||
include: conf.yml
|
42
operations/opentracker/tasks/make.yml
Normal file
42
operations/opentracker/tasks/make.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
#
|
||||
# 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 | 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 | changed
|
||||
|
||||
- name: Clean OpenTracker
|
||||
make:
|
||||
chdir: "{{ opentracker.repo }}"
|
||||
target: clean
|
||||
become: yes
|
||||
become_user: "{{ opentracker.user }}"
|
||||
when: result | changed
|
46
operations/opentracker/tasks/prep.yml
Normal file
46
operations/opentracker/tasks/prep.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
#
|
||||
# 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
|
2
operations/opentracker/templates/config
Normal file
2
operations/opentracker/templates/config
Normal file
|
@ -0,0 +1,2 @@
|
|||
access.whitelist {{ opentracker.conf }}/whitelist
|
||||
tracker.redirect_url http://www.fimfarchive.net/
|
13
operations/opentracker/templates/service
Normal file
13
operations/opentracker/templates/service
Normal file
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=OpenTracker
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ opentracker.user }}
|
||||
WorkingDirectory={{ opentracker.conf }}
|
||||
ExecStart=/usr/local/bin/opentracker -f "{{ opentracker.conf }}/config"
|
||||
Restart=on-abort
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -7,3 +7,4 @@
|
|||
hosts: trackers
|
||||
roles:
|
||||
- common
|
||||
- opentracker
|
||||
|
|
Loading…
Reference in a new issue