refactor: restructure inventory, split roles and add new services

This commit is contained in:
2026-09-07 19:50:34 +00:00
parent 33ddc88ee9
commit ba9e1a664f
114 changed files with 1117 additions and 418 deletions
+15
View File
@@ -0,0 +1,15 @@
[Unit]
Description=dayz server
Wants=network.target
After=syslog.target network-online.target
[Service]
Type=simple
Restart=on-failure
RestartSec=10
User=steamcmd
WorkingDirectory=/mnt/steamcmd/dayz
ExecStart=/mnt/steamcmd/dayz/DayZServer -config=serverDZ-custom.cfg -port=2302
[Install]
WantedBy=multi-user.target
+32
View File
@@ -0,0 +1,32 @@
hostname = "oyacoi";
password = "ff32167";
passwordAdmin = "";
description = "";
enableWhitelist = 0;
maxPlayers = 1;
verifySignatures = 2;
forceSameBuild = 1;
disableVoN = 1;
vonCodecQuality = 0;
shardId = "123abc";
disable3rdPerson=1;
disableCrosshair=1;
disablePersonalLight = 1;
lightingConfig = 0;
serverTime="SystemTime";
serverTimeAcceleration=6;
serverNightTimeAcceleration=12;
serverTimePersistent=0;
guaranteedUpdates=1;
loginQueueConcurrentPlayers=5;
loginQueueMaxPlayers=0;
instanceId = 1;
storageAutoFix = 1;
class Missions
{
class DayZ
{
template="dayzOffline.sakhal";
};
};
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
export templdpath=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./linux64:$LD_LIBRARY_PATH
export SteamAppId=892970
echo "Starting server PRESS CTRL-C to exit"
# Tip: Make a local copy of this script to avoid it being overwritten by steam.
# NOTE: Minimum password length is 5 characters & Password cant be in the server name.
# NOTE: You need to make sure the ports 2456-2458 is being forwarded to your server through your local router & firewall.
./valheim_server.x86_64 -name "oyacoi" -port 2456 -world "world0" -password "ff32167" -public 0
export LD_LIBRARY_PATH=$templdpath
+15
View File
@@ -0,0 +1,15 @@
[Unit]
Description=valheim server
Wants=network.target
After=syslog.target network-online.target
[Service]
Type=simple
Restart=on-failure
RestartSec=10
User=steamcmd
WorkingDirectory=/mnt/steamcmd/valheim
ExecStart=/bin/bash /mnt/steamcmd/valheim/start_server-custom.sh
[Install]
WantedBy=multi-user.target
+14
View File
@@ -0,0 +1,14 @@
---
- name: restart valheim
ansible.builtin.systemd:
daemon_reload: true
name: valheim.service
state: restarted
enabled: true
- name: restart dayz
ansible.builtin.systemd:
daemon_reload: true
name: dayz.service
state: restarted
enabled: true
+4
View File
@@ -0,0 +1,4 @@
- name: install package
ansible.builtin.apt:
name: steamcmd
update_cache: true
+23
View File
@@ -0,0 +1,23 @@
- name: check steam session
ansible.builtin.stat:
path: /var/lib/steamcmd/.local/share/Steam/config/config.vdf
register: steam_session
- name: abort if steam authorization is missing
ansible.builtin.fail:
msg: "Manual Steam authorization required. Please log in interactively."
when: not steam_session.stat.exists
- name: install valheim server
ansible.builtin.command:
cmd: su - steamcmd -c "/usr/games/steamcmd +force_install_dir /mnt/steamcmd/valheim +login anonymous +app_update 896660 validate +exit"
register: valheim_result
changed_when: "'downloading' in valheim_result.stdout"
notify: restart valheim
- name: install dayz server
ansible.builtin.command:
cmd: su - steamcmd -c "/usr/games/steamcmd +force_install_dir /mnt/steamcmd/dayz +login gshinzu +app_update 223350 validate +exit"
register: dayz_result
changed_when: "'downloading' in dayz_result.stdout"
notify: restart dayz
+34
View File
@@ -0,0 +1,34 @@
---
- name: deploy start_server.sh
ansible.builtin.copy:
src: start_server.sh
dest: /mnt/steamcmd/valheim/start_server-custom.sh
owner: steamcmd
group: steamcmd
mode: '0775'
- name: deploy valheim.service
ansible.builtin.copy:
src: valheim.service
dest: /etc/systemd/system/valheim.service
owner: root
group: root
mode: '0644'
notify: restart valheim
- name: deploy serverDZ.cfg
ansible.builtin.copy:
src: serverDZ.cfg
dest: /mnt/steamcmd/dayz/serverDZ-custom.cfg
owner: steamcmd
group: steamcmd
mode: '0755'
- name: deploy dayz.service
ansible.builtin.copy:
src: dayz.service
dest: /etc/systemd/system/dayz.service
owner: root
group: root
mode: '0644'
notify: restart dayz
+14
View File
@@ -0,0 +1,14 @@
---
- name: configure debian-unstable.sources
ansible.builtin.deb822_repository:
name: debian-unstable
types: deb
uris: http://deb.debian.org/debian
suites:
- unstable
components:
- contrib
- main
- non-free
signed_by: /usr/share/keyrings/debian-archive-keyring.gpg
state: present
+6
View File
@@ -0,0 +1,6 @@
- name: accept agreement
ansible.builtin.debconf:
name: steamcmd
question: steam/question
vtype: string
value: "I AGREE"
+14
View File
@@ -0,0 +1,14 @@
---
- name: create valheim dir
ansible.builtin.file:
path: /mnt/steamcmd/valheim
owner: steamcmd
group: steamcmd
state: "directory"
- name: create dayz dir
ansible.builtin.file:
path: /mnt/steamcmd/dayz
owner: steamcmd
group: steamcmd
state: "directory"
+10
View File
@@ -0,0 +1,10 @@
---
- name: check if i386 architecture
ansible.builtin.command: dpkg --print-foreign-architectures
register: check_i386
changed_when: false
failed_when: false
- name: add i386 architecture
ansible.builtin.command: dpkg --add-architecture i386
when: "'i386' not in check_i386.stdout"
+21
View File
@@ -0,0 +1,21 @@
---
- name: include deb822
ansible.builtin.include_tasks: deb822.yml
- name: include i386
ansible.builtin.include_tasks: i386.yml
- name: include file
ansible.builtin.include_tasks: file.yml
- name: include debconf
ansible.builtin.include_tasks: debconf.yml
- name: include apt
ansible.builtin.include_tasks: apt.yml
- name: include command
ansible.builtin.include_tasks: command.yml
- name: include copy
ansible.builtin.include_tasks: copy.yml