Skip to content

Commit

Permalink
Fixes ocp-power-automation#220 - Swapped to ZIP
Browse files Browse the repository at this point in the history
Fixes ocp-power-automation#220 - Swapped to ZIP
  • Loading branch information
torwen1 committed Jul 23, 2021
1 parent 74d6720 commit 5985594
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 34 deletions.
32 changes: 17 additions & 15 deletions docs/var.tfvars-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,36 +179,38 @@ This variable can be used for trying out custom OpenShift install image for deve
release_image_override = ""
```

These variables specify the ansible playbooks that are used for OpenShift install and post-install customizations. If the URL starts with the tag `git:`, then it is assumed that it points to a GitHub server and git clone and git checkout will be used. URLs without this tag and starting with http:/https: will be interpreted as standard web servers and curl will be used to download the packages.
`Only .tar.gz, or .tgz are supported formats on web servers and must be contain a complete git clone of the corresponding project!`
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.
`Only .zip is supported file format on web servers. The all files must be placed in a subfolder called ocp4-playbooks-master, or ocp4-helpernode-master! This is the default structure, if you download the playbooks from GitHub.com website and uses the "Download as ZIP" function, which is the recommended way. Exception is the help_repo, which is expected to be a tar.gz file format (default when downloading from the original source without manipulation afterwards!`
Valid options: Requires a URL pointing to the packages/GitHub project.
```
helpernode_repo = "https://<HTTP SERVER>/ocp4-ansible-modules/ocp4-helpernode-latest.tar.gz"
helpernode_repo = "https://<HTTP SERVER>/ocp4-ansible-modules/ocp4-helpernode-master.zip"
OR
helpernode_repo = "git:https://github.com/RedHatOfficial/ocp4-helpernode"
helpernode_repo = "https://github.com/RedHatOfficial/ocp4-helpernode"
helpernode_tag = "5eab3db53976bb16be582f2edc2de02f7510050d"
install_playbook_repo = "https://<HTTP SERVER>/ocp4-ansible-modules/ocp4-playbooks-latest.tar.gz"
install_playbook_repo = "https://<HTTP SERVER>/ocp4-ansible-modules/ocp4-playbooks-master.zip"
OR
install_playbook_repo = "git:https://github.com/ocp-power-automation/ocp4-playbooks"
install_playbook_repo = "https://github.com/ocp-power-automation/ocp4-playbooks"
install_playbook_tag = "02a598faa332aa2c3d53e8edd0e840440ff74bd5"
helm_repo = "https://<HTTP SERVER>/python-modules/helm-latest-linux-ppc64le.tar.gz"
```

If you want to provide the ansible playbooks by your local HTTP server, follow these steps to clone both git repositories:
If you want to provide the ansible playbooks by your local HTTP server, follow these steps:
```
git clone https://github.com/RedHatOfficial/ocp4-helpernode
tar czvf ocp4-helpernode.tgz ocp4-helpernode
cp ocp4-helpernode.tgz /var/www/html/repos/
Use your web browser and visit https://github.com/RedHatOfficial/ocp4-helpernode
On the main page of the master brach, click on the green "Code" button with a download symbol in front of it
Click on "Download ZIP"
Upload the file to your local HTTP server and place it in the appropriate directory
git clone https://github.com/ocp-power-automation/ocp4-playbooks
tar czvf ocp4-playbooks.tgz ocp4-playbooks
cp ocp4-playbooks.tgz /var/www/html/repos/
Use your web browser and visit https://github.com/ocp-power-automation/ocp4-playbooks
On the main page of the master brach, click on the green "Code" button with a download symbol in front of it
Click on "Download ZIP"
Upload the file to your local HTTP server and place it in the appropriate directory
ls -la /var/www/html/repos/
total 13452
-rw-r--r--. 1 root root 13624204 Jul 8 13:43 ocp4-helpernode.tgz
-rw-r--r--. 1 root root 145165 Jul 8 13:44 ocp4-playbooks.tgz
-rw-r--r--. 1 root root 13624204 Jul 8 13:43 ocp4-helpernode-master.tgz
-rw-r--r--. 1 root root 145165 Jul 8 13:44 ocp4-playbooks-master.tgz
```

These variables can be used when debugging ansible playbooks
Expand Down
2 changes: 1 addition & 1 deletion modules/1_bastion/bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ resource "null_resource" "bastion_packages" {
provisioner "remote-exec" {
inline = [
"#sudo yum update -y --skip-broken",
"sudo yum install -y wget jq git net-tools vim python3 tar"
"sudo yum install -y wget jq git net-tools vim python3 tar curl unzip"
]
}
provisioner "remote-exec" {
Expand Down
14 changes: 7 additions & 7 deletions modules/3_helpernode/helpernode.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ resource "null_resource" "prep_helpernode_tools_git" {
bootstrap_count = var.bootstrap_port_ip == "" ? 0 : 1
worker_count = length(var.worker_port_ips)
}
count = length(regexall("^git:", var.helpernode_repo)) > 0 ? 1 : 0
count = length(regexall("\\.zip$", var.helpernode_repo)) == 0 ? 1 : 0

connection {
type = "ssh"
Expand All @@ -97,7 +97,7 @@ resource "null_resource" "prep_helpernode_tools_git" {
inline = [
"rm -rf ocp4-helpernode",
"echo 'Cloning into ocp4-helpernode...'",
"git clone ${replace(var.helpernode_repo, "/^git:/", "")} --quiet",
"git clone ${var.helpernode_repo} --quiet",
"cd ocp4-helpernode && git checkout ${var.helpernode_tag}"
]
}
Expand All @@ -108,7 +108,7 @@ resource "null_resource" "prep_helpernode_tools_curl" {
bootstrap_count = var.bootstrap_port_ip == "" ? 0 : 1
worker_count = length(var.worker_port_ips)
}
count = length(regexall("^http:|^https:", var.helpernode_repo)) > 0 ? 1 : 0
count = length(regexall("\\.zip$", var.helpernode_repo)) > 0 ? 1 : 0

connection {
type = "ssh"
Expand All @@ -124,11 +124,11 @@ resource "null_resource" "prep_helpernode_tools_curl" {
inline = [
"rm -rf ocp4-helpernode",
"echo 'Downloading ocp4-helpernode...'",
"curl -o ocp4-helpernode.tar.gz ${var.helpernode_repo}",
"curl -o ocp4-helpernode.zip ${var.helpernode_repo}",
"echo 'Extracting ocp4-helpernode...'",
"tar zxvf ocp4-helpernode.tar.gz",
"rm ocp4-helpernode.tar.gz",
"cd ocp4-helpernode && git checkout ${var.helpernode_tag}"
"unzip ocp4-helpernode.zip",
"mv ocp4-helpernode-master ocp4-helpernode",
"rm ocp4-helpernode.zip"
]
}
}
Expand Down
14 changes: 7 additions & 7 deletions modules/5_install/install.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ resource "null_resource" "prep_playbooks_tools_git" {
triggers = {
worker_count = length(var.worker_ips)
}
count = length(regexall("^git:", var.install_playbook_repo)) > 0 ? 1 : 0
count = length(regexall("\\.zip$", var.install_playbook_repo)) == 0 ? 1 : 0

connection {
type = "ssh"
Expand All @@ -93,7 +93,7 @@ resource "null_resource" "prep_playbooks_tools_git" {
inline = [
"rm -rf ocp4-playbooks",
"echo 'Cloning into ocp4-playbooks...'",
"git clone ${replace(var.install_playbook_repo, "/^git:/", "")} --quiet",
"git clone ${var.install_playbook_repo} --quiet",
"cd ocp4-playbooks && git checkout ${var.install_playbook_tag}"
]
}
Expand All @@ -103,7 +103,7 @@ resource "null_resource" "prep_playbooks_tools_curl" {
triggers = {
worker_count = length(var.worker_ips)
}
count = length(regexall("^http:|^https:", var.install_playbook_repo)) > 0 ? 1 : 0
count = length(regexall("\\.zip$", var.install_playbook_repo)) > 0 ? 1 : 0

connection {
type = "ssh"
Expand All @@ -119,11 +119,11 @@ resource "null_resource" "prep_playbooks_tools_curl" {
inline = [
"rm -rf ocp4-playbooks",
"echo 'Downloading ocp4-playbooks...'",
"curl -o ocp4-playbooks.tar.gz ${var.install_playbook_repo}",
"curl -o ocp4-playbooks.zip ${var.install_playbook_repo}",
"echo 'Extracting ocp4-playbooks...'",
"tar zxvf ocp4-playbooks.tar.gz",
"rm ocp4-playbooks.tar.gz",
"cd ocp4-playbooks && git checkout ${var.install_playbook_tag}"
"unzip ocp4-playbooks.tar.gz",
"mv ocp4-playbooks-master ocp4-playbooks",
"rm ocp4-playbooks.tar.gz"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions var.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ cluster_id = "" # It will use random generated id with
#release_image_override = ""


#helpernode_repo = "git:https://github.com/RedHatOfficial/ocp4-helpernode"
#helpernode_repo = "https://github.com/RedHatOfficial/ocp4-helpernode"
#helpernode_tag = ""
#install_playbook_repo = "git:https://github.com/ocp-power-automation/ocp4-playbooks"
#install_playbook_repo = "https://github.com/ocp-power-automation/ocp4-playbooks"
#install_playbook_tag = ""
#helm_repo = "https://get.helm.sh/helm-v3.4.0-linux-ppc64le.tar.gz"

Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ variable "installer_log_level" {
variable "helpernode_repo" {
description = "Set the repo URL for using ocp4-helpernode"
# Repo for running ocp4 helpernode setup steps.
default = "git:https://github.com/RedHatOfficial/ocp4-helpernode"
default = "https://github.com/RedHatOfficial/ocp4-helpernode"
}

variable "helpernode_tag" {
Expand All @@ -269,7 +269,7 @@ variable "helpernode_tag" {
variable "install_playbook_repo" {
description = "Set the repo URL for using ocp4-playbooks"
# Repo for running ocp4 installations steps.
default = "git:https://github.com/ocp-power-automation/ocp4-playbooks"
default = "https://github.com/ocp-power-automation/ocp4-playbooks"
}

variable "install_playbook_tag" {
Expand Down

0 comments on commit 5985594

Please sign in to comment.