Skip to content

Commit cac93e1

Browse files
committed
Fixes ocp-power-automation#220 Wildcard move Fixes ocp-power-automation#220 Wildcard move Fixes ocp-power-automation#220 Updated doc Fixes ocp-power-automation#220 Updated doc Fixes ocp-power-automation#220 Updated Docu Fixes ocp-power-automation#220 Updated Docu Update var.tfvars-doc.md Fixes ocp-power-automation#220
1 parent fd9751e commit cac93e1

File tree

9 files changed

+145
-10
lines changed

9 files changed

+145
-10
lines changed

docs/var.tfvars-doc.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,44 @@ This variable can be used for trying out custom OpenShift install image for deve
179179
release_image_override = ""
180180
```
181181

182-
These variables specify the ansible playbooks that are used for OpenShift install and post-install customizations.
182+
These variables specify the ansible playbooks that are used for OpenShift install and post-install customizations. If the URL ends with a file name extension .zip, then it is assumed that it points to a HTTP/HTTPS server and curl/unzip will be used to extract the package. URLs without ending with .zip are recognized as GitHub repositories and git clone && git checkout are used.
183+
`Only .zip is supported file format on web servers. The all files must be placed in folders starting with ocp4-playbooks, or ocp4-helpernode! It is allowed to extend the directory name with additional informations: e.g. ocp4-helpernode-<master/version number)`
184+
Valid options: Requires a URL pointing to the packages/GitHub project.
183185
```
186+
helpernode_repo = "https://<HTTP SERVER>/ocp4-ansible-modules/ocp4-helpernode-master.zip"
187+
OR
184188
helpernode_repo = "https://github.com/RedHatOfficial/ocp4-helpernode"
185189
helpernode_tag = "5eab3db53976bb16be582f2edc2de02f7510050d"
190+
191+
install_playbook_repo = "https://<HTTP SERVER>/ocp4-ansible-modules/ocp4-playbooks-master.zip"
192+
OR
186193
install_playbook_repo = "https://github.com/ocp-power-automation/ocp4-playbooks"
187194
install_playbook_tag = "02a598faa332aa2c3d53e8edd0e840440ff74bd5"
188195
```
189196

197+
If you want to provide the ansible playbooks by your local HTTP server, follow these steps:
198+
```
199+
Use your web browser and visit https://github.com/RedHatOfficial/ocp4-helpernode
200+
On the main page, stay on the master repository page and click on the green "Code" button with a download symbol in front of it
201+
Click on "Download ZIP"
202+
Upload the file to your local HTTP server and place it in the appropriate directory
203+
204+
Use your web browser and visit https://github.com/ocp-power-automation/ocp4-playbooks
205+
On the main page, stay on the master repository page and click on the green "Code" button with a download symbol in front of it
206+
Click on "Download ZIP"
207+
Upload the file to your local HTTP server and place it in the appropriate directory, like the example below
208+
209+
ls -la /var/www/html/repos/
210+
total 13452
211+
-rw-r--r--. 1 root root 13624204 Jul 8 13:43 ocp4-helpernode.zip
212+
-rw-r--r--. 1 root root 145165 Jul 8 13:44 ocp4-playbooks.zip
213+
```
214+
215+
This variable can be used to define a different source for the helm package, like a local web server. By default, the help package will be downloaded from the official internet source.
216+
```
217+
helm_repo = "https://<HTTP SERVER>/python-modules/helm-latest-linux-ppc64le.tar.gz"
218+
```
219+
190220
These variables can be used when debugging ansible playbooks
191221
```
192222
installer_log_level = "info"

modules/1_bastion/bastion.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ resource "null_resource" "bastion_packages" {
265265
provisioner "remote-exec" {
266266
inline = [
267267
"#sudo yum update -y --skip-broken",
268-
"sudo yum install -y wget jq git net-tools vim python3 tar"
268+
"sudo yum install -y wget jq git net-tools vim python3 tar curl unzip"
269269
]
270270
}
271271
provisioner "remote-exec" {

modules/3_helpernode/helpernode.tf

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ locals {
6767
]
6868

6969
local_registry = local.local_registry
70+
helm_repo = var.helm_repo
7071
client_tarball = var.openshift_client_tarball
7172
install_tarball = var.openshift_install_tarball
7273
}
@@ -75,12 +76,11 @@ locals {
7576
}
7677
}
7778

78-
resource "null_resource" "config" {
79-
79+
resource "null_resource" "prep_helpernode_tools_git" {
8080
triggers = {
8181
bootstrap_count = var.bootstrap_port_ip == "" ? 0 : 1
82-
worker_count = length(var.worker_port_ips)
8382
}
83+
count = length(regexall("\\.zip$", var.helpernode_repo)) == 0 ? 1 : 0
8484

8585
connection {
8686
type = "ssh"
@@ -101,6 +101,58 @@ resource "null_resource" "config" {
101101
"cd ocp4-helpernode && git checkout ${var.helpernode_tag}"
102102
]
103103
}
104+
}
105+
106+
resource "null_resource" "prep_helpernode_tools_curl" {
107+
triggers = {
108+
bootstrap_count = var.bootstrap_port_ip == "" ? 0 : 1
109+
}
110+
count = length(regexall("\\.zip$", var.helpernode_repo)) > 0 ? 1 : 0
111+
112+
connection {
113+
type = "ssh"
114+
user = var.rhel_username
115+
host = var.bastion_ip[0]
116+
private_key = var.private_key
117+
agent = var.ssh_agent
118+
timeout = "${var.connection_timeout}m"
119+
bastion_host = var.jump_host
120+
}
121+
122+
provisioner "remote-exec" {
123+
inline = [
124+
"mkdir -p .openshift",
125+
"rm -rf ocp4-helpernode",
126+
"rm -rf ocp4-extract-helper",
127+
"mkdir -p ocp4-extract-helper",
128+
"echo 'Downloading ocp4-helpernode...'",
129+
"curl -o ocp4-extract-helper/ocp4-helpernode.zip ${var.helpernode_repo}",
130+
"echo 'Extracting ocp4-helpernode...'",
131+
"cd ocp4-extract-helper && unzip ocp4-helpernode.zip",
132+
"cd .. && rm -rf ocp4-extract-helper/ocp4-helpernode.zip",
133+
"mv ocp4-extract-helper/ocp4-helpernode* ocp4-helpernode",
134+
"rm -rf ocp4-extract-helper"
135+
]
136+
}
137+
}
138+
139+
resource "null_resource" "config" {
140+
depends_on = [null_resource.prep_helpernode_tools_git, null_resource.prep_helpernode_tools_curl]
141+
triggers = {
142+
bootstrap_count = var.bootstrap_port_ip == "" ? 0 : 1
143+
worker_count = length(var.worker_port_ips)
144+
}
145+
146+
connection {
147+
type = "ssh"
148+
user = var.rhel_username
149+
host = var.bastion_ip[0]
150+
private_key = var.private_key
151+
agent = var.ssh_agent
152+
timeout = "${var.connection_timeout}m"
153+
bastion_host = var.jump_host
154+
}
155+
104156
provisioner "file" {
105157
content = templatefile("${path.module}/templates/helpernode_inventory", local.helpernode_inventory)
106158
destination = "$HOME/ocp4-helpernode/inventory"

modules/3_helpernode/templates/helpernode_vars.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ ocp_initramfs: "file:///dev/null"
8484
ocp_install_kernel: "file:///dev/null"
8585

8686
# This is required for latest helpernode. TODO: Remove when https://github.com/RedHatOfficial/ocp4-helpernode/pull/140 is merged
87-
helm_source: "https://get.helm.sh/helm-v3.4.0-linux-ppc64le.tar.gz"
87+
helm_source: "${helm_repo}"

modules/3_helpernode/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ variable "ocp_release_tag" {}
5858

5959
variable "helpernode_repo" {}
6060
variable "helpernode_tag" {}
61+
variable "helm_repo" {}
6162

6263
variable "ansible_extra_options" {}
6364

modules/5_install/install.tf

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ locals {
7373
}
7474
}
7575

76-
resource "null_resource" "install" {
77-
triggers = {
78-
worker_count = length(var.worker_ips)
79-
}
76+
resource "null_resource" "prep_playbooks_tools_git" {
77+
count = length(regexall("\\.zip$", var.install_playbook_repo)) == 0 ? 1 : 0
8078

8179
connection {
8280
type = "ssh"
@@ -96,6 +94,53 @@ resource "null_resource" "install" {
9694
"cd ocp4-playbooks && git checkout ${var.install_playbook_tag}"
9795
]
9896
}
97+
}
98+
99+
resource "null_resource" "prep_playbooks_tools_curl" {
100+
count = length(regexall("\\.zip$", var.install_playbook_repo)) > 0 ? 1 : 0
101+
102+
connection {
103+
type = "ssh"
104+
user = var.rhel_username
105+
host = var.bastion_ip[0]
106+
private_key = var.private_key
107+
agent = var.ssh_agent
108+
timeout = "${var.connection_timeout}m"
109+
bastion_host = var.jump_host
110+
}
111+
112+
provisioner "remote-exec" {
113+
inline = [
114+
"rm -rf ocp4-playbooks",
115+
"rm -rf ocp4-extract-helper",
116+
"mkdir -p ocp4-extract-helper",
117+
"echo 'Downloading ocp4-playbooks...'",
118+
"curl -o ocp4-extract-helper/ocp4-playbooks.zip ${var.install_playbook_repo}",
119+
"echo 'Extracting ocp4-playbooks...'",
120+
"cd ocp4-extract-helper && unzip ocp4-playbooks.zip",
121+
"cd .. && rm -rf ocp4-extract-helper/ocp4-playbooks.zip",
122+
"mv ocp4-extract-helper/ocp4-playbooks* ocp4-playbooks",
123+
"rm -rf ocp4-extract-helper"
124+
]
125+
}
126+
}
127+
128+
resource "null_resource" "install" {
129+
depends_on = [null_resource.prep_playbooks_tools_git, null_resource.prep_playbooks_tools_curl]
130+
triggers = {
131+
worker_count = length(var.worker_ips)
132+
}
133+
134+
connection {
135+
type = "ssh"
136+
user = var.rhel_username
137+
host = var.bastion_ip[0]
138+
private_key = var.private_key
139+
agent = var.ssh_agent
140+
timeout = "${var.connection_timeout}m"
141+
bastion_host = var.jump_host
142+
}
143+
99144
provisioner "file" {
100145
content = templatefile("${path.module}/templates/install_inventory", local.install_inventory)
101146
destination = "$HOME/ocp4-playbooks/inventory"

ocp.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ module "helpernode" {
111111
ocp_release_tag = var.ocp_release_tag
112112
helpernode_repo = var.helpernode_repo
113113
helpernode_tag = var.helpernode_tag
114+
helm_repo = var.helm_repo
114115
ansible_extra_options = var.ansible_extra_options
115116
chrony_config = var.chrony_config
116117
chrony_config_servers = var.chrony_config_servers

var.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ cluster_id = "" # It will use random generated id with
6161
#helpernode_tag = ""
6262
#install_playbook_repo = "https://github.com/ocp-power-automation/ocp4-playbooks"
6363
#install_playbook_tag = ""
64+
#helm_repo = "https://get.helm.sh/helm-v3.6.3-linux-ppc64le.tar.gz"
6465

6566
#installer_log_level = "info"
6667
#ansible_extra_options = "-v"

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ variable "install_playbook_tag" {
278278
default = "10fec74c9e987b39f7af1127abe304a9e41f8e65"
279279
}
280280

281+
variable "helm_repo" {
282+
description = "Set the URL after http_server_repo_main_dir pointing to the Python helm modules"
283+
default = "https://get.helm.sh/helm-v3.6.3-linux-ppc64le.tar.gz"
284+
}
285+
281286
variable "ansible_extra_options" {
282287
description = "Extra options string to append to ansible-playbook commands"
283288
default = "-v"

0 commit comments

Comments
 (0)