Initial commit
This commit is contained in:
commit
ea46b13a17
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Binaries
|
||||||
|
/bin
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
/key
|
||||||
|
/key.pub
|
||||||
|
|
||||||
|
# Terraform
|
||||||
|
## Local .terraform directories
|
||||||
|
**/.terraform/*
|
||||||
|
|
||||||
|
## .tfstate files
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.*
|
||||||
|
|
||||||
|
## Crash log files
|
||||||
|
crash.log
|
||||||
|
crash.*.log
|
||||||
|
|
||||||
|
# Ansible
|
||||||
|
venv/
|
158
ansible/main.yml
Normal file
158
ansible/main.yml
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
---
|
||||||
|
# Install required dependancies
|
||||||
|
- hosts: '{{ target | default("all") }}'
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Install aptitude
|
||||||
|
apt: pkg=aptitude state=present update_cache=true
|
||||||
|
|
||||||
|
- name: Configure the package manager to include accommodations for i386 architecture
|
||||||
|
shell: dpkg --add-architecture i386
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: apt update
|
||||||
|
apt: update-cache=yes cache_valid_time=3600
|
||||||
|
retries: 3
|
||||||
|
delay: 1
|
||||||
|
ignore_errors: yes
|
||||||
|
register: apt_updated
|
||||||
|
|
||||||
|
- name: apt safe upgrade
|
||||||
|
apt: upgrade=safe
|
||||||
|
delay: 1
|
||||||
|
ignore_errors: yes
|
||||||
|
register: apt_upgraded
|
||||||
|
|
||||||
|
- name: check if reboot is required
|
||||||
|
stat: path=/var/run/reboot-required
|
||||||
|
register: rb
|
||||||
|
|
||||||
|
- name: Reboot if necessary
|
||||||
|
reboot:
|
||||||
|
reboot_timeout: 3600
|
||||||
|
ignore_errors: true
|
||||||
|
when: rb.stat.exists
|
||||||
|
|
||||||
|
- name: Delete reboot-required file
|
||||||
|
file:
|
||||||
|
path: /var/run/reboot-required
|
||||||
|
state: absent
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Install requisite 32-bit libraries
|
||||||
|
apt:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
state: present
|
||||||
|
update_cache: yes
|
||||||
|
vars:
|
||||||
|
packages:
|
||||||
|
- lib32gcc-s1
|
||||||
|
- netcat
|
||||||
|
|
||||||
|
# Mount data drive
|
||||||
|
- hosts: '{{ target | default("all") }}'
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Create a ext4 filesystem on /dev/vdb and check disk blocks
|
||||||
|
community.general.filesystem:
|
||||||
|
fstype: ext4
|
||||||
|
dev: /dev/vdb
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Mount up device by label
|
||||||
|
ansible.posix.mount:
|
||||||
|
path: /data
|
||||||
|
src: /dev/vdb
|
||||||
|
fstype: ext4
|
||||||
|
state: present
|
||||||
|
|
||||||
|
# Download steamcmd
|
||||||
|
- hosts: '{{ target | default("all") }}'
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
vars:
|
||||||
|
ssh_user: debian
|
||||||
|
url: http://media.steampowered.com/installer/steamcmd_linux.tar.gz
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Sets Steam folder
|
||||||
|
file: path=/data/Steam owner={{ssh_user}} group={{ssh_user}} state=directory mode=0775
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- stat: path=/data/Steam/steamcmd.sh
|
||||||
|
register: steamcmd_dir
|
||||||
|
|
||||||
|
- name: Download SteamCMD
|
||||||
|
get_url:
|
||||||
|
url: "{{url}}"
|
||||||
|
dest: /data/Steam/steamcmd_linux.tar.gz
|
||||||
|
mode: '0664'
|
||||||
|
#when: not steamcmd_dir.stat.exists
|
||||||
|
|
||||||
|
- name: Unarchive SteamCMD
|
||||||
|
unarchive:
|
||||||
|
src: /data/Steam/steamcmd_linux.tar.gz
|
||||||
|
dest: /data/Steam
|
||||||
|
remote_src: yes
|
||||||
|
creates: /data/Steam/steamcmd.sh
|
||||||
|
#when: not steamcmd_dir.stat.exists
|
||||||
|
|
||||||
|
- name: Delete file steamcmd_linux.tar.gz
|
||||||
|
file:
|
||||||
|
path: /data/Steam/steamcmd_linux.tar.gz
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
# SteamCMD game server setup
|
||||||
|
- hosts: '{{ target | default("all") }}'
|
||||||
|
vars:
|
||||||
|
ssh_user: debian
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
become_user: "{{ssh_user}}"
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Sets Steam folder
|
||||||
|
file: path=/data/Steam owner={{ssh_user}} group={{ssh_user}} state=directory mode=0775
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Create game script
|
||||||
|
template: src=static_files/7days.j2 dest=/data/Steam/7days.txt owner={{ssh_user}} group={{ssh_user}} mode=0644
|
||||||
|
|
||||||
|
- name: Run the SteamCMD setup
|
||||||
|
shell: './steamcmd.sh +runscript /data/Steam/7days.txt'
|
||||||
|
args:
|
||||||
|
chdir: /data/Steam/
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: Upload serverconfig.xml
|
||||||
|
copy:
|
||||||
|
src: static_files/serverconfig_3rd.xml
|
||||||
|
dest: /data/Steam/sdtt-server/serverconfig.xml
|
||||||
|
owner: "{{ssh_user}}"
|
||||||
|
group: "{{ssh_user}}"
|
||||||
|
mode: 0644
|
||||||
|
|
||||||
|
# Create game server systemd service
|
||||||
|
- hosts: '{{ target | default("all") }}'
|
||||||
|
vars:
|
||||||
|
ssh_user: debian
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Upload 7days.service
|
||||||
|
template: src=static_files/7days.service.j2 dest=/etc/systemd/system/7days.service owner=root group=root mode=0644
|
||||||
|
ignore_errors: True
|
||||||
|
|
||||||
|
- name: force systemd to reread configs
|
||||||
|
systemd: daemon_reload=yes
|
||||||
|
|
||||||
|
- name: enable 7days.service
|
||||||
|
systemd:
|
||||||
|
name: 7days
|
||||||
|
state: started
|
||||||
|
enabled: True
|
8
ansible/static_files/7days.j2
Normal file
8
ansible/static_files/7days.j2
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// sdtt.txt
|
||||||
|
//
|
||||||
|
@ShutdownOnFailedCommand 1
|
||||||
|
@NoPromptForPassword 1
|
||||||
|
login anonymous
|
||||||
|
force_install_dir ./sdtt-server
|
||||||
|
app_update 294420 validate
|
||||||
|
quit
|
19
ansible/static_files/7days.service.j2
Normal file
19
ansible/static_files/7days.service.j2
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
## /etc/systemd/system/7days.service
|
||||||
|
[Unit]
|
||||||
|
Description=Seven Days To Die Server
|
||||||
|
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User={{ssh_user}}
|
||||||
|
WorkingDirectory=/data/Steam/sdtt-server
|
||||||
|
|
||||||
|
ExecStart=/data/Steam/sdtt-server/startserver.sh -configfile=/data/Steam/sdtt-server/serverconfig.xml
|
||||||
|
|
||||||
|
TimeoutStartSec=infinity
|
||||||
|
Restart=always
|
||||||
|
LimitNOFILE=4096
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
## END OF FILE
|
127
ansible/static_files/serverconfig.xml
Normal file
127
ansible/static_files/serverconfig.xml
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ServerSettings>
|
||||||
|
<!-- GENERAL SERVER SETTINGS -->
|
||||||
|
|
||||||
|
<!-- Server representation -->
|
||||||
|
<property name="ServerName" value="7days of pikami"/> <!-- Whatever you want the name of the server to be. -->
|
||||||
|
<property name="ServerDescription" value="A 7 Days to Die server"/> <!-- Whatever you want the server description to be, will be shown in the server browser. -->
|
||||||
|
<property name="ServerWebsiteURL" value=""/> <!-- Website URL for the server, will be shown in the serverbrowser as a clickable link -->
|
||||||
|
<property name="ServerPassword" value="dongs"/> <!-- Password to gain entry to the server -->
|
||||||
|
<property name="ServerLoginConfirmationText" value="" /> <!-- If set the user will see the message during joining the server and has to confirm it before continuing. For more complex changes to this window you can change the "serverjoinrulesdialog" window in XUi -->
|
||||||
|
|
||||||
|
<!-- Networking -->
|
||||||
|
<property name="ServerPort" value="26900"/> <!-- Port you want the server to listen on. Keep it in the ranges 26900 to 26905 or 27015 to 27020 if you want PCs on the same LAN to find it as a LAN server. -->
|
||||||
|
<property name="ServerVisibility" value="0"/> <!-- Visibility of this server: 2 = public, 1 = only shown to friends, 0 = not listed. As you are never friend of a dedicated server setting this to "1" will only work when the first player connects manually by IP. -->
|
||||||
|
<property name="ServerDisabledNetworkProtocols" value="LiteNetLib"/> <!-- Networking protocols that should not be used. Separated by comma. Possible values: LiteNetLib, SteamNetworking. Dedicated servers should disable SteamNetworking if there is no NAT router in between your users and the server or when port-forwarding is set up correctly -->
|
||||||
|
<property name="ServerMaxWorldTransferSpeedKiBs" value="1300"/> <!-- Maximum (!) speed in kiB/s the world is transferred at to a client on first connect if it does not have the world yet. Maximum is about 1300 kiB/s, even if you set a higher value. -->
|
||||||
|
|
||||||
|
<!-- Slots -->
|
||||||
|
<property name="ServerMaxPlayerCount" value="8"/> <!-- Maximum Concurrent Players -->
|
||||||
|
<property name="ServerReservedSlots" value="0"/> <!-- Out of the MaxPlayerCount this many slots can only be used by players with a specific permission level -->
|
||||||
|
<property name="ServerReservedSlotsPermission" value="100"/> <!-- Required permission level to use reserved slots above -->
|
||||||
|
<property name="ServerAdminSlots" value="0"/> <!-- This many admins can still join even if the server has reached MaxPlayerCount -->
|
||||||
|
<property name="ServerAdminSlotsPermission" value="0"/> <!-- Required permission level to use the admin slots above -->
|
||||||
|
|
||||||
|
<!-- Admin interfaces -->
|
||||||
|
<property name="ControlPanelEnabled" value="false"/> <!-- Enable/Disable the web control panel -->
|
||||||
|
<property name="ControlPanelPort" value="8080"/> <!-- Port of the control panel webpage -->
|
||||||
|
<property name="ControlPanelPassword" value="CHANGEME"/> <!-- Password to gain entry to the control panel -->
|
||||||
|
|
||||||
|
<property name="TelnetEnabled" value="true"/> <!-- Enable/Disable the telnet -->
|
||||||
|
<property name="TelnetPort" value="8081"/> <!-- Port of the telnet server -->
|
||||||
|
<property name="TelnetPassword" value=""/> <!-- Password to gain entry to telnet interface. If no password is set the server will only listen on the local loopback interface -->
|
||||||
|
<property name="TelnetFailedLoginLimit" value="10"/> <!-- After this many wrong passwords from a single remote client the client will be blocked from connecting to the Telnet interface -->
|
||||||
|
<property name="TelnetFailedLoginsBlocktime" value="10"/> <!-- How long will the block persist (in seconds) -->
|
||||||
|
|
||||||
|
<property name="TerminalWindowEnabled" value="true"/> <!-- Show a terminal window for log output / command input (Windows only) -->
|
||||||
|
|
||||||
|
<!-- Folder and file locations -->
|
||||||
|
<property name="AdminFileName" value="serveradmin.xml"/> <!-- Server admin file name. Path relative to the SaveGameFolder -->
|
||||||
|
<!-- <property name="UserDataFolder" value="absolute path"/> --> <!-- Use this to override where the server stores all generated data, including RWG generated worlds. Do not forget to uncomment the entry! -->
|
||||||
|
<property name="SaveGameFolder" value="/data/Saves"/> <!-- Use this to only override the save game path. Do not forget to uncomment the entry! -->
|
||||||
|
|
||||||
|
<!-- Other technical settings -->
|
||||||
|
<property name="EACEnabled" value="false"/> <!-- Enables/Disables EasyAntiCheat -->
|
||||||
|
<property name="HideCommandExecutionLog" value="0"/> <!-- Hide logging of command execution. 0 = show everything, 1 = hide only from Telnet/ControlPanel, 2 = also hide from remote game clients, 3 = hide everything -->
|
||||||
|
<property name="MaxUncoveredMapChunksPerPlayer" value="131072"/> <!-- Override how many chunks can be uncovered on the ingame map by each player. Resulting max map file size limit per player is (x * 512 Bytes), uncovered area is (x * 256 m²). Default 131072 means max 32 km² can be uncovered at any time -->
|
||||||
|
<property name="PersistentPlayerProfiles" value="false" /> <!-- If disabled a player can join with any selected profile. If true they will join with the last profile they joined with -->
|
||||||
|
|
||||||
|
<!-- GAMEPLAY -->
|
||||||
|
|
||||||
|
<!-- World -->
|
||||||
|
<property name="GameWorld" value="PREGEN8k"/> <!-- "RWG" (see WorldGenSeed and WorldGenSize options below) or any already existing world name in the Worlds folder (currently shipping with e.g. "Navezgane", "PREGEN01", ...) -->
|
||||||
|
<property name="WorldGenSeed" value="asdf"/> <!-- If RWG this is the seed for the generation of the new world. If a world with the resulting name already exists it will simply load it -->
|
||||||
|
<property name="WorldGenSize" value="6144"/> <!-- If RWG this controls the width and height of the created world. It is also used in combination with WorldGenSeed to create the internal RWG seed thus also creating a unique map name even if using the same WorldGenSeed. Has to be a multiple of 2048 between 2048 and 16384, though large map sizes will take long to generate / download / load -->
|
||||||
|
<property name="GameName" value="BetterEXP"/> <!-- Whatever you want the game name to be. This affects the save game name as well as the seed used when placing decoration (trees etc) in the world. It does not control the generic layout of the world if creating an RWG world -->
|
||||||
|
<property name="GameMode" value="GameModeSurvival"/> <!-- GameModeSurvival -->
|
||||||
|
|
||||||
|
<!-- Difficulty -->
|
||||||
|
<property name="GameDifficulty" value="2"/> <!-- 0 - 5, 0=easiest, 5=hardest -->
|
||||||
|
<property name="BlockDamagePlayer" value="100" /> <!-- How much damage do players to blocks (percentage in whole numbers) -->
|
||||||
|
<property name="BlockDamageAI" value="100" /> <!-- How much damage do AIs to blocks (percentage in whole numbers) -->
|
||||||
|
<property name="BlockDamageAIBM" value="100" /> <!-- How much damage do AIs during blood moons to blocks (percentage in whole numbers) -->
|
||||||
|
<property name="XPMultiplier" value="300" /> <!-- XP gain multiplier (percentage in whole numbers) -->
|
||||||
|
<property name="PlayerSafeZoneLevel" value="6" /> <!-- If a player is less or equal this level he will create a safe zone (no enemies) when spawned -->
|
||||||
|
<property name="PlayerSafeZoneHours" value="5" /> <!-- Hours in world time this safe zone exists -->
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<property name="BuildCreate" value="false" /> <!-- cheat mode on/off -->
|
||||||
|
<property name="DayNightLength" value="40" /> <!-- real time minutes per in game day: 60 minutes -->
|
||||||
|
<property name="DayLightLength" value="18" /> <!-- in game hours the sun shines per day: 18 hours day light per in game day -->
|
||||||
|
<property name="DropOnDeath" value="3" /> <!-- 0 = nothing, 1 = everything, 2 = toolbelt only, 3 = backpack only, 4 = delete all -->
|
||||||
|
<property name="DropOnQuit" value="0" /> <!-- 0 = nothing, 1 = everything, 2 = toolbelt only, 3 = backpack only -->
|
||||||
|
<property name="BedrollDeadZoneSize" value="15" /> <!-- Size (box "radius", so a box with 2 times the given value for each side's length) of bedroll deadzone, no zombies will spawn inside this area, and any cleared sleeper volumes that touch a bedroll deadzone will not spawn after they've been cleared. -->
|
||||||
|
<property name="BedrollExpiryTime" value="45" /> <!-- Number of real world days a bedroll stays active after owner was last online -->
|
||||||
|
|
||||||
|
<!-- Performance related -->
|
||||||
|
<property name="MaxSpawnedZombies" value="64" /> <!-- This setting covers the entire map. There can only be this many zombies on the entire map at one time. Changing this setting has a huge impact on performance. -->
|
||||||
|
<property name="MaxSpawnedAnimals" value="50" /> <!-- If your server has a large number of players you can increase this limit to add more wildlife. Animals don't consume as much CPU as zombies. NOTE: That this doesn't cause more animals to spawn arbitrarily: The biome spawning system only spawns a certain number of animals in a given area, but if you have lots of players that are all spread out then you may be hitting the limit and can increase it. -->
|
||||||
|
<property name="ServerMaxAllowedViewDistance" value="12" /> <!-- Max viewdistance a client may request (6 - 12). High impact on memory usage and performance. -->
|
||||||
|
|
||||||
|
<!-- Zombie settings -->
|
||||||
|
<property name="EnemySpawnMode" value="true" /> <!-- Enable/Disable enemy spawning -->
|
||||||
|
<property name="EnemyDifficulty" value="0" /> <!-- 0 = Normal, 1 = Feral -->
|
||||||
|
<property name="ZombieFeralSense" value="0" /> <!-- 0-3 (Off, Day, Night, All) -->
|
||||||
|
<property name="ZombieMove" value="0" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="ZombieMoveNight" value="3" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="ZombieFeralMove" value="3" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="ZombieBMMove" value="3" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="BloodMoonFrequency" value="7" /> <!-- What frequency (in days) should a blood moon take place. Set to "0" for no blood moons -->
|
||||||
|
<property name="BloodMoonRange" value="0" /> <!-- How many days can the actual blood moon day randomly deviate from the above setting. Setting this to 0 makes blood moons happen exactly each Nth day as specified in BloodMoonFrequency -->
|
||||||
|
<property name="BloodMoonWarning" value="8" /> <!-- The Hour number that the red day number begins on a blood moon day. Setting this to -1 makes the red never show. -->
|
||||||
|
<property name="BloodMoonEnemyCount" value="6" /> <!-- This is the number of zombies that can be alive (spawned at the same time) at any time PER PLAYER during a blood moon horde, however, MaxSpawnedZombies overrides this number in multiplayer games. Also note that your game stage sets the max number of zombies PER PARTY. Low game stage values can result in lower number of zombies than the BloodMoonEnemyCount setting. Changing this setting has a huge impact on performance. -->
|
||||||
|
|
||||||
|
<!-- Loot -->
|
||||||
|
<property name="LootAbundance" value="100" /> <!-- percentage in whole numbers -->
|
||||||
|
<property name="LootRespawnDays" value="7" /> <!-- days in whole numbers -->
|
||||||
|
<property name="AirDropFrequency" value="72"/> <!-- How often airdrop occur in game-hours, 0 == never -->
|
||||||
|
<property name="AirDropMarker" value="true"/> <!-- Sets if a marker is added to map/compass for air drops. -->
|
||||||
|
|
||||||
|
<!-- Multiplayer -->
|
||||||
|
<property name="PartySharedKillRange" value="1000"/> <!-- The distance you must be within to receive party shared kill xp and quest party kill objective credit. -->
|
||||||
|
<property name="PlayerKillingMode" value="2" /> <!-- Player Killing Settings (0 = No Killing, 1 = Kill Allies Only, 2 = Kill Strangers Only, 3 = Kill Everyone) -->
|
||||||
|
|
||||||
|
<!-- Land claim options -->
|
||||||
|
<property name="LandClaimCount" value="1"/> <!-- Maximum allowed land claims per player. -->
|
||||||
|
<property name="LandClaimSize" value="41"/> <!-- Size in blocks that is protected by a keystone -->
|
||||||
|
<property name="LandClaimDeadZone" value="30"/> <!-- Keystones must be this many blocks apart (unless you are friends with the other player) -->
|
||||||
|
<property name="LandClaimExpiryTime" value="7"/> <!-- The number of real world days a player can be offline before their claims expire and are no longer protected -->
|
||||||
|
<property name="LandClaimDecayMode" value="0"/> <!-- Controls how offline players land claims decay. 0=Slow (Linear) , 1=Fast (Exponential), 2=None (Full protection until claim is expired). -->
|
||||||
|
<property name="LandClaimOnlineDurabilityModifier" value="4"/> <!-- How much protected claim area block hardness is increased when a player is online. 0 means infinite (no damage will ever be taken). Default is 4x -->
|
||||||
|
<property name="LandClaimOfflineDurabilityModifier" value="4"/> <!-- How much protected claim area block hardness is increased when a player is offline. 0 means infinite (no damage will ever be taken). Default is 4x -->
|
||||||
|
<property name="LandClaimOfflineDelay" value="0"/> <!-- The number of minutes after a player logs out that the land claim area hardness transitions from online to offline. Default is 0 -->
|
||||||
|
|
||||||
|
<property name="DynamicMeshEnabled" value="true"/> <!-- Is Dynamic Mesh system enabled -->
|
||||||
|
<property name="DynamicMeshLandClaimOnly" value="true"/> <!-- Is Dynamic Mesh system only active in player LCB areas -->
|
||||||
|
<property name="DynamicMeshLandClaimBuffer" value="3"/> <!-- Dynamic Mesh LCB chunk radius -->
|
||||||
|
<property name="DynamicMeshMaxItemCache" value="3"/> <!-- How many items can be processed concurrently, higher values use more RAM -->
|
||||||
|
|
||||||
|
<property name="TwitchServerPermission" value="90"/> <!-- Required permission level to use twitch integration on the server -->
|
||||||
|
<property name="TwitchBloodMoonAllowed" value="false"/> <!-- If the server allows twitch actions during a blood moon. This could cause server lag with extra zombies being spawned during blood moon. -->
|
||||||
|
|
||||||
|
<!-- There are several game settings that you cannot change when starting a new game.
|
||||||
|
You can use console commands to change at least some of them ingame.
|
||||||
|
setgamepref BedrollDeadZoneSize 30 -->
|
||||||
|
</ServerSettings>
|
||||||
|
|
||||||
|
|
125
ansible/static_files/serverconfig_3rd.xml
Normal file
125
ansible/static_files/serverconfig_3rd.xml
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ServerSettings>
|
||||||
|
<!-- GENERAL SERVER SETTINGS -->
|
||||||
|
|
||||||
|
<!-- Server representation -->
|
||||||
|
<property name="ServerName" value="7days of pikami"/> <!-- Whatever you want the name of the server to be. -->
|
||||||
|
<property name="ServerDescription" value="A 7 Days to Die server"/> <!-- Whatever you want the server description to be, will be shown in the server browser. -->
|
||||||
|
<property name="ServerWebsiteURL" value=""/> <!-- Website URL for the server, will be shown in the serverbrowser as a clickable link -->
|
||||||
|
<property name="ServerPassword" value="dongs"/> <!-- Password to gain entry to the server -->
|
||||||
|
<property name="ServerLoginConfirmationText" value="" /> <!-- If set the user will see the message during joining the server and has to confirm it before continuing. For more complex changes to this window you can change the "serverjoinrulesdialog" window in XUi -->
|
||||||
|
|
||||||
|
<!-- Networking -->
|
||||||
|
<property name="ServerPort" value="26900"/> <!-- Port you want the server to listen on. Keep it in the ranges 26900 to 26905 or 27015 to 27020 if you want PCs on the same LAN to find it as a LAN server. -->
|
||||||
|
<property name="ServerVisibility" value="0"/> <!-- Visibility of this server: 2 = public, 1 = only shown to friends, 0 = not listed. As you are never friend of a dedicated server setting this to "1" will only work when the first player connects manually by IP. -->
|
||||||
|
<property name="ServerDisabledNetworkProtocols" value="LiteNetLib"/> <!-- Networking protocols that should not be used. Separated by comma. Possible values: LiteNetLib, SteamNetworking. Dedicated servers should disable SteamNetworking if there is no NAT router in between your users and the server or when port-forwarding is set up correctly -->
|
||||||
|
<property name="ServerMaxWorldTransferSpeedKiBs" value="1300"/> <!-- Maximum (!) speed in kiB/s the world is transferred at to a client on first connect if it does not have the world yet. Maximum is about 1300 kiB/s, even if you set a higher value. -->
|
||||||
|
|
||||||
|
<!-- Slots -->
|
||||||
|
<property name="ServerMaxPlayerCount" value="8"/> <!-- Maximum Concurrent Players -->
|
||||||
|
<property name="ServerReservedSlots" value="0"/> <!-- Out of the MaxPlayerCount this many slots can only be used by players with a specific permission level -->
|
||||||
|
<property name="ServerReservedSlotsPermission" value="100"/> <!-- Required permission level to use reserved slots above -->
|
||||||
|
<property name="ServerAdminSlots" value="0"/> <!-- This many admins can still join even if the server has reached MaxPlayerCount -->
|
||||||
|
<property name="ServerAdminSlotsPermission" value="0"/> <!-- Required permission level to use the admin slots above -->
|
||||||
|
|
||||||
|
<!-- Admin interfaces -->
|
||||||
|
<property name="ControlPanelEnabled" value="false"/> <!-- Enable/Disable the web control panel -->
|
||||||
|
<property name="ControlPanelPort" value="8080"/> <!-- Port of the control panel webpage -->
|
||||||
|
<property name="ControlPanelPassword" value="CHANGEME"/> <!-- Password to gain entry to the control panel -->
|
||||||
|
|
||||||
|
<property name="TelnetEnabled" value="true"/> <!-- Enable/Disable the telnet -->
|
||||||
|
<property name="TelnetPort" value="8081"/> <!-- Port of the telnet server -->
|
||||||
|
<property name="TelnetPassword" value=""/> <!-- Password to gain entry to telnet interface. If no password is set the server will only listen on the local loopback interface -->
|
||||||
|
<property name="TelnetFailedLoginLimit" value="10"/> <!-- After this many wrong passwords from a single remote client the client will be blocked from connecting to the Telnet interface -->
|
||||||
|
<property name="TelnetFailedLoginsBlocktime" value="10"/> <!-- How long will the block persist (in seconds) -->
|
||||||
|
|
||||||
|
<property name="TerminalWindowEnabled" value="true"/> <!-- Show a terminal window for log output / command input (Windows only) -->
|
||||||
|
|
||||||
|
<!-- Folder and file locations -->
|
||||||
|
<property name="AdminFileName" value="serveradmin.xml"/> <!-- Server admin file name. Path relative to the SaveGameFolder -->
|
||||||
|
<!-- <property name="UserDataFolder" value="absolute path"/> --> <!-- Use this to override where the server stores all generated data, including RWG generated worlds. Do not forget to uncomment the entry! -->
|
||||||
|
<property name="SaveGameFolder" value="/data/Saves"/> <!-- Use this to only override the save game path. Do not forget to uncomment the entry! -->
|
||||||
|
|
||||||
|
<!-- Other technical settings -->
|
||||||
|
<property name="EACEnabled" value="false"/> <!-- Enables/Disables EasyAntiCheat -->
|
||||||
|
<property name="HideCommandExecutionLog" value="0"/> <!-- Hide logging of command execution. 0 = show everything, 1 = hide only from Telnet/ControlPanel, 2 = also hide from remote game clients, 3 = hide everything -->
|
||||||
|
<property name="MaxUncoveredMapChunksPerPlayer" value="131072"/> <!-- Override how many chunks can be uncovered on the ingame map by each player. Resulting max map file size limit per player is (x * 512 Bytes), uncovered area is (x * 256 m²). Default 131072 means max 32 km² can be uncovered at any time -->
|
||||||
|
<property name="PersistentPlayerProfiles" value="false" /> <!-- If disabled a player can join with any selected profile. If true they will join with the last profile they joined with -->
|
||||||
|
|
||||||
|
<!-- GAMEPLAY -->
|
||||||
|
|
||||||
|
<!-- World -->
|
||||||
|
<property name="GameWorld" value="Navezgane"/> <!-- "RWG" (see WorldGenSeed and WorldGenSize options below) or any already existing world name in the Worlds folder (currently shipping with e.g. "Navezgane", "PREGEN01", ...) -->
|
||||||
|
<property name="WorldGenSeed" value="asdf"/> <!-- If RWG this is the seed for the generation of the new world. If a world with the resulting name already exists it will simply load it -->
|
||||||
|
<property name="WorldGenSize" value="6144"/> <!-- If RWG this controls the width and height of the created world. It is also used in combination with WorldGenSeed to create the internal RWG seed thus also creating a unique map name even if using the same WorldGenSeed. Has to be a multiple of 2048 between 2048 and 16384, though large map sizes will take long to generate / download / load -->
|
||||||
|
<property name="GameName" value="The3rd"/> <!-- Whatever you want the game name to be. This affects the save game name as well as the seed used when placing decoration (trees etc) in the world. It does not control the generic layout of the world if creating an RWG world -->
|
||||||
|
<property name="GameMode" value="GameModeSurvival"/> <!-- GameModeSurvival -->
|
||||||
|
|
||||||
|
<!-- Difficulty -->
|
||||||
|
<property name="GameDifficulty" value="2"/> <!-- 0 - 5, 0=easiest, 5=hardest -->
|
||||||
|
<property name="BlockDamagePlayer" value="100" /> <!-- How much damage do players to blocks (percentage in whole numbers) -->
|
||||||
|
<property name="BlockDamageAI" value="100" /> <!-- How much damage do AIs to blocks (percentage in whole numbers) -->
|
||||||
|
<property name="BlockDamageAIBM" value="100" /> <!-- How much damage do AIs during blood moons to blocks (percentage in whole numbers) -->
|
||||||
|
<property name="XPMultiplier" value="300" /> <!-- XP gain multiplier (percentage in whole numbers) -->
|
||||||
|
<property name="PlayerSafeZoneLevel" value="6" /> <!-- If a player is less or equal this level he will create a safe zone (no enemies) when spawned -->
|
||||||
|
<property name="PlayerSafeZoneHours" value="5" /> <!-- Hours in world time this safe zone exists -->
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<property name="BuildCreate" value="false" /> <!-- cheat mode on/off -->
|
||||||
|
<property name="DayNightLength" value="40" /> <!-- real time minutes per in game day: 60 minutes -->
|
||||||
|
<property name="DayLightLength" value="18" /> <!-- in game hours the sun shines per day: 18 hours day light per in game day -->
|
||||||
|
<property name="DropOnDeath" value="3" /> <!-- 0 = nothing, 1 = everything, 2 = toolbelt only, 3 = backpack only, 4 = delete all -->
|
||||||
|
<property name="DropOnQuit" value="0" /> <!-- 0 = nothing, 1 = everything, 2 = toolbelt only, 3 = backpack only -->
|
||||||
|
<property name="BedrollDeadZoneSize" value="15" /> <!-- Size (box "radius", so a box with 2 times the given value for each side's length) of bedroll deadzone, no zombies will spawn inside this area, and any cleared sleeper volumes that touch a bedroll deadzone will not spawn after they've been cleared. -->
|
||||||
|
<property name="BedrollExpiryTime" value="45" /> <!-- Number of real world days a bedroll stays active after owner was last online -->
|
||||||
|
|
||||||
|
<!-- Performance related -->
|
||||||
|
<property name="MaxSpawnedZombies" value="64" /> <!-- This setting covers the entire map. There can only be this many zombies on the entire map at one time. Changing this setting has a huge impact on performance. -->
|
||||||
|
<property name="MaxSpawnedAnimals" value="50" /> <!-- If your server has a large number of players you can increase this limit to add more wildlife. Animals don't consume as much CPU as zombies. NOTE: That this doesn't cause more animals to spawn arbitrarily: The biome spawning system only spawns a certain number of animals in a given area, but if you have lots of players that are all spread out then you may be hitting the limit and can increase it. -->
|
||||||
|
<property name="ServerMaxAllowedViewDistance" value="12" /> <!-- Max viewdistance a client may request (6 - 12). High impact on memory usage and performance. -->
|
||||||
|
|
||||||
|
<!-- Zombie settings -->
|
||||||
|
<property name="EnemySpawnMode" value="true" /> <!-- Enable/Disable enemy spawning -->
|
||||||
|
<property name="EnemyDifficulty" value="0" /> <!-- 0 = Normal, 1 = Feral -->
|
||||||
|
<property name="ZombieFeralSense" value="0" /> <!-- 0-3 (Off, Day, Night, All) -->
|
||||||
|
<property name="ZombieMove" value="0" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="ZombieMoveNight" value="3" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="ZombieFeralMove" value="3" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="ZombieBMMove" value="3" /> <!-- 0-4 (walk, jog, run, sprint, nightmare) -->
|
||||||
|
<property name="BloodMoonFrequency" value="7" /> <!-- What frequency (in days) should a blood moon take place. Set to "0" for no blood moons -->
|
||||||
|
<property name="BloodMoonRange" value="0" /> <!-- How many days can the actual blood moon day randomly deviate from the above setting. Setting this to 0 makes blood moons happen exactly each Nth day as specified in BloodMoonFrequency -->
|
||||||
|
<property name="BloodMoonWarning" value="8" /> <!-- The Hour number that the red day number begins on a blood moon day. Setting this to -1 makes the red never show. -->
|
||||||
|
<property name="BloodMoonEnemyCount" value="6" /> <!-- This is the number of zombies that can be alive (spawned at the same time) at any time PER PLAYER during a blood moon horde, however, MaxSpawnedZombies overrides this number in multiplayer games. Also note that your game stage sets the max number of zombies PER PARTY. Low game stage values can result in lower number of zombies than the BloodMoonEnemyCount setting. Changing this setting has a huge impact on performance. -->
|
||||||
|
|
||||||
|
<!-- Loot -->
|
||||||
|
<property name="LootAbundance" value="100" /> <!-- percentage in whole numbers -->
|
||||||
|
<property name="LootRespawnDays" value="7" /> <!-- days in whole numbers -->
|
||||||
|
<property name="AirDropFrequency" value="72"/> <!-- How often airdrop occur in game-hours, 0 == never -->
|
||||||
|
<property name="AirDropMarker" value="true"/> <!-- Sets if a marker is added to map/compass for air drops. -->
|
||||||
|
|
||||||
|
<!-- Multiplayer -->
|
||||||
|
<property name="PartySharedKillRange" value="1000"/> <!-- The distance you must be within to receive party shared kill xp and quest party kill objective credit. -->
|
||||||
|
<property name="PlayerKillingMode" value="2" /> <!-- Player Killing Settings (0 = No Killing, 1 = Kill Allies Only, 2 = Kill Strangers Only, 3 = Kill Everyone) -->
|
||||||
|
|
||||||
|
<!-- Land claim options -->
|
||||||
|
<property name="LandClaimCount" value="1"/> <!-- Maximum allowed land claims per player. -->
|
||||||
|
<property name="LandClaimSize" value="41"/> <!-- Size in blocks that is protected by a keystone -->
|
||||||
|
<property name="LandClaimDeadZone" value="30"/> <!-- Keystones must be this many blocks apart (unless you are friends with the other player) -->
|
||||||
|
<property name="LandClaimExpiryTime" value="7"/> <!-- The number of real world days a player can be offline before their claims expire and are no longer protected -->
|
||||||
|
<property name="LandClaimDecayMode" value="0"/> <!-- Controls how offline players land claims decay. 0=Slow (Linear) , 1=Fast (Exponential), 2=None (Full protection until claim is expired). -->
|
||||||
|
<property name="LandClaimOnlineDurabilityModifier" value="4"/> <!-- How much protected claim area block hardness is increased when a player is online. 0 means infinite (no damage will ever be taken). Default is 4x -->
|
||||||
|
<property name="LandClaimOfflineDurabilityModifier" value="4"/> <!-- How much protected claim area block hardness is increased when a player is offline. 0 means infinite (no damage will ever be taken). Default is 4x -->
|
||||||
|
<property name="LandClaimOfflineDelay" value="0"/> <!-- The number of minutes after a player logs out that the land claim area hardness transitions from online to offline. Default is 0 -->
|
||||||
|
|
||||||
|
<property name="DynamicMeshEnabled" value="true"/> <!-- Is Dynamic Mesh system enabled -->
|
||||||
|
<property name="DynamicMeshLandClaimOnly" value="true"/> <!-- Is Dynamic Mesh system only active in player LCB areas -->
|
||||||
|
<property name="DynamicMeshLandClaimBuffer" value="3"/> <!-- Dynamic Mesh LCB chunk radius -->
|
||||||
|
<property name="DynamicMeshMaxItemCache" value="3"/> <!-- How many items can be processed concurrently, higher values use more RAM -->
|
||||||
|
|
||||||
|
<property name="TwitchServerPermission" value="90"/> <!-- Required permission level to use twitch integration on the server -->
|
||||||
|
<property name="TwitchBloodMoonAllowed" value="false"/> <!-- If the server allows twitch actions during a blood moon. This could cause server lag with extra zombies being spawned during blood moon. -->
|
||||||
|
|
||||||
|
<!-- There are several game settings that you cannot change when starting a new game.
|
||||||
|
You can use console commands to change at least some of them ingame.
|
||||||
|
setgamepref BedrollDeadZoneSize 30 -->
|
||||||
|
</ServerSettings>
|
28
ansible/stop.yml
Normal file
28
ansible/stop.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
- hosts: '{{ target | default("all") }}'
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Save world
|
||||||
|
ansible.builtin.command: echo "saveworld" | nc -w 5 localhost 8081
|
||||||
|
|
||||||
|
- name: Shutdown server
|
||||||
|
ansible.builtin.command: echo "shutdown" | nc -w 5 localhost 8081
|
||||||
|
|
||||||
|
- name: Stop service
|
||||||
|
ansible.builtin.service:
|
||||||
|
name: 7days
|
||||||
|
state: stopped
|
||||||
|
|
||||||
|
- name: Create a directory if it does not exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /data/backup
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Make save backup
|
||||||
|
community.general.archive:
|
||||||
|
path: /data/Saves
|
||||||
|
dest: /data/backup/{{ ansible_date_time.date }}_{{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}.tar.gz
|
||||||
|
format: gz
|
24
down.sh
Normal file
24
down.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TERRAFORM_DIR="terraform_pl"
|
||||||
|
|
||||||
|
# Get server IP
|
||||||
|
SERVER_IP=$(bin/terraform -chdir=$TERRAFORM_DIR output public_ip | tr -d '"')
|
||||||
|
|
||||||
|
# Run ansible stop.xml playbook
|
||||||
|
VENV_NAME="./venv"
|
||||||
|
|
||||||
|
if [ -d "$VENV_NAME" ]
|
||||||
|
then
|
||||||
|
source "$VENV_NAME/bin/activate"
|
||||||
|
(cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root -i "$SERVER_IP," --private-key ~/sdtt/key -e 'pub_key=~/sdtt/key.pub' stop.yml)
|
||||||
|
deactivate
|
||||||
|
else
|
||||||
|
echo "Could not find venv directory."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Destroy resources
|
||||||
|
|
||||||
|
bin/terraform -chdir=$TERRAFORM_DIR destroy -auto-approve -target scaleway_instance_server.instance_server
|
||||||
|
bin/terraform -chdir=$TERRAFORM_DIR destroy -auto-approve -target scaleway_instance_security_group.security_group
|
||||||
|
bin/terraform -chdir=$TERRAFORM_DIR destroy -auto-approve -target scaleway_instance_ip.public_ip
|
31
setup_environment.sh
Normal file
31
setup_environment.sh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
sudo apt -y install wget unzip python3 python3-venv
|
||||||
|
|
||||||
|
# Download terraform
|
||||||
|
if [ -d "./bin" ]
|
||||||
|
then
|
||||||
|
echo "Found bin directory."
|
||||||
|
else
|
||||||
|
wget https://releases.hashicorp.com/terraform/1.1.3/terraform_1.1.3_linux_amd64.zip
|
||||||
|
unzip terraform_1.1.3_linux_amd64.zip -d ./bin
|
||||||
|
rm terraform_1.1.3_linux_amd64.zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize terraform
|
||||||
|
bin/terraform -chdir=terraform_pl init
|
||||||
|
|
||||||
|
# Create ansible venv for python
|
||||||
|
VENV_NAME="./venv"
|
||||||
|
|
||||||
|
if [ -d "$VENV_NAME" ]
|
||||||
|
then
|
||||||
|
echo "Found venv directory."
|
||||||
|
else
|
||||||
|
echo "Creating venv..."
|
||||||
|
python3 -m venv "$VENV_NAME"
|
||||||
|
source "$VENV_NAME/bin/activate"
|
||||||
|
pip3 install ansible
|
||||||
|
deactivate
|
||||||
|
fi
|
24
terraform_pl/.terraform.lock.hcl
generated
Normal file
24
terraform_pl/.terraform.lock.hcl
generated
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/scaleway/scaleway" {
|
||||||
|
version = "2.2.0"
|
||||||
|
hashes = [
|
||||||
|
"h1:4+BjCUfLPVaSe1tiAECUHv6gIEpu+CeLzeawsegB7ww=",
|
||||||
|
"h1:4M58uMZHO9fYFPBug868UjaDo+EutwtEGSsCHi4E3UM=",
|
||||||
|
"zh:016486d3e448630e29595412b8d31c8a3b2cec83fa531a86ef3d3858f6ebe45d",
|
||||||
|
"zh:0ae1eb5142f866da8849475d976da21a2f7cc905f37c99e7aef810c3369e0f65",
|
||||||
|
"zh:0c2c8bd7b8beb49d6320cbb4dfba647a465dc1d0f3583b01ad7f0b0559cc043a",
|
||||||
|
"zh:1a2ddae054c2e21db960d25432406f01ac0aca7529838176c11a892f62987a8f",
|
||||||
|
"zh:211c92dd31513b06d679f1d9d85ed39911ee32a5c03a2af93e7a5710cb6d0a64",
|
||||||
|
"zh:76ae419f8ebdc39236c14f87b6c03c9b1f2c6f60081fec48d7d3531cadafcdbe",
|
||||||
|
"zh:8a951e6fb2c329d0095edb607e5c760c47838956d7b0a75111692bd77158a445",
|
||||||
|
"zh:9ff0638bd03a39aacf331912ff1547d31c5a5a3e1961bf3ca50a581ae2bf0cba",
|
||||||
|
"zh:a3ece235aefa0a3110ecae34304122fe32a566a9d54123593e9434693b03d764",
|
||||||
|
"zh:a47f101c77be03df35179474110ab05397693ce7efb74c5a133ae3cb0041bb88",
|
||||||
|
"zh:a69562aaf71b7ef7b2c8ef345637a3309762f45d960560453595ea2ec2cb0e2c",
|
||||||
|
"zh:aa4b8699e888b08905271a6a2c5da206ac737742b8a947a1d9ed53c875954cd5",
|
||||||
|
"zh:abb3e3e235b4862ead53397dd09be40c91910931a993b9415185ea6e8492fdb4",
|
||||||
|
"zh:e772b6ccb6d70a2d610c696185d3411548c73ad6e10870f70921021134ef1e67",
|
||||||
|
]
|
||||||
|
}
|
105
terraform_pl/main.tf
Normal file
105
terraform_pl/main.tf
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
scaleway = {
|
||||||
|
source = "scaleway/scaleway"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
required_version = ">= 0.13"
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "scaleway" {
|
||||||
|
zone = var.zone
|
||||||
|
region = var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "scaleway_instance_ip" "public_ip" {
|
||||||
|
project_id = var.project_id
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "scaleway_instance_volume" "volume" {
|
||||||
|
name = "v7days"
|
||||||
|
project_id = var.project_id
|
||||||
|
size_in_gb = var.data_volume_size
|
||||||
|
type = "l_ssd"
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
prevent_destroy = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "scaleway_instance_security_group" "security_group" {
|
||||||
|
name = "sg7daysPL"
|
||||||
|
project_id = var.project_id
|
||||||
|
inbound_default_policy = "drop"
|
||||||
|
outbound_default_policy = "accept"
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "22"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "80"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "443"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "26900"
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "26900"
|
||||||
|
protocol = "UDP"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "26901"
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "26901"
|
||||||
|
protocol = "UDP"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "26902"
|
||||||
|
protocol = "TCP"
|
||||||
|
}
|
||||||
|
|
||||||
|
inbound_rule {
|
||||||
|
action = "accept"
|
||||||
|
port = "26902"
|
||||||
|
protocol = "UDP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "scaleway_instance_server" "instance_server" {
|
||||||
|
name = "i7daysPL"
|
||||||
|
project_id = var.project_id
|
||||||
|
type = var.instance_type
|
||||||
|
image = var.instance_image
|
||||||
|
|
||||||
|
tags = ["game", "terraform"]
|
||||||
|
|
||||||
|
ip_id = scaleway_instance_ip.public_ip.id
|
||||||
|
|
||||||
|
additional_volume_ids = [scaleway_instance_volume.volume.id]
|
||||||
|
|
||||||
|
root_volume {
|
||||||
|
size_in_gb = var.instance_volume_size
|
||||||
|
}
|
||||||
|
|
||||||
|
security_group_id = scaleway_instance_security_group.security_group.id
|
||||||
|
}
|
4
terraform_pl/outputs.tf
Normal file
4
terraform_pl/outputs.tf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
output "public_ip" {
|
||||||
|
description = "The public IP of the i7days server"
|
||||||
|
value = scaleway_instance_ip.public_ip.address
|
||||||
|
}
|
40
terraform_pl/variables.tf
Normal file
40
terraform_pl/variables.tf
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
variable "project_id" {
|
||||||
|
type = string
|
||||||
|
default = "d8504e56-fd7e-4640-9308-6d95e8406c7e"
|
||||||
|
description = "Project id"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "region" {
|
||||||
|
description = "The region to create things in."
|
||||||
|
default = "pl-waw"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "zone" {
|
||||||
|
description = "The zone to create things in."
|
||||||
|
default = "pl-waw-1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Data volume configuration
|
||||||
|
variable "data_volume_size" {
|
||||||
|
description = "Size of data volume"
|
||||||
|
default = 50
|
||||||
|
}
|
||||||
|
|
||||||
|
# Instance configuration
|
||||||
|
variable "instance_type" {
|
||||||
|
description = "Instance type to create."
|
||||||
|
default = "GP1-XS"
|
||||||
|
#default = "DEV1-L"
|
||||||
|
#default = "DEV1-XL"
|
||||||
|
#default = "DEV1-S"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "instance_image" {
|
||||||
|
description = "Instance image to use."
|
||||||
|
default = "debian_bullseye"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "instance_volume_size" {
|
||||||
|
description = "Instance type to create."
|
||||||
|
default = 100
|
||||||
|
}
|
24
up.sh
Normal file
24
up.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TERRAFORM_DIR="terraform_pl"
|
||||||
|
|
||||||
|
# Create resources
|
||||||
|
bin/terraform -chdir=$TERRAFORM_DIR apply -auto-approve
|
||||||
|
|
||||||
|
# Get server IP
|
||||||
|
SERVER_IP=$(bin/terraform -chdir=$TERRAFORM_DIR output public_ip | tr -d '"')
|
||||||
|
|
||||||
|
# Sleep for 30s (Usually terraform finishes before server boot)
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
# Run ansible stop.xml playbook
|
||||||
|
VENV_NAME="./venv"
|
||||||
|
|
||||||
|
if [ -d "$VENV_NAME" ]
|
||||||
|
then
|
||||||
|
source "$VENV_NAME/bin/activate"
|
||||||
|
(cd ansible && ANSIBLE_HOST_KEY_CHECKING=False ANSIBLE_NOCOWS=1 ansible-playbook -u root -i "$SERVER_IP," --private-key ~/sdtt/key -e 'pub_key=~/sdtt/key.pub' main.yml)
|
||||||
|
deactivate
|
||||||
|
else
|
||||||
|
echo "Could not find venv directory."
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user