Skip to content

Commit

Permalink
Fix for Terraform provisioning tinkerbell#103
Browse files Browse the repository at this point in the history
Signed-off-by: cbkhare <[email protected]>

Fix for Terraform provisioning tinkerbell#103

Fix for Terraform provisioning tinkerbell#103

Fix for Terraform provisioning tinkerbell#103

Signed-off-by: cbkhare <[email protected]>

Fix for Terraform provisioning tinkerbell#103

Signed-off-by: cbkhare <[email protected]>

Fix for Terraform provisioning tinkerbell#103

Removal of Packet references

This removes the `_packet` from the health end point and renames it to the standard `healthz`. It also renames environment variables to TINKERBELL inline with the project

Signed-off-by: thebsdbox <[email protected]>

Revert of env variables

Signed-off-by: thebsdbox <[email protected]>
  • Loading branch information
Cbkhare committed Aug 19, 2020
1 parent cadd62e commit 9db66c1
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
66 changes: 66 additions & 0 deletions deploy/terraform/install_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env bash

YUM="yum"
APT="apt"
PIP3="pip3"
YUM_CONFIG_MGR="yum-config-manager"
WHICH_YUM=$(command -v $YUM)
WHICH_APT=$(command -v $APT)
YUM_INSTALL="$YUM install"
APT_INSTALL="$APT install"
PIP3_INSTALL="$PIP3 install"
declare -a YUM_LIST=("https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm"
"docker-ce"
"docker-ce-cli"
"epel-release"
"python3")
declare -a APT_LIST=("docker"
"docker-compose")

add_yum_repo() (
$YUM_CONFIG_MGR --add-repo https://download.docker.com/linux/centos/docker-ce.repo
)

update_yum() (
$YUM_INSTALL -y yum-utils
add_yum_repo
)

update_apt() (
$APT update
DEBIAN_FRONTEND=noninteractive $APT --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
)

restart_docker_service() (
service docker restart
)

install_yum_packages() (
$YUM_INSTALL "${YUM_LIST[@]}" -y
)

install_pip3_packages() (
$PIP3_INSTALL docker-compose
)

install_apt_packages() (
$APT_INSTALL "${APT_LIST[@]}" -y
)

main() (
if [[ -n $WHICH_YUM ]]; then
update_yum
install_yum_packages
install_pip3_packages
restart_docker_service
elif [[ -n $WHICH_APT ]]; then
update_apt
install_apt_packages
restart_docker_service
else
echo "Unknown platform. Error while installing the required packages"
exit 1
fi
)

main
3 changes: 3 additions & 0 deletions deploy/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ resource "packet_device" "tink-provisioner" {
billing_cycle = "hourly"
project_id = var.project_id
network_type = "hybrid"
user_data = "${file("install_package.sh")}"
}

}

# Create a device and add it to tf_project_1
Expand Down

0 comments on commit 9db66c1

Please sign in to comment.