infrastructure provisioning for jd edwards enterpriseone ... · this is because terraform apply and...

33
Infrastructure Provisioning for JD Edwards EnterpriseOne on Oracle Cloud Infrastructure O RACLE WHITE PAPER | NOVEMBER 2017

Upload: others

Post on 04-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

Infrastructure Provisioning for JD Edwards EnterpriseOne on Oracle Cloud Infrastructure O R A C L E W H I T E P A P E R | N O V E M B E R 2 0 1 7

Page 2: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

1 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

Page 3: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

2 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

Table of Contents

Introduction ................................................................................................................ 3

Prerequisites .............................................................................................................. 3

Installing Terraform .................................................................................................... 3

Editing Inputs for JD Edwards EnterpriseOne Infrastructure Provisioning ................. 4

Running Scripts to Provision Infrastructure for JD Edwards EnterpriseOne ............... 6

Best Practices ............................................................................................................ 8

Disclaimer .................................................................................................................. 9

Appendix A .............................................................................................................. 11

Page 4: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

3 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

Introduction

Terraform is an orchestration engine and language that enables you to safely and predictably create, change,

and improve production infrastructure. Terraform is an open source tool that codifies APIs into declarative

configuration files that can be shared amongst team members, treated as code, edited, reviewed, and

versioned. This document provides a technical overview of automated JD Edwards EnterpriseOne

infrastructure provisioning on Oracle Cloud Infrastructure using Terraform.

For more information on Terraform, see https://www.terraform.io/intro/index.html and the Terraform FAQ at: https://github.com/oracle/terraform-provider-oci/blob/master/docs/FAQ.md.

Prerequisites » Provision an Oracle Linux bootstrap machine where all Terraform configuration will run. This machine may be on-premise

or on a cloud network. » Ensure that the Linux machine has public internet access. » Ensure that the Oracle Cloud Infrastructure user has access to the respective compartment where the resources will be

provisioned. For more information on user access and compartments, see https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm.

» Generate the API signing keys (PEM) and the corresponding fingerprint. Both are necessary to authenticate the user to the Oracle Cloud Infrastructure account. The PEM key must not be password protected. For more information on generating PEM keys and fingerprints, see https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.

» Generate an SSH key pair. The private key must be in OpenSSH format and must not be password protected.

Installing Terraform 1. Download terraform 0.10.4 for Linux OS – 64 bit from https://www.terraform.io/downloads.html. 2. Unzip the zip file into a folder:

$unzip -o terraform_0.10.4_linux_amd64.zip 3. Add a path to the above extracted terraform file in the PATH environment variable of your .bash_profile:

$source .bash_profile

Page 5: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

4 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

4. Verify the terraform version: $terraform –version

5. Download the latest Terraform provider for Oracle Cloud Infrastructure from https://github.com/oracle/terraform-provider-oci/releases for Linux (linux.tar.gz).

6. Extract the downloaded archive linux.tar.gz:

$tar –zxvf linux.tar.gz

7. Copy the provider to the following directory. ~/.terraform.d/plugins/

Editing Inputs for JD Edwards EnterpriseOne Infrastructure Provisioning 1. Create a folder and download all the terraform configurations scripts (.tf files) from the GitHub repository, for example:

/u01/automation.

2. Edit the env-vars under the jdedeploy directory. Following are the descriptions for each of the required environment variables:

» TF_VAR_tenancy_ocid – Enter your tenancy ID.

You can find the tenancy ID at the bottom of Oracle Cloud Infrastructure Console. » TF_VAR_user_ocid – Enter your user ID.

For more details on how to find your tenancy ocid and user ocid, see https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#Other.

» TF_VAR_fingerprint - Enter the fingerprint generated in the prerequisite step. » TF_VAR_compartment_ocid – Enter the compartment OCID created in the prerequisite step. » TF_VAR_private_key_path – Enter the full absolute path to the API PEM private key generated in the prerequisite

step.

3. Edit the variables.tf under the jdedeploy directory and enter the required values. All of the input parameters in the variables.tf contain a description to assist you in entering the required values. Provide input for the following parameters in variables.tf:

» region – The region where infrastructure will be provisioned.

Valid values are ‘phoenix’/’Ashburn‘ » ssh_public_key – The full absolute path to the ssh public key (.pub) file.

This key will be used to access VMs provisioned by terraform. » ssh_private_key – The full absolute path to the ssh private key in openssh format.

The private key should not be password protected. » AD – The availability domain where the provisioning will run.

Valid values are: 1, 2, or 3. You can specify only one AD value. 1 = Availability Domain 1 2 = Availability Domain 2

Page 6: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

5 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

3 = Availability Domain 3 » jde_ent_count – The number of Enterprise Servers to be provisioned in the above specified Availability Domain. » jde_web_count – The number of Web servers to be provisioned in the above specified Availability Domain. » jde_win_count – The number of Windows servers to be provisioned in the above specified Availability Domain.

» jde_smc_count – The number of SMC servers to be provisioned in the above specified Availability Domain.

It is recommended to use only one SMC server in any one of the Availability Domains. One SMC server will monitor all of the EnterpriseOne servers across the domains.

Below are the variables to define the shape for the instances. For more details on available shape, see https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Concepts/computeoverview.htm.

» web_shape - Shape for Web servers » ent_shape - Shape for Linux Enterprise Servers » smc_shape - Shape for Server Manager Servers » db_shape - Shape for DBS instance » win_shape - Shape for Windows servers

The below variables are used to define the operating system for the respective EnterpriseOne Servers. For more details on Oracle provided images on their versions, refer to https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm.

» SMInstanceOS - Operating system used for SMC server » EntInstanceOS - Operating system used for Enterprise Server » WebInstanceOS - Operating system used for Web Server » WinInstanceOS - Operating system used for Deployment Server. By default, this value is Windows. The Deployment

Server is always on Windows OS. Do not change this value. » InstanceOSVersion - Linux OS version for all JDE Linux servers. Do not change this value. » WinInstanceOSVersion - Windows OS version for Deployment Servers

Below are the variables for creating the block volumes for the respective EnterpriseOne Servers. For information on block volumes, see https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/overview.htm.

The minimum block volume size is 50 GB and the value must be entered in MB.

» ent_block_size – The size of the storage volume on the Enterprise Server. » web_block_size – The size of the storage volume for the Web server. » smc_block_size – The size of the storage volume for SMC server. » win_block_size – The size of the storage volume for Deployment Server.

Below are the variables for creating a common network for all EnterpriseOne Servers. For information on networking, see https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/overview.htm.

» VPC-CIDR – The IP address of the network in CIDR notation. » sub_cidr – The IP address in CIDR notation for different subnets in the above provided AD. Make sure you change

the CIDR value when changing the Availability Domain in the AD variable; otherwise, CIDR will overlap in a network, causing an error.

Page 7: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

6 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

» pubcidr – The CIDR of a public subnet. A public subnet has the security list that opens the JDE related ports for public access. SMC and JAS are attached to the public subnet, as they require the application hosted on them to be available from the public internet.

» pvtcidr – The CIDR of a private subnet. A private subnet cannot be accessed from the public internet. The Database, Deployment Server, and Enterprise Server can be kept in the private subnet.

» Bastcidr – The CIDR for a bastion subnet.

Below are the parameters to provide a valid hostname to the EnterpriseOne Servers. The hostname provided in the below sections are appended by the AD value and count of the instance. For example, if the Enterprise Server hostname is jdeprdent, the AD value is 1, and the number of Enterprise Servers is 2, then the hostname of the first Enterprise Server will be jdeprdentad1c1, and the hostname of the second Enterprise server will be jdeprdentad1c2. Make sure the hostname provided is no more than 10 characters and is alphanumeric only, with no special characters.

» ent_hostname - Enterprise Server host name » smc_hostname - SMC server hostname » db_hostname - DB server host name » jas_hostname - JAS server hostname » win_hostname - Deployment Server hostname

Below are the parameters needed for creating the Database System (DBS) instance. For more details on DBS, refer to https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/databaseoverview.htm.

» db_cpu_core_count – The core CPU count for the database. Minimum is 2. » db_edition – The database edition. » db_passwd – The SYS/SYSTEM user password. Password must be 9 to 30 characters and contain at least 2 uppercase,

2 lowercase, 2 special, and 2 numeric characters. The special characters must be _, #, or -. » db_sid – The SID name of the database. » dbversion – The database version. » domain_name – The domain name. » DBWorkload - Select the workload type that best suits your application. Valid values are:

Online Transactional Processing (OLTP) Decision Support System (DSS)

» NCharacterSet - For JD Edwards EnterpriseOne, the national character set should be set to AL16UTF16. » CharacterSet - For the database, the character set should be set to AL16UTF16. » pdb – The pluggable database name, if DB version is Oracle 12c » unix_mount_dir – The file system where the attached block volume will be allocated.

Running Scripts to Provision Infrastructure for JD Edwards EnterpriseOne After you have edited the required field in variables.tf, perform the following steps: 1. Initialize your environment variable by entering the following:

$source env-vars

2. Download all the required modules: $terraform init

Page 8: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

7 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

3. To view changes in the infrastructure before actually applying them, enter the following:

$terraform plan

4. To apply the changes to your infrastructure enter the following command:

$terraform apply

Page 9: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

8 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

Best Practices Once you have completed the provisioning in AD1 and then provisioned a resource in AD2 during the second run, you need to remove the resource from the state file (terraform.tfstate) and back it up to some other state file. Removing resources from the state file does not physically remove the resources. Resources will still be physical instances and only be removed from the terraform.tfstate file. This is because terraform apply and terraform plan always read the terraform state from the terraform.tfsate file by default. If you do a terraform plan after changing the AD value from 1 to 2 without actually removing the resource from the state file, you will be prompted that all your resource in AD1 will be destroyed and will be created in AD2, as follows:

For every resource that shows the warning (new resource required), enter the following command to remove ‘tf_linux’ resource from the terraform.tfstate file:

$terraform state rm module.jdeent.baremetal_core_instance.tf_linux -backup=mybackup.tfstate

Once you remove all resources from the terraform.tfstate file, you can do a terraform plan to check that the existing resource is not destroyed and recreated again in AD2. A backup file is created in your existing directory with a timestamp and .backup extension, it will include the resource removed from the terraform.tfstate file. As of now, you can provision only one DB server from the scripts. After provisioning resources from terraform, do not delete the instances from the OCI console manually. Use terraform destroy to destroy the infrastructure created.

When changing the input parameter AD value in variables.tf, make sure you also change the CIDR values for Public, Private, and Bastion subnets; otherwise, it will overlap with the existing values. These three subnets are created for each Availability Domain.

For more information on terraform commands, refer to https://www.terraform.io/docs/commands/index.html.

Page 10: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

9 | INFRASTRUCTURE PROVISIONING FOR JD EDWARDS ENTERPRISEONE ON ORACLE CLOUD INFRASTRUCTURE

Disclaimer » Terraform configuration scripts do not attach storage to Windows VM. This is because of known issues in the terraform oci

provider for running winrm to execute the PowerShell command on the remote machine. » Terraform configuration scripts do not provision a VM with WebLogic server. This is because Oracle Cloud Infrastructure

does not have any PaaS service for the web tier. As a workaround, first provision a vanilla VM using scripts and then install a WebLogic server manually on top of that.

Page 11: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by
Page 12: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

Appendix A

Sample Terraform Code Snippets

To use the sample Terraform code snippets, create a Terraform_Snippets directory and the following sub-directories:

» jdedeploy » unix » db » windows » keys

Each sub-directory will contain Terraform configuration scripts you create with the below code snippets. Copy and paste the below code snippets in to create above configuration files.

jdedeploy

The jdedeploy sub-directory contains the following Terraform configuration scripts:

datasource.tf env- vars jdeinfra_networks.tf jdeinfra.tf variables.tf

datasource.tf

data "oci_identity_availability_domains" "ADs" { compartment_id = "${var.tenancy_ocid}" } # Gets the OCID of the OS image to use data "oci_core_images" "SMImageOCID" { compartment_id = "${var.compartment_ocid}" operating_system = "${var.SMInstanceOS == "Linux" ? var.LinuxInstanceOS : var.WinInstanceOS}" operating_system_version = "${var.SMInstanceOS == "Linux" ? var.LinuxInstanceOSVersion : var.WinInstanceOSVersion}" } data "oci_core_images" "EntImageOCID" { compartment_id = "${var.compartment_ocid}" operating_system = "${var.EntInstanceOS == "Linux" ? var.LinuxInstanceOS : var.WinInstanceOS}" operating_system_version = "${var.EntInstanceOS == "Linux" ? var.LinuxInstanceOSVersion : var.WinInstanceOSVersion}" } data "oci_core_images" "WebImageOCID" { compartment_id = "${var.compartment_ocid}" operating_system = "${var.WebInstanceOS == "Linux" ? var.LinuxInstanceOS : var.WinInstanceOS}" operating_system_version = "${var.WebInstanceOS == "Linux" ? var.LinuxInstanceOSVersion : var.WinInstanceOSVersion}" }

Page 13: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

data "oci_core_images" "DepImageOCID" { compartment_id = "${var.compartment_ocid}" operating_system = "${var.WinInstanceOS}" operating_system_version = "${var.WinInstanceOSVersion}"

env-vars

export TF_VAR_tenancy_ocid="<Enter your tenancy Id>" export TF_VAR_user_ocid="<Enter your user id>" export TF_VAR_fingerprint="<Enter your fingerprints>" export TF_VAR_compartment_ocid="<Enter your compartment Id>" export TF_VAR_private_key_path="<Enter full path to PEM private key>" export TF_LOG=INFO export TF_LOG_PATH=./terraform.log

jdeinfra_network.tf

resource "oci_core_virtual_network" "jdevcn" { cidr_block = "${var.VPC-CIDR}" compartment_id = "${var.compartment_ocid}" display_name = "jdevcn" dns_label = "jdevcn" } resource "oci_core_internet_gateway" "CompleteIG" { compartment_id = "${var.compartment_ocid}" display_name = "CompleteIG" vcn_id = "${oci_core_virtual_network.jdevcn.id}" } resource "oci_core_route_table" "RouteForComplete" { compartment_id = "${var.compartment_ocid}" vcn_id = "${oci_core_virtual_network.jdevcn.id}" display_name = "RouteTableForComplete" route_rules { cidr_block = "0.0.0.0/0" network_entity_id = "${oci_core_internet_gateway.CompleteIG.id}" } } resource "oci_core_security_list" "PubList" { compartment_id = "${var.compartment_ocid}" display_name = "PublicSecList" vcn_id = "${oci_core_virtual_network.jdevcn.id}" egress_security_rules = [{ destination = "0.0.0.0/0" protocol = "6" }]

Page 14: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

ingress_security_rules = [{ tcp_options { "max" = 80 "min" = 80 } protocol = "6" source = "0.0.0.0/0" }, { tcp_options { "max" = 22 "min" = 22 } protocol = "6" source = "0.0.0.0/0" }, { tcp_options { "max" = 443 "min" = 443 } protocol = "6" source = "0.0.0.0/0" }, { tcp_options { "max" = 8999 "min" = 8999 } protocol = "6" source = "0.0.0.0/0" }, { tcp_options { "max" = 7001 "min" = 7001 } protocol = "6" source = "0.0.0.0/0" }, { tcp_options { "max" = 8080 "min" = 8080

Page 15: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

} protocol = "6" source = "0.0.0.0/0" } ] } resource "oci_core_security_list" "PvtList" { compartment_id = "${var.compartment_ocid}" display_name = "PvtSecList" vcn_id = "${oci_core_virtual_network.jdevcn.id}" egress_security_rules = [{ protocol = "6" destination = "${var.VPC-CIDR}" }] ingress_security_rules = [ { tcp_options { "max" = 22 "min" = 22 } protocol = "6" source = "0.0.0.0/0" }, { tcp_options { "max" = 6026 "min" = 6017 } protocol = "6" source = "${var.VPC-CIDR}" }, { tcp_options { "max" = 14506 "min" = 14501 } protocol = "6" source = "${var.VPC-CIDR}" }, { tcp_options { "max" = 1521 "min" = 1521 } protocol = "6"

Page 16: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

source = "${var.VPC-CIDR}" }, { tcp_options { "max" = 3389 "min" = 3389 } protocol = "6" source = "0.0.0.0/0" } ] } resource "oci_core_security_list" "BastList" { compartment_id = "${var.compartment_ocid}" display_name = "BastionSecList" vcn_id = "${oci_core_virtual_network.jdevcn.id}" egress_security_rules = [{ protocol = "6" destination = "0.0.0.0/0" }] ingress_security_rules = [{ tcp_options { "max" = 22 "min" = 22 } protocol = "6" source = "0.0.0.0/0" } ] } resource "oci_core_subnet" "PubSubnet" { #count = "${var.AD == "1" ? 1 : 0}" availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" cidr_block = "${lookup(var.sub_cidr, "pubcidr")}" display_name = "pubsubad${var.AD}" dns_label = "pubsubad${var.AD}" compartment_id = "${var.compartment_ocid}" vcn_id = "${oci_core_virtual_network.jdevcn.id}" route_table_id = "${oci_core_route_table.RouteForComplete.id}" security_list_ids = ["${oci_core_security_list.PubList.id}"] dhcp_options_id = "${oci_core_virtual_network.jdevcn.default_dhcp_options_id}" }

Page 17: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

resource "oci_core_subnet" "PvtSubnet" { #count = "${var.AD == "1" ? 1 : 0}" availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" cidr_block = "${lookup(var.sub_cidr, "pvtcidr")}" display_name = "pvtsubad${var.AD}" dns_label = "pvtsubad${var.AD}" compartment_id = "${var.compartment_ocid}" vcn_id = "${oci_core_virtual_network.jdevcn.id}" route_table_id = "${oci_core_route_table.RouteForComplete.id}" security_list_ids = ["${oci_core_security_list.PvtList.id}"] dhcp_options_id = "${oci_core_virtual_network.jdevcn.default_dhcp_options_id}" } resource "oci_core_subnet" "BastSubnet" { #count = "${var.AD == "1" ? 1 : 0}" availability_domain = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" cidr_block = "${lookup(var.sub_cidr, "bastcidr")}" display_name = "bastsubad${var.AD}" dns_label = "bastsubad${var.AD}" compartment_id = "${var.compartment_ocid}" vcn_id = "${oci_core_virtual_network.jdevcn.id}" route_table_id = "${oci_core_route_table.RouteForComplete.id}" security_list_ids = ["${oci_core_security_list.BastList.id}"] dhcp_options_id = "${oci_core_virtual_network.jdevcn.default_dhcp_options_id}" }

jdeinfra.tf

provider "oci" { tenancy_ocid = "${var.tenancy_ocid}" user_ocid = "${var.user_ocid}" fingerprint = "${var.fingerprint}" private_key_path = "${var.private_key_path}" region = "us-${var.region}-1" disable_auto_retries = "true" } module "jdeent" { source = "../unix" instance_count = "${var.jde_ent_count}"

Page 18: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

ad_name = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" compartment_name = "${var.compartment_ocid}" hostname = "${var.ent_hostname}${var.AD}" image_name = "${lookup(data.oci_core_images.EntImageOCID.images[0], "id")}" shape_name = "${var.ent_shape}" subnet_name = "${oci_core_subnet.PvtSubnet.id}" unix_mount_directory = "${var.unix_mount_dir}" block_size = "${var.ent_block_size}" block_ad = "ent_block_ad${var.AD}" ssh_public_key= "${var.ssh_public_key}" ssh_private_key = "${var.ssh_private_key}" } output "ent_ip" { value = ["${module.jdeent.unixpublicip}"] } module "jdeweb" { source = "../unix" instance_count = "${var.jde_web_count}" ad_name = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" compartment_name = "${var.compartment_ocid}" hostname = "${var.jas_hostname}ad${var.AD}" image_name = "${lookup(data.oci_core_images.WebImageOCID.images[0], "id")}" shape_name = "${var.web_shape}" subnet_name = "${oci_core_subnet.PubSubnet.id}" ssh_public_key= "${var.ssh_public_key}" ssh_private_key = "${var.ssh_private_key}" unix_mount_directory = "${var.unix_mount_dir}" block_size = "${var.web_block_size}" block_ad = "web_block_${var.AD}" } output "jdeweb_ip" { value = ["${module.jdeweb.unixpublicip}"] } module "jdesmc" { source = "../unix" instance_count = "${var.jde_smc_count}" ad_name = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" compartment_name = "${var.compartment_ocid}" hostname = "${var.smc_hostname}ad${var.AD}"

Page 19: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

image_name = "${lookup(data.oci_core_images.SMImageOCID.images[0], "id")}" shape_name = "${var.smc_shape}" subnet_name = "${oci_core_subnet.PubSubnet.id}" ssh_public_key= "${var.ssh_public_key}" ssh_private_key = "${var.ssh_private_key}" unix_mount_directory = "${var.unix_mount_dir}" block_size = "${var.smc_block_size}" block_ad = "smc_block_${var.AD}" } output "jdesmc_ip" { value = ["${module.jdesmc.unixpublicip}"] } #DB module "jdedb" { source = "../db" ad_name = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" compartment_name = "${var.compartment_ocid}" db_core_cpu = "${var.db_cpu_core_count}" db_edition = "${var.db_edition}" dbpasswd = "${var.db_passwd}" db_sid = "${var.db_sid}" pdbname = "${var.pdb}" char_set = "${var.CharacterSet}" nchar_set = "${var.NCharacterSet}" DB_Workload = "${var.DBWorkload}" dbversion = "${var.dbversion}" hostname = "${var.db_hostname}ad${var.AD}" shape_name = "${var.db_shape}" subnet_name = "${oci_core_subnet.PvtSubnet.id}" ssh_public_key = "${var.ssh_public_key}" ssh_private_key = "${var.ssh_private_key}" } output "dbip" { value = "${module.jdedb.DBNodePublicIP}" } #WIN

Page 20: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

module "jdewin" { source = "../win" instance_count = "${var.jde_win_count}" ad_name = "${lookup(data.oci_identity_availability_domains.ADs.availability_domains[var.AD - 1],"name")}" compartment_name = "${var.compartment_ocid}" hostname = "${var.win_hostname}ad${var.AD}" shape_name = "${var.win_shape}" image_name = "${lookup(data.oci_core_images.DepImageOCID.images[0], "id")}" subnet_name = "${oci_core_subnet.PvtSubnet.id}" block_size = "${var.win_block_size}" block_ad = "win_block_${var.AD}" } output "winips" { value = "${module.jdewin.InstancePublicIP}" }

variables.tf

variable "tenancy_ocid" {} variable "user_ocid" {} variable "fingerprint" {} variable "private_key_path" {} variable "compartment_ocid" {} variable "region" { description = "Region for infrastructure provisioning. Valid value are phoenix/ashburn" default = "phoenix" } variable "ssh_public_key" { description = "Full absolute path to SSH Public key" default = "/u01/automation/keys/dbcs.pub" } variable "ssh_private_key" { description = "Full absolute path to SSH Private key.Make sure this key is not password enabled" default = "/u01/automation/keys/dbcs.ssh" } variable "AD" { description = "Availability Domain in which provisioning will run" default = "1" }

Page 21: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

variable "jde_ent_count" { description = "Number of enterprise server to be provisioned in above specified Availability Domain" default = "0" } variable "jde_web_count" { description = "Number of Web server to be provisioned in above specified Availablity Domain" default = "0" } variable "jde_win_count" { description = "Number of Windows server to be provisioned in above specified Availability Domain" default = "0" } variable "jde_smc_count" { description = "Number of SMC server to be provisioned in above specified Availability Domain.Generally its recommended to use only one SMC in anyone of AD ehich will monitor JDE server accross domains" default = "0" } variable "sub_cidr" { description = "IP address in CIDR notation for different subnet in above provided AD. Make sure you change CIRD value when changing Availability Domain in 'AD' variable otherwise if not changed then CIDR will overlap in a Network causing error" default = { "pubcidr" = "10.0.4.0/24" "pvtcidr" = "10.0.5.0/24" "bastcidr" = "10.0.6.0/24" } } variable "web_shape" { description = "Shape for your Linux Web servers" default = "VM.Standard1.1" } variable "ent_shape" { description = "Shape for your Linux Enterprise Servers" default = "VM.Standard1.1"

Page 22: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

} variable "smc_shape" { description = "Shape for you Server Manager Servers" default = "VM.Standard1.1" } variable "db_shape" { description = "Shape for your DBS instance" default = "BM.DenseIO1.36" } variable "win_shape" { default = "VM.Standard1.2" description = "Windows server shape" } variable "SMInstanceOS" { description = "OS for all SM servers. No need to change this" default = "Linux" } variable "EntInstanceOS" { description = "OS for all Enterprise servers. No need to change this" default = "Linux" } variable "WebInstanceOS" { description = "OS for all Web servers. No need to change this" default = "Linux" } variable "LinuxInstanceOSVersion" { description = "Linux OS version for JDE web,ent,smc servers" default = "7.3" } variable "LinuxInstanceOS" { description = "OS for all UNIX servers. No need to change this" default = "Oracle Linux" } variable "WinInstanceOS" { description = "OS for deployment server.No need to change this" default = "Windows"

Page 23: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

} variable "WinInstanceOSVersion" { description = "Windows OS version for deployment server" default = "Server 2012 R2 Standard" } variable "ent_block_size" { description = "Size of storage volume for Enterprise server. Minimum is 50GB i.e. 51200 MB.Provide value in MB" default = "51200" } variable "web_block_size" { description = "Size of storage volume for Web server. Minimum is 50GB i.e. 51200 MB.Provide value in MB" default = "51200" } variable "smc_block_size" { description = "Size of storage volume for SMC server. Minimum is 50GB i.e. 51200 MB.Provide value in MB" default = "51200" } variable "win_block_size" { description = "Size of storage volume for Deployment server. Minimum is 50GB i.e. 51200 MB.Provide value in MB" default = "51200" } variable "VPC-CIDR" { description = "IP address of Network in CIDR notation" default = "10.0.0.0/16" } variable "ent_hostname" { description = "Enterprise server host name" default = "jdeent" } variable "smc_hostname" { description = "SMC server hostname" default = "jdesmc" }

Page 24: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

variable "db_hostname" { description = "DB server host name" default = "jdeprddb" } variable "jas_hostname" { description = "JAS server hostname" default = "jdeajas" } variable "win_hostname" { description = "Deployment server hostname" default = "jdewin" } variable "db_cpu_core_count"{ description = "Core CPU count for DB. Minimum is 2" default = "2" } variable "db_edition"{ description = "DB Edition" default = "ENTERPRISE_EDITION" } variable "db_passwd" { description = "SYS/SYSTEM user password.Password must be 9 to 30 characters and contain at least 2 uppercase, 2 lowercase, 2 special, and 2 numeric characters. The special characters must be _, #, or -." default = "WEl_come#123" } variable "db_sid" { description = "SID name of database" default = "orcl" } variable "dbversion" { description = "DB version" default = "12.1.0.2" } variable "domain_name" {

Page 25: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

description = "Domain Name" default = "jdedwards.com" } variable "DBWorkload" { default = "OLTP" } variable "NCharacterSet" { description = "For JDE National character set should be set to AL16UTF16" default = "AL16UTF16" } variable "CharacterSet" { description = "For Databasecharacter set should be set to AL16UTF16" default = "AL32UTF8" } variable "pdb" { description = "Pluggable Database Name" default = "jdeorcl" } variable "unix_mount_dir" { description = "Name of file system where atatched storage will be mounted" default = "/u01" }

unix

This folder contains following terraform configuration files to create Linux VM and create/attach storage to it

blocks.tf main.tf outputs.tf variables.tf

blocks.tf

resource "oci_core_volume" "unix_block" { availability_domain = "${var.ad_name}" compartment_id = "${var.compartment_name}" #If mount directory is specifies then number of block = number of instances .If mount dir is not specified then count = 0 count = "${length(var.unix_mount_directory) > 1 ? var.instance_count : 0 }", display_name = "${var.block_ad}_${count.index+1}" size_in_mbs = "${var.block_size}" }

Page 26: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

resource "oci_core_volume_attachment" "tf_unix_attach" { attachment_type = "iscsi" count = "${length(var.unix_mount_directory) > 1 ? var.instance_count : 0 }", compartment_id = "${var.compartment_name}" instance_id = "${element(oci_core_instance.tf_linux.*.id, count.index)}" volume_id = "${element(oci_core_volume.unix_block.*.id, count.index)}" provisioner "remote-exec" { connection { agent = false host = "${element(oci_core_instance.tf_linux.*.public_ip, count.index)}" user = "opc" private_key = "${file(var.ssh_private_key)}" } inline = [ "sudo service iscsi reload", "sudo -s bash -c 'iscsiadm -m node -o new -T ${self.iqn} -p ${self.ipv4}:${self.port}'", "sudo -s bash -c 'iscsiadm -m node -o update -T ${self.iqn} -n node.startup -v automatic '", "sudo -s bash -c 'iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -l '", "sudo -s bash -c 'mkfs.ext4 -F /dev/sdb'", "sudo -s bash -c 'mkdir -p ${var.unix_mount_directory}'", "sudo -s bash -c 'mount -t ext4 /dev/sdb ${var.unix_mount_directory} '" ] } }

main.tf

resource "oci_core_instance" "tf_linux" { count = "${var.instance_count}" availability_domain = "${var.ad_name}" compartment_id = "${var.compartment_name}" display_name = "${var.hostname}-${count.index+1}" hostname_label = "${var.hostname}c${count.index+1}" image = "${var.image_name}" shape = "${var.shape_name}" subnet_id = "${var.subnet_name}" metadata { ssh_authorized_keys = "${file(var.ssh_public_key)}" } provisioner "remote-exec" { connection { host = "${self.public_ip}" user = "opc" private_key = "${file(var.ssh_private_key)}"

Page 27: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

} inline = [ #"sudo yum -y update", "sudo groupadd oinstall", "sudo useradd oracle", "sudo useradd -g oinstall oracle" ] } }

outputs.tf

output "unixpublicip" { value = ["${oci_core_instance.tf_linux.*.public_ip}"] }

variables.tf

variable "instance_count" { description = "Server count" } variable "ad_name" { description = "Availability Domain name" } variable "compartment_name" { description = "Compartment name" } variable "hostname" { description = "Host name" } variable "image_name" { description ="OS Image" } variable "shape_name" { description = "Shape of Instance" } variable "ssh_private_key" { description = "SSH key" } variable "ssh_public_key" { description = "SSH key" } variable "unix_mount_directory" { description = "Mount directory of storage" }

Page 28: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

variable "block_ad" { } variable "block_size" { } variable "subnet_name" { }

db This folder will contain the following terraform configuration files to create a DBS instance: datasources.tf main.tf outputs.tf remote-exec.tf variables.tf

datasources.tf

# Get DB node list data "oci_database_db_nodes" "DBNodeList" { compartment_id = "${var.compartment_name}" db_system_id = "${oci_database_db_system.tf_jdedb.id}" } # Get DB node details data "oci_database_db_node" "DBNodeDetails" { db_node_id = "${lookup(data.oci_database_db_nodes.DBNodeList.db_nodes[0], "id")}" } # Gets the OCID of the first (default) vNIC data "oci_core_vnic" "DBNodeVnic" { vnic_id = "${data.oci_database_db_node.DBNodeDetails.vnic_id}" }

main.tf

resource "oci_database_db_system" "tf_jdedb" { availability_domain = "${var.ad_name}" compartment_id = "${var.compartment_name}" cpu_core_count = "${var.db_core_cpu}" database_edition = "${var.db_edition}" db_home { database { "admin_password" = "${var.dbpasswd}"

Page 29: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

"db_name" = "${var.db_sid}" "pdb_name" = "${var.pdbname}" "character_set" = "${var.char_set}" "ncharacter_set" = "${var.nchar_set}" "db_workload" = "${var.DB_Workload}" } db_version = "${var.dbversion}" display_name = "${var.db_sid}" } disk_redundancy = "HIGH" shape = "${var.shape_name}" subnet_id = "${var.subnet_name}" ssh_public_keys = ["${file(var.ssh_public_key)}"] display_name = "${var.hostname}" #domain = "${var.domain_name}" hostname = "${var.hostname}" }

outputs.tf

output "DBNodePublicIP" { value = ["${data.oci_core_vnic.DBNodeVnic.public_ip_address}"] }

remote-exec.tf

resource "null_resource" "remote-exec" { depends_on = ["oci_database_db_system.tf_jdedb"] provisioner "remote-exec" { connection { agent = false host = "${data.oci_core_vnic.DBNodeVnic.public_ip_address}" user = "opc" private_key = "${file(var.ssh_private_key)}" } inline = [ "sudo su - oracle -c 'echo \"export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1\" >> /home/oracle/.bash_profile'", "sudo su - oracle -c 'echo \"export ORACLE_SID=${var.db_sid}\" >> /home/oracle/.bash_profile'", "sudo su - oracle -c 'echo \"export ORACLE_BASE=/u01/app/oracle\" >> /home/oracle/.bash_profile'", "sudo su - oracle -c 'echo \"export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin\" >> /home/oracle/.bash_profile'", "sudo su - oracle -c 'source /home/oracle/.bash_profile'" ] } }

variables.tf

variable "ad_name" {

Page 30: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

description = "Availability Domain name" } variable "compartment_name" { description = "Compartment name" } variable "db_core_cpu" { } variable "db_edition" { } variable "dbpasswd" { } variable "db_sid" { } variable "dbversion" { } #variable "domain_name" { #} variable "pdbname" { } variable "char_set" { } variable "nchar_set" { } variable "DB_Workload" { } variable "hostname" { description = "Host name" } variable "shape_name" { description = "Shape of Instance" }

Page 31: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

variable "subnet_name" { description = "Subnet" } variable "ssh_public_key" { description = "SSH key" } variable "ssh_private_key" { description = "SSH key" }

Win

This folder contains the following configuration files to create a Windows VM:

blocks.tf main.tf outputs.tf variables.tf

blocks.tf

resource "oci_core_volume" "win_block" { availability_domain = "${var.ad_name}" compartment_id = "${var.compartment_name}" #If mount directory is specifies then number of block = number of instances .If mount dir is not specified then count = 0 count = "${var.instance_count}", display_name = "${var.block_ad}_${count.index+1}" size_in_mbs = "${var.block_size}" }

main.tf

resource "oci_core_instance" "tf_jdewin" { count = "${var.instance_count}" availability_domain = "${var.ad_name}" compartment_id = "${var.compartment_name}" display_name = "${var.hostname}-${count.index+1}" hostname_label = "${var.hostname}c${count.index+1}" image = "${var.image_name}" shape = "${var.shape_name}" subnet_id = "${var.subnet_name}" metadata {} }

outputs.tf

output "InstancePublicIP" {

value = ["${oci_core_instance.tf_jdewin.*.public_ip}"]

}

output "InstancePrivateIP" {

Page 32: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

value = ["${oci_core_instance.tf_jdewin.*.private_ip}"]

}

variables.tf

variable "instance_count" { description = "Server count" } variable "ad_name" { description = "Availability Domain name" } variable "compartment_name" { description = "Compartment name" } variable "hostname" { description = "Host name" } variable "image_name" { description ="OS Image" } variable "shape_name" { description = "Shape of Instance" } variable "subnet_name" { } variable "block_size" { } variable "block_ad" { }

Page 33: Infrastructure Provisioning for JD Edwards EnterpriseOne ... · This is because terraform apply and terraform planalways read the terraform state from the terraform.tfsate file by

Oracle Corporation, World Headquarters Worldwide Inquiries 500 Oracle Parkway Phone: +1.650.506.7000 Redwood Shores, CA 94065, USA Fax: +1.650.506.7200

Copyright © 2017, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 1117 Infrastructure Provisioning for JD Edwards EnterpriseOne on Oracle Cloud Infrastructure November 2017

C O N N E C T W I T H U S

blogs.oracle.com/oracle

facebook.com/oracle

twitter.com/oracle

oracle.com