generated from kolosovpetro/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kolosovpetro/infra-updates
Infrastructure Updates
- Loading branch information
Showing
33 changed files
with
587 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copy the SSH private key to the control node | ||
Write-Output "Starting: Copying the SSH private key to the control node..." | ||
scp "$env:USER_DIRECTORY/.ssh/id_rsa" razumovsky_r@prom-server.razumovsky.me:~/.ssh | ||
if (-not $?) | ||
{ | ||
Write-Output "Error: Failed to copy the SSH private key. Stopping execution." | ||
exit 1 | ||
} | ||
Write-Output "Completed: SSH private key copied to the control node." | ||
|
||
# Secure the SSH private key on the control node | ||
Write-Output "Starting: Securing the SSH private key on the control node..." | ||
ssh razumovsky_r@prom-server.razumovsky.me "chmod 600 ~/.ssh/id_rsa" | ||
if (-not $?) | ||
{ | ||
Write-Output "Error: Failed to secure the SSH private key. Stopping execution." | ||
exit 1 | ||
} | ||
Write-Output "Completed: SSH private key secured on the control node." | ||
|
||
# Copy the Ansible configuration file to the control node | ||
Write-Output "Starting: Copying the Ansible configuration file to the control node..." | ||
scp "../ansible.cfg" razumovsky_r@prom-server.razumovsky.me:~/ansible.cfg | ||
if (-not $?) | ||
{ | ||
Write-Output "Error: Failed to copy the Ansible configuration file. Stopping execution." | ||
exit 1 | ||
} | ||
Write-Output "Completed: Ansible configuration file copied to the control node." | ||
|
||
# Move the Ansible configuration file to the correct location | ||
Write-Output "Starting: Moving the Ansible configuration file to /etc/ansible/ on the control node..." | ||
ssh razumovsky_r@prom-server.razumovsky.me "sudo mv ~/ansible.cfg /etc/ansible/ansible.cfg" | ||
if (-not $?) | ||
{ | ||
Write-Output "Error: Failed to move the Ansible configuration file. Stopping execution." | ||
exit 1 | ||
} | ||
Write-Output "Completed: Ansible configuration file moved to /etc/ansible/." | ||
|
||
# Copy the inventory file to the control node | ||
Write-Output "Starting: Copying the inventory file to the control node..." | ||
scp "../inventory/inventory.ini" razumovsky_r@prom-server.razumovsky.me:~/inventory.ini | ||
ssh razumovsky_r@prom-server.razumovsky.me "sudo mv ~/inventory.ini /etc/ansible" | ||
if (-not $?) | ||
{ | ||
Write-Output "Error: Failed to copy the inventory file. Stopping execution." | ||
exit 1 | ||
} | ||
Write-Output "Completed: Inventory file copied to the control node." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
data "cloudflare_zone" "razumovsky_me_zone" { | ||
name = local.domain_name | ||
} | ||
|
||
resource "cloudflare_record" "prom_server_dns" { | ||
zone_id = data.cloudflare_zone.razumovsky_me_zone.id | ||
name = local.prometheus_server.subdomain | ||
content = module.prometheus_server_vm.public_ip_address | ||
type = "A" | ||
proxied = false | ||
} | ||
|
||
resource "cloudflare_record" "linux_target_dns" { | ||
zone_id = data.cloudflare_zone.razumovsky_me_zone.id | ||
name = local.linux_target.subdomain | ||
content = module.linux_target_vm.public_ip_address | ||
type = "A" | ||
proxied = false | ||
} | ||
|
||
resource "cloudflare_record" "windows_target_dns" { | ||
zone_id = data.cloudflare_zone.razumovsky_me_zone.id | ||
name = local.windows_target.subdomain | ||
content = module.windows_target_vm.public_ip_address | ||
type = "A" | ||
proxied = false | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
locals { | ||
|
||
resource_group_name = "rg-prom-${var.prefix}" | ||
domain_name = "razumovsky.me" | ||
|
||
linux_target = { | ||
name = "linux-target" | ||
name = "linux-target" | ||
subdomain = "linux-target" | ||
} | ||
|
||
windows_target = { | ||
name = "windows-target" | ||
name = "windows-target" | ||
subdomain = "windows-target" | ||
} | ||
|
||
|
||
prometheus_server = { | ||
name = "prom-server" | ||
name = "prom-server" | ||
subdomain = "prom-server" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.