mirror of
https://github.com/2martens/terraform.git
synced 2026-10-17 19:26:51 +02:00
change: Only install certbot on main manager node
This commit is contained in:
@@ -78,7 +78,7 @@ resource "hcloud_server" "node" {
|
||||
github_public_ssh_key : var.github_public_ssh_key
|
||||
main_node : count.index == 0
|
||||
packages_setup : base64encode(templatefile("${path.module}/templates/scripts/install-packages.sh.tftpl", {
|
||||
manager_node : true
|
||||
main_node : count.index == 0
|
||||
}))
|
||||
firewall_setup : base64encode(templatefile("${path.module}/templates/scripts/firewall-setup.sh.tftpl", {
|
||||
node_ip : var.private_node_ips[count.index]
|
||||
|
||||
@@ -76,7 +76,7 @@ resource "hcloud_server" "worker_node" {
|
||||
admin_user : var.admin_user
|
||||
terraform_public_ssh_key : var.terraform_public_ssh_key
|
||||
packages_setup : base64encode(templatefile("${path.module}/templates/scripts/install-packages.sh.tftpl", {
|
||||
manager_node : false
|
||||
main_node : false
|
||||
}))
|
||||
firewall_setup : base64encode(templatefile("${path.module}/templates/scripts/firewall-setup.sh.tftpl", {
|
||||
node_ip : var.private_node_ips[count.index]
|
||||
|
||||
@@ -41,12 +41,12 @@ write_files:
|
||||
path: /run/tmpfiles.d/sysctl-setup.sh
|
||||
encoding: base64
|
||||
defer: true
|
||||
%{ if main_node ~}
|
||||
- owner: root:root
|
||||
content: "${certbot_setup}"
|
||||
path: /run/tmpfiles.d/certbot-setup.sh
|
||||
encoding: base64
|
||||
defer: true
|
||||
%{ if main_node ~}
|
||||
- owner: root:root
|
||||
content: "${swarm_setup}"
|
||||
path: /run/tmpfiles.d/swarm-setup.sh
|
||||
@@ -59,7 +59,7 @@ runcmd:
|
||||
- /usr/local/bin/firewall-setup.sh
|
||||
- /usr/local/bin/ssh-setup.sh
|
||||
- /usr/local/bin/sysctl-setup.sh
|
||||
- /usr/local/bin/certbot-setup.sh
|
||||
%{ if main_node ~}
|
||||
- /usr/local/bin/certbot-setup.sh
|
||||
- /usr/local/bin/swarm-setup.sh
|
||||
%{ endif ~}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p /var/www/certbot
|
||||
mkdir -p /etc/letsencrypt
|
||||
|
||||
@@ -22,6 +22,6 @@ apt-get -y install ufw
|
||||
curl https://packages.hetzner.com/hcloud/deb/hc-utils_0.0.4-1_all.deb -o /run/tmpfiles.d/hc-utils_0.0.4-1_all.deb -s
|
||||
apt-get -y install /run/tmpfiles.d/hc-utils_0.0.4-1_all.deb
|
||||
|
||||
%{if manager_node ~}
|
||||
%{if main_node ~}
|
||||
apt-get -y install certbot
|
||||
%{endif ~}
|
||||
|
||||
Reference in New Issue
Block a user