diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2020-12-01 16:26:12 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-12-01 16:26:12 +0000 |
commit | 3d77cd259c2e4636af301b97c4e1acb1100ba922 (patch) | |
tree | 095f63f882ffb3cbae778f299a43608e7de8d524 /openlab | |
parent | bbca5c14be7ef2370e20b28e33a8f23a148de101 (diff) | |
parent | c81979ab0a9991b4d0e355c39aa8d55ab1b7ff69 (diff) |
Merge "Initial Terragrunt files to separate Terraform codes"
Diffstat (limited to 'openlab')
31 files changed, 954 insertions, 0 deletions
diff --git a/openlab/RegionOne/region.hcl b/openlab/RegionOne/region.hcl new file mode 100644 index 0000000..dbb3c91 --- /dev/null +++ b/openlab/RegionOne/region.hcl @@ -0,0 +1,5 @@ +# Set common variables for the region. This is automatically pulled in in the root terragrunt.hcl configuration to +# configure the remote state bucket and pass forward to the child modules as inputs. +locals { + region = "RegionOne" +}
\ No newline at end of file diff --git a/openlab/RegionOne/stage/compute/control/control-plane.sh b/openlab/RegionOne/stage/compute/control/control-plane.sh new file mode 100644 index 0000000..881f651 --- /dev/null +++ b/openlab/RegionOne/stage/compute/control/control-plane.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +DOCKER_VERSION=18.09.5 + +export DEBIAN_FRONTEND=noninteractive + +apt-get update + +curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh +mkdir -p /etc/systemd/system/docker.service.d/ +cat > /etc/systemd/system/docker.service.d/docker.conf << EOF +[Service] +ExecStart= +ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001 +EOF + +sudo usermod -aG docker ubuntu + +systemctl daemon-reload +systemctl restart docker +apt-mark hold docker-ce + +IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'` +HOSTNAME=`hostname` + +echo "$IP_ADDR $HOSTNAME" >> /etc/hosts + +docker login -u docker -p docker nexus3.onap.org:10001 + +sudo apt-get install make -y + + +exit 0
\ No newline at end of file diff --git a/openlab/RegionOne/stage/compute/control/terragrunt.hcl b/openlab/RegionOne/stage/compute/control/terragrunt.hcl new file mode 100644 index 0000000..fadd4c9 --- /dev/null +++ b/openlab/RegionOne/stage/compute/control/terragrunt.hcl @@ -0,0 +1,35 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/compute" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../../keypair", "../../network", "../../securitygroup"] +} + +inputs = { + + environment = local.environment + cluster_name = "${local.region}-${local.environment}" + + node_name = "control-node" + image = "ubuntu-18.04" + flavor = "m1.xlarge" + floating_ip_pool = "external" + # Read as File stream + user_data = file("control-plane.sh") + node_count = 3 +} diff --git a/openlab/RegionOne/stage/compute/nfsserver/nfs-server.sh b/openlab/RegionOne/stage/compute/nfsserver/nfs-server.sh new file mode 100644 index 0000000..127a554 --- /dev/null +++ b/openlab/RegionOne/stage/compute/nfsserver/nfs-server.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +apt-get update + +IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'` +HOSTNAME=`hostname` + +echo "$IP_ADDR $HOSTNAME" >> /etc/hosts + +sudo apt-get install make -y + +# nfs server +sudo apt-get install nfs-kernel-server -y + +sudo mkdir -p /nfs_share +sudo chown nobody:nogroup /nfs_share/ + +exit 0
\ No newline at end of file diff --git a/openlab/RegionOne/stage/compute/nfsserver/terragrunt.hcl b/openlab/RegionOne/stage/compute/nfsserver/terragrunt.hcl new file mode 100644 index 0000000..9d0a213 --- /dev/null +++ b/openlab/RegionOne/stage/compute/nfsserver/terragrunt.hcl @@ -0,0 +1,35 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/compute" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../../keypair", "../../network", "../../securitygroup"] +} + +inputs = { + + environment = local.environment + cluster_name = "${local.region}-${local.environment}" + + node_name = "nfsserver" + image = "ubuntu-18.04" + flavor = "m1.xlarge" + floating_ip_pool = "external" + # Read as File stream + user_data = file("nfs-server.sh") + node_count = 1 +} diff --git a/openlab/RegionOne/stage/compute/worker/terragrunt.hcl b/openlab/RegionOne/stage/compute/worker/terragrunt.hcl new file mode 100644 index 0000000..b57276a --- /dev/null +++ b/openlab/RegionOne/stage/compute/worker/terragrunt.hcl @@ -0,0 +1,35 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/compute" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../../keypair", "../../network", "../../securitygroup"] +} + +inputs = { + + environment = local.environment + cluster_name = "${local.region}-${local.environment}" + + node_name = "worker-node" + image = "ubuntu-18.04" + flavor = "m1.xlarge" + floating_ip_pool = "external" + # Read as File stream + user_data = file("worker-node.sh") + node_count = 3 +} diff --git a/openlab/RegionOne/stage/compute/worker/worker-node.sh b/openlab/RegionOne/stage/compute/worker/worker-node.sh new file mode 100644 index 0000000..4c0d52a --- /dev/null +++ b/openlab/RegionOne/stage/compute/worker/worker-node.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +DOCKER_VERSION=18.09.5 + +export DEBIAN_FRONTEND=noninteractive + +apt-get update + +curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh +mkdir -p /etc/systemd/system/docker.service.d/ +cat > /etc/systemd/system/docker.service.d/docker.conf << EOF +[Service] +ExecStart= +ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001 +EOF + +sudo usermod -aG docker ubuntu + +systemctl daemon-reload +systemctl restart docker +apt-mark hold docker-ce + +IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'` +HOSTNAME=`hostname` + +echo "$IP_ADDR $HOSTNAME" >> /etc/hosts + +docker login -u docker -p docker nexus3.onap.org:10001 + +sudo apt-get install make -y + +# install nfs +sudo apt-get install nfs-common -y + + +exit 0
\ No newline at end of file diff --git a/openlab/RegionOne/stage/concourse/terragrunt.hcl b/openlab/RegionOne/stage/concourse/terragrunt.hcl new file mode 100644 index 0000000..e5b9a93 --- /dev/null +++ b/openlab/RegionOne/stage/concourse/terragrunt.hcl @@ -0,0 +1,23 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + concourse_enabled = local.env_vars.locals.concourse_enabled +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/cicd/concourse" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../kubernetes"] +} + +inputs = { + concourse_enabled = local.concourse_enabled + +} diff --git a/openlab/RegionOne/stage/env.hcl b/openlab/RegionOne/stage/env.hcl new file mode 100644 index 0000000..8a2d58e --- /dev/null +++ b/openlab/RegionOne/stage/env.hcl @@ -0,0 +1,32 @@ +# Set common variables for the environment. This is automatically pulled in in the root terragrunt.hcl configuration to +# feed forward to the child modules. +locals { + environment = "stage" # name of the environment you use. e.g stage, prod or qa + network = "" # name of the network to connect with the Internet + + # Rancher and Kubernetes + # To access a VM, 'ssh -i ssh_private_key_path kubernetes_user@one-of-the-external-ips' + # a key pair for accessing VMs + ssh_public_key = "" + ssh_private_key_path = "" + + kubernetes_version = "v1.17.3-rancher1-1" + kubernetes_user = "ubuntu" + kubernetes_cluster_name = "rke_cluster" + + kubernetes_home = "${get_parent_terragrunt_dir()}" + + # Helm + service_account = "tiller" + namespace = "kube-system" + + # NFS provisioner for kubernetes + nfs_enabled = true + + # Keycloak + keycloak_enabled = false + olm_version = "0.16.1" # Version of Operator Lifecycle Manager + + # Concourse CICD + concourse_enabled = false +}
\ No newline at end of file diff --git a/openlab/RegionOne/stage/keycloak/terragrunt.hcl b/openlab/RegionOne/stage/keycloak/terragrunt.hcl new file mode 100644 index 0000000..61f2208 --- /dev/null +++ b/openlab/RegionOne/stage/keycloak/terragrunt.hcl @@ -0,0 +1,30 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + keycloak_enabled = local.env_vars.locals.keycloak_enabled + kubernetes_home = local.env_vars.locals.kubernetes_home + olm_version = local.env_vars.locals.olm_version +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/kubernetes/keycloak" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../kubernetes"] +} + + +inputs = { + keycloak_enabled = local.keycloak_enabled + kubernetes_home = local.kubernetes_home + olm_version = local.olm_version + crds_yaml = "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${local.olm_version}/crds.yaml" + olm_yaml = "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${local.olm_version}/olm.yaml" +} diff --git a/openlab/RegionOne/stage/keypair/terragrunt.hcl b/openlab/RegionOne/stage/keypair/terragrunt.hcl new file mode 100644 index 0000000..fe6500c --- /dev/null +++ b/openlab/RegionOne/stage/keypair/terragrunt.hcl @@ -0,0 +1,22 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + ssh_public_key = local.env_vars.locals.ssh_public_key +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/keypair" +} + +include { + path = find_in_parent_folders() +} + +inputs = { + cluster_name = "${local.region}-${local.environment}" + ssh_public_key = local.ssh_public_key +} diff --git a/openlab/RegionOne/stage/kubernetes/terragrunt.hcl b/openlab/RegionOne/stage/kubernetes/terragrunt.hcl new file mode 100644 index 0000000..63b44fd --- /dev/null +++ b/openlab/RegionOne/stage/kubernetes/terragrunt.hcl @@ -0,0 +1,52 @@ +locals { + # Automatically load account-level variables + account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + backend = local.account_vars.locals.backend + backend_state = local.account_vars.locals.backend_state + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + ssh_private_key_path = local.env_vars.locals.ssh_private_key_path + + kubernetes_user = local.env_vars.locals.kubernetes_user + kubernetes_cluster_name = local.env_vars.locals.kubernetes_cluster_name + kubernetes_home = local.env_vars.locals.kubernetes_home + + # NFS + nfs_enabled = local.env_vars.locals.nfs_enabled + + # Helm + service_account = local.env_vars.locals.service_account + namespace = local.env_vars.locals.namespace +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/kubernetes/kubernetes" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../rancher"] +} + +inputs = { + backend = local.backend + backend_state = local.backend_state + region = local.region + environment = local.environment + ssh_private_key_path = local.ssh_private_key_path + + kubernetes_user = local.kubernetes_user + kubernetes_cluster_name = local.kubernetes_cluster_name + kubernetes_home = local.kubernetes_home + + nfs_enabled = local.nfs_enabled + + service_account = local.service_account + namespace = local.namespace +}
\ No newline at end of file diff --git a/openlab/RegionOne/stage/network/terragrunt.hcl b/openlab/RegionOne/stage/network/terragrunt.hcl new file mode 100644 index 0000000..eb50f3b --- /dev/null +++ b/openlab/RegionOne/stage/network/terragrunt.hcl @@ -0,0 +1,22 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/network" +} + +include { + path = find_in_parent_folders() +} + +inputs = { + cluster_name = "${local.region}-${local.environment}" + network = local.network +} diff --git a/openlab/RegionOne/stage/rancher/terragrunt.hcl b/openlab/RegionOne/stage/rancher/terragrunt.hcl new file mode 100644 index 0000000..c0a762d --- /dev/null +++ b/openlab/RegionOne/stage/rancher/terragrunt.hcl @@ -0,0 +1,42 @@ +locals { + # Automatically load account-level variables + account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + backend = local.account_vars.locals.backend + backend_state = local.account_vars.locals.backend_state + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + ssh_private_key_path = local.env_vars.locals.ssh_private_key_path + + kubernetes_version = local.env_vars.locals.kubernetes_version + kubernetes_user = local.env_vars.locals.kubernetes_user + kubernetes_cluster_name = local.env_vars.locals.kubernetes_cluster_name + kubernetes_home = local.env_vars.locals.kubernetes_home + +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/kubernetes/rancher" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../compute/control"] +} + +inputs = { + backend = local.backend + backend_state = local.backend_state + region = local.region + environment = local.environment + ssh_private_key_path = local.ssh_private_key_path + kubernetes_version = local.kubernetes_version + kubernetes_user = local.kubernetes_user + kubernetes_cluster_name = local.kubernetes_cluster_name + kubernetes_home = local.kubernetes_home +}
\ No newline at end of file diff --git a/openlab/RegionOne/stage/securitygroup/terragrunt.hcl b/openlab/RegionOne/stage/securitygroup/terragrunt.hcl new file mode 100644 index 0000000..3ebbb09 --- /dev/null +++ b/openlab/RegionOne/stage/securitygroup/terragrunt.hcl @@ -0,0 +1,20 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/securitygroup" +} + +include { + path = find_in_parent_folders() +} + +inputs = { + cluster_name = "${local.region}-${local.environment}" +} diff --git a/openlab/RegionOne/test/compute/control/control-plane.sh b/openlab/RegionOne/test/compute/control/control-plane.sh new file mode 100644 index 0000000..881f651 --- /dev/null +++ b/openlab/RegionOne/test/compute/control/control-plane.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +DOCKER_VERSION=18.09.5 + +export DEBIAN_FRONTEND=noninteractive + +apt-get update + +curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh +mkdir -p /etc/systemd/system/docker.service.d/ +cat > /etc/systemd/system/docker.service.d/docker.conf << EOF +[Service] +ExecStart= +ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001 +EOF + +sudo usermod -aG docker ubuntu + +systemctl daemon-reload +systemctl restart docker +apt-mark hold docker-ce + +IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'` +HOSTNAME=`hostname` + +echo "$IP_ADDR $HOSTNAME" >> /etc/hosts + +docker login -u docker -p docker nexus3.onap.org:10001 + +sudo apt-get install make -y + + +exit 0
\ No newline at end of file diff --git a/openlab/RegionOne/test/compute/control/terragrunt.hcl b/openlab/RegionOne/test/compute/control/terragrunt.hcl new file mode 100644 index 0000000..fadd4c9 --- /dev/null +++ b/openlab/RegionOne/test/compute/control/terragrunt.hcl @@ -0,0 +1,35 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/compute" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../../keypair", "../../network", "../../securitygroup"] +} + +inputs = { + + environment = local.environment + cluster_name = "${local.region}-${local.environment}" + + node_name = "control-node" + image = "ubuntu-18.04" + flavor = "m1.xlarge" + floating_ip_pool = "external" + # Read as File stream + user_data = file("control-plane.sh") + node_count = 3 +} diff --git a/openlab/RegionOne/test/compute/nfsserver/nfs-server.sh b/openlab/RegionOne/test/compute/nfsserver/nfs-server.sh new file mode 100644 index 0000000..127a554 --- /dev/null +++ b/openlab/RegionOne/test/compute/nfsserver/nfs-server.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive + +apt-get update + +IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'` +HOSTNAME=`hostname` + +echo "$IP_ADDR $HOSTNAME" >> /etc/hosts + +sudo apt-get install make -y + +# nfs server +sudo apt-get install nfs-kernel-server -y + +sudo mkdir -p /nfs_share +sudo chown nobody:nogroup /nfs_share/ + +exit 0
\ No newline at end of file diff --git a/openlab/RegionOne/test/compute/nfsserver/terragrunt.hcl b/openlab/RegionOne/test/compute/nfsserver/terragrunt.hcl new file mode 100644 index 0000000..9d0a213 --- /dev/null +++ b/openlab/RegionOne/test/compute/nfsserver/terragrunt.hcl @@ -0,0 +1,35 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/compute" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../../keypair", "../../network", "../../securitygroup"] +} + +inputs = { + + environment = local.environment + cluster_name = "${local.region}-${local.environment}" + + node_name = "nfsserver" + image = "ubuntu-18.04" + flavor = "m1.xlarge" + floating_ip_pool = "external" + # Read as File stream + user_data = file("nfs-server.sh") + node_count = 1 +} diff --git a/openlab/RegionOne/test/compute/worker/terragrunt.hcl b/openlab/RegionOne/test/compute/worker/terragrunt.hcl new file mode 100644 index 0000000..b57276a --- /dev/null +++ b/openlab/RegionOne/test/compute/worker/terragrunt.hcl @@ -0,0 +1,35 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/compute" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../../keypair", "../../network", "../../securitygroup"] +} + +inputs = { + + environment = local.environment + cluster_name = "${local.region}-${local.environment}" + + node_name = "worker-node" + image = "ubuntu-18.04" + flavor = "m1.xlarge" + floating_ip_pool = "external" + # Read as File stream + user_data = file("worker-node.sh") + node_count = 3 +} diff --git a/openlab/RegionOne/test/compute/worker/worker-node.sh b/openlab/RegionOne/test/compute/worker/worker-node.sh new file mode 100644 index 0000000..4c0d52a --- /dev/null +++ b/openlab/RegionOne/test/compute/worker/worker-node.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +DOCKER_VERSION=18.09.5 + +export DEBIAN_FRONTEND=noninteractive + +apt-get update + +curl https://releases.rancher.com/install-docker/$DOCKER_VERSION.sh | sh +mkdir -p /etc/systemd/system/docker.service.d/ +cat > /etc/systemd/system/docker.service.d/docker.conf << EOF +[Service] +ExecStart= +ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry=nexus3.onap.org:10001 +EOF + +sudo usermod -aG docker ubuntu + +systemctl daemon-reload +systemctl restart docker +apt-mark hold docker-ce + +IP_ADDR=`ip address |grep ens|grep inet|awk '{print $2}'| awk -F / '{print $1}'` +HOSTNAME=`hostname` + +echo "$IP_ADDR $HOSTNAME" >> /etc/hosts + +docker login -u docker -p docker nexus3.onap.org:10001 + +sudo apt-get install make -y + +# install nfs +sudo apt-get install nfs-common -y + + +exit 0
\ No newline at end of file diff --git a/openlab/RegionOne/test/concourse/terragrunt.hcl b/openlab/RegionOne/test/concourse/terragrunt.hcl new file mode 100644 index 0000000..e5b9a93 --- /dev/null +++ b/openlab/RegionOne/test/concourse/terragrunt.hcl @@ -0,0 +1,23 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + concourse_enabled = local.env_vars.locals.concourse_enabled +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/cicd/concourse" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../kubernetes"] +} + +inputs = { + concourse_enabled = local.concourse_enabled + +} diff --git a/openlab/RegionOne/test/env.hcl b/openlab/RegionOne/test/env.hcl new file mode 100644 index 0000000..842d594 --- /dev/null +++ b/openlab/RegionOne/test/env.hcl @@ -0,0 +1,32 @@ +# Set common variables for the environment. This is automatically pulled in in the root terragrunt.hcl configuration to +# feed forward to the child modules. +locals { + environment = "test" # name of the environment you use. e.g stage, prod or qa + network = "" # name of the network to connect with the Internet + + # Rancher and Kubernetes + # To access a VM, 'ssh -i ssh_private_key_path kubernetes_user@one-of-the-external-ips' + # a key pair for accessing VMs + ssh_public_key = "" + ssh_private_key_path = "" + + kubernetes_version = "v1.17.3-rancher1-1" + kubernetes_user = "ubuntu" + kubernetes_cluster_name = "rke_cluster" + + kubernetes_home = "${get_parent_terragrunt_dir()}" + + # Helm + service_account = "tiller" + namespace = "kube-system" + + # NFS provisioner for kubernetes + nfs_enabled = true + + # Keycloak + keycloak_enabled = false + olm_version = "0.16.1" # Version of Operator Lifecycle Manager + + # Concourse CICD + concourse_enabled = false +}
\ No newline at end of file diff --git a/openlab/RegionOne/test/keycloak/terragrunt.hcl b/openlab/RegionOne/test/keycloak/terragrunt.hcl new file mode 100644 index 0000000..61f2208 --- /dev/null +++ b/openlab/RegionOne/test/keycloak/terragrunt.hcl @@ -0,0 +1,30 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + keycloak_enabled = local.env_vars.locals.keycloak_enabled + kubernetes_home = local.env_vars.locals.kubernetes_home + olm_version = local.env_vars.locals.olm_version +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/kubernetes/keycloak" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../kubernetes"] +} + + +inputs = { + keycloak_enabled = local.keycloak_enabled + kubernetes_home = local.kubernetes_home + olm_version = local.olm_version + crds_yaml = "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${local.olm_version}/crds.yaml" + olm_yaml = "https://github.com/operator-framework/operator-lifecycle-manager/releases/download/${local.olm_version}/olm.yaml" +} diff --git a/openlab/RegionOne/test/keypair/terragrunt.hcl b/openlab/RegionOne/test/keypair/terragrunt.hcl new file mode 100644 index 0000000..fe6500c --- /dev/null +++ b/openlab/RegionOne/test/keypair/terragrunt.hcl @@ -0,0 +1,22 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + ssh_public_key = local.env_vars.locals.ssh_public_key +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/keypair" +} + +include { + path = find_in_parent_folders() +} + +inputs = { + cluster_name = "${local.region}-${local.environment}" + ssh_public_key = local.ssh_public_key +} diff --git a/openlab/RegionOne/test/kubernetes/terragrunt.hcl b/openlab/RegionOne/test/kubernetes/terragrunt.hcl new file mode 100644 index 0000000..63b44fd --- /dev/null +++ b/openlab/RegionOne/test/kubernetes/terragrunt.hcl @@ -0,0 +1,52 @@ +locals { + # Automatically load account-level variables + account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + backend = local.account_vars.locals.backend + backend_state = local.account_vars.locals.backend_state + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + ssh_private_key_path = local.env_vars.locals.ssh_private_key_path + + kubernetes_user = local.env_vars.locals.kubernetes_user + kubernetes_cluster_name = local.env_vars.locals.kubernetes_cluster_name + kubernetes_home = local.env_vars.locals.kubernetes_home + + # NFS + nfs_enabled = local.env_vars.locals.nfs_enabled + + # Helm + service_account = local.env_vars.locals.service_account + namespace = local.env_vars.locals.namespace +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/kubernetes/kubernetes" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../rancher"] +} + +inputs = { + backend = local.backend + backend_state = local.backend_state + region = local.region + environment = local.environment + ssh_private_key_path = local.ssh_private_key_path + + kubernetes_user = local.kubernetes_user + kubernetes_cluster_name = local.kubernetes_cluster_name + kubernetes_home = local.kubernetes_home + + nfs_enabled = local.nfs_enabled + + service_account = local.service_account + namespace = local.namespace +}
\ No newline at end of file diff --git a/openlab/RegionOne/test/network/terragrunt.hcl b/openlab/RegionOne/test/network/terragrunt.hcl new file mode 100644 index 0000000..eb50f3b --- /dev/null +++ b/openlab/RegionOne/test/network/terragrunt.hcl @@ -0,0 +1,22 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + network = local.env_vars.locals.network +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/network" +} + +include { + path = find_in_parent_folders() +} + +inputs = { + cluster_name = "${local.region}-${local.environment}" + network = local.network +} diff --git a/openlab/RegionOne/test/rancher/terragrunt.hcl b/openlab/RegionOne/test/rancher/terragrunt.hcl new file mode 100644 index 0000000..c0a762d --- /dev/null +++ b/openlab/RegionOne/test/rancher/terragrunt.hcl @@ -0,0 +1,42 @@ +locals { + # Automatically load account-level variables + account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + backend = local.account_vars.locals.backend + backend_state = local.account_vars.locals.backend_state + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment + ssh_private_key_path = local.env_vars.locals.ssh_private_key_path + + kubernetes_version = local.env_vars.locals.kubernetes_version + kubernetes_user = local.env_vars.locals.kubernetes_user + kubernetes_cluster_name = local.env_vars.locals.kubernetes_cluster_name + kubernetes_home = local.env_vars.locals.kubernetes_home + +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/kubernetes/rancher" +} + +include { + path = find_in_parent_folders() +} + +dependencies { + paths = ["../compute/control"] +} + +inputs = { + backend = local.backend + backend_state = local.backend_state + region = local.region + environment = local.environment + ssh_private_key_path = local.ssh_private_key_path + kubernetes_version = local.kubernetes_version + kubernetes_user = local.kubernetes_user + kubernetes_cluster_name = local.kubernetes_cluster_name + kubernetes_home = local.kubernetes_home +}
\ No newline at end of file diff --git a/openlab/RegionOne/test/securitygroup/terragrunt.hcl b/openlab/RegionOne/test/securitygroup/terragrunt.hcl new file mode 100644 index 0000000..3ebbb09 --- /dev/null +++ b/openlab/RegionOne/test/securitygroup/terragrunt.hcl @@ -0,0 +1,20 @@ +locals { + # Automatically load account-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + env_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + region = local.region_vars.locals.region + environment = local.env_vars.locals.environment +} + +terraform { + source = "git::https://gerrit.onap.org/r/integration/terraform//openlab/modules/openstack/securitygroup" +} + +include { + path = find_in_parent_folders() +} + +inputs = { + cluster_name = "${local.region}-${local.environment}" +} diff --git a/openlab/account.hcl b/openlab/account.hcl new file mode 100644 index 0000000..27c5cf0 --- /dev/null +++ b/openlab/account.hcl @@ -0,0 +1,11 @@ +# Set account-wide variables. These are automatically pulled in to configure the remote state bucket in the root +# terragrunt.hcl configuration. +# For Openstack, please fill in the values below +locals { + user_name = "${get_env("user_name", "")}" # Expose environmental variables for your account + password = "${get_env("password", "")}" + project_id = "${get_env("project_id", "")}" + auth_url = "${get_env("auth_url", "")}" + backend = "" # Remote state backend. gcs for google or s3 for Amazon + backend_state = "" # GCP storage bucket or AWS S3 +} diff --git a/openlab/terragrunt.hcl b/openlab/terragrunt.hcl new file mode 100644 index 0000000..c97b495 --- /dev/null +++ b/openlab/terragrunt.hcl @@ -0,0 +1,64 @@ +locals { + # Automatically load account-level variables + account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl")) + + # Automatically load region-level variables + region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl")) + + # Automatically load environment-level variables + environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl")) + + # Extract the variables we need for easy access + user_name = local.account_vars.locals.user_name + password = local.account_vars.locals.password + auth_url = local.account_vars.locals.auth_url + project_id = local.account_vars.locals.project_id + backend = local.account_vars.locals.backend + backend_state = local.account_vars.locals.backend_state + region = local.region_vars.locals.region + environment = local.environment_vars.locals.environment +} + +remote_state { + backend = local.backend + + generate = { + path = "backend.tf" + if_exists = "overwrite_terragrunt" + } + + config = { + bucket = "${local.backend_state}" + prefix = "${path_relative_to_include()}/terraform.tfstate" + } +} + +# test/terragrunt.hcl +generate "provider" { + path = "provider.tf" + if_exists = "overwrite_terragrunt" + contents = <<EOF +provider "openstack" { + user_name = "${local.user_name}" + tenant_name = "${local.user_name}" + password = "${local.password}" + auth_url = "${local.auth_url}" + tenant_id = "${local.project_id}" + region = "${local.region}" +} +EOF +} + +# --------------------------------------------------------------------------------------------------------------------- +# GLOBAL PARAMETERS +# These variables apply to all configurations in this subfolder. These are automatically merged into the child +# `terragrunt.hcl` config via the include block. +# --------------------------------------------------------------------------------------------------------------------- + +# Configure root level variables that all resources can inherit. This is especially helpful with multi-account configs +# where terraform_remote_state data sources are placed directly into the modules. +inputs = merge( + local.account_vars.locals, + local.region_vars.locals, + local.environment_vars.locals, +) |