From 44da6d3ec6808fb64711a9cc93d4a79249062727 Mon Sep 17 00:00:00 2001 From: Devin Gaffney Date: Thu, 12 May 2022 13:07:19 -0700 Subject: [PATCH 1/2] extend to work with HLL lurker --- main.tf | 5 +++++ templates/user_data.tpl | 20 ++++++++++++++++++++ terraform.tfvars.exemple | 4 ++++ variables.tf | 30 ++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/main.tf b/main.tf index 7b9222a..fc9074e 100644 --- a/main.tf +++ b/main.tf @@ -153,10 +153,15 @@ resource "aws_spot_instance_request" "windows_instance" { install_auto_login=var.install_auto_login, install_graphic_card_driver=var.install_graphic_card_driver, install_steam=var.install_steam, + install_steam_cmd=var.install_steam_cmd, install_gog_galaxy=var.install_gog_galaxy, install_origin=var.install_origin, install_epic_games_launcher=var.install_epic_games_launcher, install_uplay=var.install_uplay, + steam_account_email=var.steam_account_email, + steam_account_password=var.steam_account_password, + steam_app_id=var.steam_app_id, + server_address=var.server_address, } }) iam_instance_profile = aws_iam_instance_profile.windows_instance_profile.id diff --git a/templates/user_data.tpl b/templates/user_data.tpl index 4d1a57e..d784ab4 100644 --- a/templates/user_data.tpl +++ b/templates/user_data.tpl @@ -12,6 +12,19 @@ function install-chocolatey { choco feature enable -n allowGlobalConfirmation } +function generate-game-start-script { + New-Item "C:\start_game.txt" + Set-Content "C:\start_game.txt '@ShutdownOnFailedCommand 1','@NoPromptForPassword 1','login ${var.steam_account_email} ${var.steam_account_password}','app_update ${var.steam_app_id} validate','quit'" +} + +function install-game { + steamcmd +runscript C:\start_game.txt +} + +function start-game { + Start-Process "${var.server_address}" +} + function install-parsec-cloud-preparation-tool { # https://github.com/jamesstringerparsec/Parsec-Cloud-Preparation-Tool $desktopPath = [Environment]::GetFolderPath("Desktop") @@ -148,6 +161,10 @@ install-graphic-driver choco install steam %{ endif } +%{ if var.install_steam_cmd } +choco install steamcmd +%{ endif } + %{ if var.install_gog_galaxy } choco install goggalaxy %{ endif } @@ -164,4 +181,7 @@ choco install origin choco install epicgameslauncher %{ endif } +generate-game-start-script +install-game +start-game diff --git a/terraform.tfvars.exemple b/terraform.tfvars.exemple index 95f60a2..8d11a67 100644 --- a/terraform.tfvars.exemple +++ b/terraform.tfvars.exemple @@ -3,6 +3,10 @@ region = "" #instance_type = "g4dn.xlarge" #root_block_device_size_gb = 120 custom_ami = "" +steam_account_email = "someemail@domain.com" +steam_account_password = "somepassword" +steam_app_id = "686810" +server_address = "steam://connect/192.169.89.50:26662" #install_parsec=true #install_auto_login=true diff --git a/variables.tf b/variables.tf index 15c4a1a..05eaca9 100644 --- a/variables.tf +++ b/variables.tf @@ -64,6 +64,36 @@ variable "install_steam" { default = true } +variable "install_steam_cmd" { + description = "Download and install Valve Steam CMD on first boot" + type = bool + default = true +} +variable "steam_account_email" { + description = "steam_account_email" + type = string + default = "na" +} + +variable "steam_account_password" { + description = "steam_account_password" + type = string + default = "na" +} + +variable "steam_app_id" { + description = "steam_app_id" + type = string + default = "na" +} + +variable "server_address" { + description = "server_address" + type = string + default = "na" +} + + variable "install_gog_galaxy" { description = "Download and install GOG Galaxy on first boot" type = bool From f8c762cfc0da05779179289683a0a33be1aac071 Mon Sep 17 00:00:00 2001 From: Devin Gaffney Date: Thu, 12 May 2022 15:17:43 -0700 Subject: [PATCH 2/2] more hacking --- templates/user_data.tpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/user_data.tpl b/templates/user_data.tpl index d784ab4..d5832e8 100644 --- a/templates/user_data.tpl +++ b/templates/user_data.tpl @@ -13,8 +13,7 @@ function install-chocolatey { } function generate-game-start-script { - New-Item "C:\start_game.txt" - Set-Content "C:\start_game.txt '@ShutdownOnFailedCommand 1','@NoPromptForPassword 1','login ${var.steam_account_email} ${var.steam_account_password}','app_update ${var.steam_app_id} validate','quit'" + Set-Content -Path C:\start_game.txt -Value '@ShutdownOnFailedCommand 1','@NoPromptForPassword 1','force_install_dir C:\gamedir','login ${var.steam_account_email} ${var.steam_account_password}','app_update ${var.steam_app_id} validate','quit' } function install-game {