Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
leorog committed Feb 2, 2020
0 parents commit d0266e2
Show file tree
Hide file tree
Showing 24 changed files with 731 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
#
# example.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

terraform/*.log
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Leo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# CSGO Dedicated Server

### Using this repo

Pick one user-data:

- [dm](terraform/user-data/dm.yml)
- [retakes](terraform/user-data/retakes.yml)
- [executes](terraform/user-data/executes.yml)

Replace user-data variables:

1) \_SSH_KEY\_ the admin ssh public key
2) \_GSLT\_ the game server login token, see: https://steamcommunity.com/dev/managegameservers
3) \_RCON\_ the remote connnection secret (for ingame console commands `rcon_password _RCON_; rcon mp_roundrestart 1`)

Create an instance on any [cloud-init supported cloud](https://cloudinit.readthedocs.io/en/latest/topics/availability.html#clouds)

Ports:
- 27015/udp linuxgsm
- 27005/udp linuxgsm
- 27020/udp linuxgsm
- 19999/tcp netdata
- 22/tcp ssh
- 80/tcp outbound
- 443/tcp outbound

or setup with [terraform](terraform/README.md)
5 changes: 5 additions & 0 deletions deathmatch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: all
roles:
- install-gameserver
- install-netdata
- config-dm-mode
5 changes: 5 additions & 0 deletions executes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: all
roles:
- install-gameserver
- install-netdata
- config-execute-mode
5 changes: 5 additions & 0 deletions retakes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: all
roles:
- install-gameserver
- install-netdata
- config-retake-mode
28 changes: 28 additions & 0 deletions roles/config-dm-mode/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- name: read env from from /etc/default/linuxgsm
include_vars:
file: /etc/default/linuxgsm
name: env

- name: download dm mode
git:
version: development
repo: "https://github.com/Maxximou5/csgo-deathmatch.git"
dest: /tmp/csgo-deathmatch

- name: install dm mode
synchronize:
src: "/tmp/csgo-deathmatch/{{ item }}"
dest: ~/serverfiles/csgo/addons/sourcemod/
delegate_to: localhost
with_items:
- configs
- translations
- plugins
- scripting

- name: configure dm mode
template:
src: dm.cfg.j2
dest: ~/serverfiles/csgo/cfg/csgoserver.cfg
notify: restart_server

37 changes: 37 additions & 0 deletions roles/config-dm-mode/templates/dm.cfg.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
dm_enabled 1
dm_headshot_only "{{ dm_headshot_only }}"
dm_ap_messages "{{ dm_ap_messages }}"
dm_hp_messages "{{ dm_hp_messages }}"
dm_welcomemsg "{{ dm_welcomemsg }}"
dm_valve_deathmatch "{{ dm_valve_deathmatch }}"
dm_free_for_all "{{ dm_free_for_all }}"
dm_hide_radar "{{ dm_hide_radar }}"
dm_display_panel "{{ dm_display_panel }}"
dm_display_panel_damage "{{ dm_display_panel_damage }}"
dm_sounds_bodyshots "{{ dm_sounds_bodyshots }}"
dm_sounds_headshots "{{ dm_sounds_headshots }}"
dm_remove_objectives "{{ dm_remove_objectives }}"
dm_respawning "{{ dm_respawning }}"
dm_respawn_time "{{ dm_respawn_time }}".1
dm_gun_menu_mode "{{ dm_gun_menu_mode }}"
dm_los_spawning "{{ dm_los_spawning }}"
dm_los_attempts "{{ dm_los_attempts }}"
dm_spawn_distance "{{ dm_spawn_distance }}"
dm_spawn_protection_time "{{ dm_spawn_protection_time }}"
dm_loadout_style "{{ dm_loadout_style }}"
dm_fast_equip "{{ dm_fast_equip }}"
dm_no_knife_damage "{{ dm_no_knife_damage }}"
dm_remove_weapons "{{ dm_remove_weapons }}"
dm_replenish_ammo_empty "{{ dm_replenish_ammo_empty }}"
dm_replenish_ammo_reload "{{ dm_replenish_ammo_reload }}"
dm_replenish_ammo_kill "{{ dm_replenish_ammo_kill }}"
dm_replenish_ammo_type "{{ dm_replenish_ammo_type }}"
dm_replenish_grenade "{{ dm_replenish_grenade }}"
dm_replenish_hegrenade "{{ dm_replenish_hegrenade }}"
dm_replenish_grenade_kill "{{ dm_replenish_grenade_kill }}"
dm_hp_kill "{{ dm_hp_kill }}"
dm_hp_headshot "{{ dm_hp_headshot }}"
dm_ap_kill "{{ dm_ap_kill }}"
dm_ap_headshot "{{ dm_ap_headshot }}"
dm_armor_full "{{ dm_armor_full }}"
dm_armor "{{ dm_armor }}"
10 changes: 10 additions & 0 deletions roles/config-execute-mode/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: install executes mode
unarchive:
src: "https://ci.splewis.net/job/csgo-executes/lastSuccessfulBuild/artifact/builds/executes-release/executes-44.zip"
remote_src: true
dest: ~/serverfiles/csgo

- name: configure executes mode
template:
src: execute.cfg.j2
dest: ~/serverfiles/csgo/cfg/csgoserver.cfg
43 changes: 43 additions & 0 deletions roles/config-execute-mode/templates/execute.cfg.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
bot_kick
bot_quota 0
mp_autoteambalance 0
mp_do_warmup_period 1
mp_forcecamera 1
mp_give_player_c4 0
mp_halftime 0
mp_ignore_round_win_conditions 0
mp_join_grace_time 0
mp_match_can_clinch 0
mp_maxmoney 0
mp_playercashawards 0
mp_respawn_on_death_ct 0
mp_respawn_on_death_t 0
mp_teamcashawards 0
mp_warmup_pausetimer 0

mp_freezetime 0
mp_autokick 0
mp_c4timer 40
mp_maxrounds 20
mp_solid_teammates 1
mp_friendlyfire 0
mp_endmatch_votenextleveltime 3
mp_endmatch_votenextmap 0
mp_endmatch_votenextmap_keepcurrent 0
sv_talk_enemy_dead 0
sv_talk_enemy_living 0
sv_deadtalk 1
sv_allow_votes 0
spec_replay_enable 0
mp_round_restart_delay 5

spec_freeze_deathanim_time 0
spec_freeze_panel_extended_time 0
spec_freeze_time 2
spec_freeze_time_lock 2

sm_executes_minplayers "{{ sm_executes_minplayers }}"
sm_executes_maxplayers "{{ sm_executes_maxplayers }}"
sm_executes_ratio_constant "{{ sm_executes_ratio_constant }}"
sm_executes_round_time "{{ sm_executes_round_time }}"
sm_executes_auto_scramble "{{ sm_executes_auto_scramble }}"
29 changes: 29 additions & 0 deletions roles/config-retake-mode/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- name: read env from from /etc/default/linuxgsm
include_vars:
file: /etc/default/linuxgsm
name: env

- name: install retake mode
unarchive:
src: "https://github.com/splewis/csgo-retakes/releases/download/v0.3.4/retakes_0.3.4.zip"
remote_src: true
dest: ~/serverfiles/csgo

- name: configure retake mode
template:
src: retake.cfg.j2
dest: ~/serverfiles/csgo/cfg/csgoserver.cfg

- name: retake pistol only
when: pistol_only
copy:
src: ~/serverfiles/csgo/addons/sourcemod/plugins/disabled/retakes_pistolallocator.smx
dest: ~/serverfiles/csgo/addons/sourcemod/plugins/retakes_allocator.smx
notify: restart_server

- name: retake standard
when: not pistol_only
copy:
src: ~/serverfiles/csgo/addons/sourcemod/plugins/disabled/retakes_standardallocator.smx
dest: ~/serverfiles/csgo/addons/sourcemod/plugins/retakes_allocator.smx
notify: restart_server
5 changes: 5 additions & 0 deletions roles/config-retake-mode/templates/retake.cfg.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sm_retakes_enabled 1
sm_retakes_maxplayers "{{ env.maxplayers }}"
sm_retakes_scramble_rounds "{{ env.sm_retakes_scramble_rounds }}"
sm_retakes_round_time "{{ env.sm_retakes_round_time }}"
sm_retakes_random_teams "{{ env.sm_retakes_random_teams }}"
4 changes: 4 additions & 0 deletions roles/install-gameserver/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

- name: restart gameserver
command: "~/csgoserver restart"
listen: restart_server
82 changes: 82 additions & 0 deletions roles/install-gameserver/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
- name: read env from from /etc/default/linuxgsm
include_vars:
file: /etc/default/linuxgsm
name: env

- name: download linuxgsm install script
tags: download
get_url:
url: https://linuxgsm.sh
dest: ~/linuxgsm.sh
mode: "+x"

- name: install csgo gsm
tags: download
shell: ~/linuxgsm.sh csgoserver install
args:
chdir: ~/
creates: ~/csgoserver

- name: download csgo
tags: download
shell: ~/csgoserver auto-install
args:
chdir: ~/
creates: ~/serverfiles/csgo

- name: install metamod and sourcemod
tags: basemod
unarchive:
src: "{{ item }}"
remote_src: true
dest: ~/serverfiles/csgo
with_items:
- "https://sm.alliedmods.net/smdrop/1.10/sourcemod-1.10.0-git6460-linux.tar.gz"
- "https://mms.alliedmods.net/mmsdrop/1.10/mmsource-1.10.7-git971-linux.tar.gz"

- name: configure server
tags: basemod
template:
src: server.cfg.j2
dest: ~/lgsm/config-lgsm/csgoserver/csgoserver.cfg

- name: configure match
tags: basemod
template:
src: game.cfg.j2
dest: ~/serverfiles/csgo/cfg/common.cfg

- name: "monitor job"
tags: cron
cron:
user: "{{ ansible_user_id }}"
name: "monitor"
minute: "15"
job: "~/csgoserver monitor"

- name: "update job"
tags: cron
cron:
user: "{{ ansible_user_id }}"
name: "update"
minute: "30"
job: "~/csgoserver update"

- name: "hard update job"
tags: cron
cron:
user: "{{ ansible_user_id }}"
name: "hard update"
minute: "30"
hour: "5"
job: "~/csgoserver force-update"

- name: "update linuxgsm job"
tags: cron
cron:
user: "{{ ansible_user_id }}"
name: "update linuxgsm"
minute: "0"
hour: "2"
weekday: "0"
job: "~/csgoserver update-functions"
Loading

0 comments on commit d0266e2

Please sign in to comment.