Skip to content

Commit

Permalink
Skip named and haproxy in case of ibmcloud use
Browse files Browse the repository at this point in the history
Fixes #502

Signed-off-by: Yussuf Shaikh <[email protected]>
  • Loading branch information
yussufsh committed Nov 27, 2023
1 parent bb5eccd commit 588c476
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 6 additions & 8 deletions modules/5_install/install.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ locals {
local_registry = local.local_registry
client_tarball = var.openshift_client_tarball
install_tarball = var.openshift_install_tarball

# This variable is needed to be set if using ibmcloud services.
# Otherwise helpernode will fail to run on subsequent runs
# trying to start named and haproxy
# TODO: This is hardcoded to 9.9.9.9 to use external nameserver. Need to read from dns_forwarders.
ext_dns = var.use_ibm_cloud_services ? "9.9.9.9" : ""
}

helpernode_inventory = {
Expand Down Expand Up @@ -319,13 +325,6 @@ resource "null_resource" "external_services" {

provisioner "remote-exec" {
inline = [
"echo 'Stopping HAPROXY and DNS'",
"sudo systemctl stop haproxy.service && sudo systemctl stop named.service",
"sudo systemctl mask haproxy.service && sudo systemctl mask named.service",
"echo 'Changing DNS to external on bastion and dhcpd'",
# TODO: This is hardcoded to 9.9.9.9 to use external nameserver. Need to read from dns_forwarders.
"sudo sed -i 's/nameserver 127.0.0.1/nameserver 9.9.9.9/g' /etc/resolv.conf",
"sudo sed -i 's/option domain-name-servers.*/option domain-name-servers 9.9.9.9;/g' /etc/dhcp/dhcpd.conf",
"echo 'Adding static route for VPC subnet in dhcpd'",
"sudo sed -i '/option routers/i option static-routes ${cidrhost(var.vpc_cidr, 0)} ${var.gateway_ip};' /etc/dhcp/dhcpd.conf",
"sudo systemctl restart dhcpd.service"
Expand Down Expand Up @@ -598,4 +597,3 @@ resource "ibm_pi_instance_action" "fips_bastion_reboot" {
pi_instance_id = "${var.name_prefix}bastion-${count.index}"
pi_action = "soft-reboot"
}

3 changes: 3 additions & 0 deletions modules/5_install/templates/helpernode_vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ dhcp:
router: "${gateway_ip}"
bcast: "${broadcast}"
netmask: "${netmask}"
%{ if ext_dns != "" }
dns: "${ext_dns}"
%{ endif }
ipid: "${ipid}"
netmaskid: "${netmask}"
poolstart: "${pool.start}"
Expand Down

0 comments on commit 588c476

Please sign in to comment.