Skip to content

Commit

Permalink
wip template
Browse files Browse the repository at this point in the history
  • Loading branch information
NexusNull committed Nov 23, 2023
1 parent 572d195 commit 5632fde
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
11 changes: 10 additions & 1 deletion cicd/infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,21 @@ data "hcloud_ssh_keys" "admin" {
with_selector = "role=admin"
}

resource "template_file" "inventory" {
template = "./templates/inventory.tpl"
vars = {
base_url = local.secrets.base_url
keyword = local.secrets.keyword
master = local.secrets.master
bot_key = local.secrets.bot_key
}
}

locals {
secrets = {
base_url = var.base_url
keyword = random_string.keyword.result
master = random_string.master.result
server_master = random_string.server_master.result
bot_key = random_string.bot_key.result
}
ips = [
Expand Down
30 changes: 30 additions & 0 deletions cicd/infra/templates/inventory.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
master-servers:
vars:
ansible_user: root
hosts:
master:
ansible_host: 157.90.225.102
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
region: EU
name: Master
master: ${master}
bot_key: ${bot_key}
keyword: ${keyword}
base_url: ${base_url}
mount_point: "/opt/storage"
volume_id: "100034037"
game-servers:
vars:
ansible_user: root
hosts:
%{ for server in servers ~}
${server.region}_${server.name}:
ansible_host: ${server.ip}
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
region: ${server.region}
name: ${server.name}
master: ${master}
bot_key: ${bot_key}
keyword: ${keyword}
base_url: ${base_url}
%{ endfor ~}
2 changes: 2 additions & 0 deletions cicd/setup/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ master-servers:
bot_key: plasdjpoiepojkqwe
keyword: pokokipdaspkoadsmlewqokpi
base_url: http://al.nexusnull.com
mount_point: "/opt/storage"
volume_id: "100034037"
game-servers:
vars:
ansible_user: root
Expand Down
2 changes: 0 additions & 2 deletions cicd/setup/roles/storage/defaults/main.yml

This file was deleted.

0 comments on commit 5632fde

Please sign in to comment.