This commit is contained in:
mwiegand 2021-10-11 00:02:29 +02:00
parent af592c771e
commit f21998266d
3 changed files with 28 additions and 12 deletions

View file

@ -5,11 +5,10 @@ directories = {
'/opt/left4dead2/ems/admin system': {
'owner': 'steam',
},
'/opt/left4dead2/addons': {
'/opt/left4dead2/left4dead2/cfg': {
'owner': 'steam',
'purge': True,
},
'/etc/left4dead2': {
'/opt/left4dead2/addons': {
'owner': 'steam',
'purge': True,
},
@ -42,11 +41,21 @@ for id in node.metadata.get('left4dead2/workshop'):
server_units = set()
for name, config in node.metadata.get('left4dead2/servers').items():
config.pop('port')
config['sv_steamgroup'] = name
config['hostname'] = name
config['sv_steamgroup'] = ','.join(str(gid) for gid in node.metadata.get('left4dead2/steamgroups'))
config.update({
'hostname': name,
'sv_steamgroup': ','.join(
str(gid) for gid in node.metadata.get('left4dead2/steamgroups')
),
'log': 'on',
'sv_logecho': 1,
'sv_logfile': 1,
'sv_log_onefile': 0,
'sv_logbans': 1,
'sv_logflush': 0,
'sv_logsdir': 'logs', # /opt/left4dead2/left4dead2/logs
})
files[f'/etc/left4dead2/{name}.cfg'] = {
files[f'/opt/left4dead2/left4dead2/cfg/server-{name}.cfg'] = {
'content': '\n'.join(
f'{key} "{value}"' for key, value in sorted(config.items())
) + '\n',

View file

@ -74,7 +74,7 @@ def server_units(metadata):
'User': 'steam',
'Group': 'steam',
'WorkingDirectory': '/opt/left4dead2',
'ExecStart': f'/opt/left4dead2/srcds_run -port {config["port"]} -secure +exec /etc/left4dead2/{name}.cfg',
'ExecStart': f'/opt/left4dead2/srcds_run -port {config["port"]} -secure +exec server-{name}.cfg',
'Restart': 'on-failure',
},
'Install': {

View file

@ -7,7 +7,9 @@ users = {
directories = {
'/opt/steam': {
'owner': 'steam',
'group': 'steam',
},
'/opt/steam/.steam': {
'owner': 'steam',
},
}
@ -16,17 +18,22 @@ files = {
'content_type': 'download',
'source': 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz',
'owner': 'steam',
'group': 'steam',
},
'/opt/steam-workshop-downloader': {
'content_type': 'download',
'source': 'https://github.com/SegoCode/swd/releases/download/1.1/swd-linux-amd64',
'owner': 'steam',
'group': 'steam',
'mode': '750',
},
}
symlinks = {
# /opt/steam/.steam/sdk32/steamclient.so: cannot open shared object file: No such file or directory
'/opt/steam/.steam/sdk32': {
'target': '/opt/steam/linux32',
}
}
actions = {
'extract_steamcmd': {
'command': 'tar xfvz /opt/steam/steamcmd_linux.tar.gz --directory /opt/steam',
@ -36,7 +43,7 @@ actions = {
],
},
'chown_steamcmd': {
'command': 'chown -R steam:steam /opt/steam',
'command': 'chown -R steam /opt/steam',
'triggered': True,
'triggered_by': [
'action:extract_steamcmd',