This repository has been archived by the owner on Aug 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rearrange the code flow to run helpernode before nodes creation
Fixes #45 Signed-off-by: Yussuf Shaikh <yussuf@us.ibm.com>
- Loading branch information
Showing
10 changed files
with
218 additions
and
138 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,87 @@ | ||
################################################################ | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Licensed Materials - Property of IBM | ||
# | ||
# ©Copyright IBM Corp. 2020 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
################################################################ | ||
|
||
locals { | ||
helpernode_vars = { | ||
cluster_domain = var.cluster_domain | ||
cluster_id = var.cluster_id | ||
bastion_ip = var.bastion_ip | ||
forwarders = var.dns_forwarders | ||
gateway_ip = var.gateway_ip | ||
netmask = cidrnetmask(var.cidr) | ||
broadcast = cidrhost(var.cidr,-1) | ||
ipid = cidrhost(var.cidr, 0) | ||
pool = var.allocation_pools[0] | ||
|
||
bootstrap_info = { | ||
ip = var.bootstrap_ip, | ||
mac = var.bootstrap_mac, | ||
name = "bootstrap" | ||
} | ||
master_info = [ for ix in range(length(var.master_ips)) : | ||
{ | ||
ip = var.master_ips[ix], | ||
mac = var.master_macs[ix], | ||
name = "master-${ix}" | ||
} | ||
] | ||
worker_info = [ for ix in range(length(var.worker_ips)) : | ||
{ | ||
ip = var.worker_ips[ix], | ||
mac = var.worker_macs[ix], | ||
name = "worker-${ix}" | ||
} | ||
] | ||
|
||
client_tarball = var.openshift_client_tarball | ||
install_tarball = var.openshift_install_tarball | ||
} | ||
} | ||
|
||
resource "null_resource" "config" { | ||
connection { | ||
type = "ssh" | ||
user = var.rhel_username | ||
host = var.bastion_ip | ||
private_key = var.private_key | ||
agent = var.ssh_agent | ||
timeout = "15m" | ||
bastion_host = var.jump_host | ||
} | ||
|
||
provisioner "remote-exec" { | ||
inline = [ | ||
"rm -rf ocp4-helpernode", | ||
"echo 'Cloning into ocp4-helpernode...'", | ||
"git clone https://github.com/RedHatOfficial/ocp4-helpernode --quiet", | ||
"cd ocp4-helpernode && git checkout ${var.helpernode_tag}" | ||
] | ||
} | ||
provisioner "file" { | ||
content = templatefile("${path.module}/templates/helpernode_vars.yaml", local.helpernode_vars) | ||
destination = "~/ocp4-helpernode/helpernode_vars.yaml" | ||
} | ||
provisioner "remote-exec" { | ||
inline = [ | ||
"echo 'Running ocp4-helpernode playbook...'", | ||
"cd ocp4-helpernode && ansible-playbook -e @helpernode_vars.yaml tasks/main.yml ${var.ansible_extra_options}" | ||
] | ||
} | ||
} |
File renamed without changes.
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,9 @@ | ||
terraform { | ||
required_providers { | ||
null = { | ||
source = "hashicorp/null" | ||
version = "~> 2.1" | ||
} | ||
} | ||
required_version = "~> 0.13" | ||
} |
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.