Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

AmpereComputing/terraform-oci-ampere-a1-AlmaLinux-ansible-awx-builder

Repository files navigation

Ampere Computing

This repo will be archived in 30 days. This is in an effort to keep a clean and timely Github presence for Ampere computing. As a result of the archiving any issues, pull requests, code, labels, milestones, projects, wiki, releases, commits, tags, branches, reactions, code scanning alerts, comments and permissions become read-only.

Please plan accordingly or reach out to repo owner with concerns.

Thank you.

-Ampere Computing

terraform-oci-ampere-a1-AlmaLinux-ansible-awx-builder

License

Description

Terraform code to launch a AlmaLinux Ampere A1 Shape on Oracle Cloud Infrastructure (OCI) Free-Tier which automatically builds Ansible AWX

Requirements

What exactly is Terraform doing

The goal of this code is to supply the minimal ammount of information to quickly have working AlmaLinux Ampere A1 instance on OCI "Always Free". This instance is confured with metadata to install required software, configure itself, and build Ansible AWX. To keep things simple, The root compartment will be used (compartment id and tenancy id are the same) when launching the instance.

Addtional tasks performed by this code:

  • Dynamically creating sshkeys to use when logging into the instance.
  • Dynamically getting region, availability zone and image id..
  • Creating necessary core networking configurations for the tenancy
  • Rendering metadata to pass into the Ampere A1 instance.
  • Launch 1 to 4 Ampere A1 instances with metadata and ssh keys.
  • Output IP information to connect to the instance.

To get started clone this repository from GitHub locally.

Configuration with terraform.tfvars

The easiest way to configure is to use a terraform.tfvars in the project directory.
Please note that Compartment OCID are the same as Tenancy OCID for Root Compartment. The following is an example of what terraform.tfvars should look like:

tenancy_ocid = "ocid1.tenancy.oc1..aaaaaaaabcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopq"
user_ocid = "ocid1.user.oc1..aaaaaaaabcdefghijklmnopqrstuvwxyz0987654321zyxwvustqrponmlkj"
fingerprint = "a1:01:b2:02:c3:03:e4:04:10:11:12:13:14:15:16:17"
private_key_path = "/home/bwayne/.oci/oracleidentitycloudservice_bwayne-04-06-03-42.pem"

Using as a Module

This can also be used as a terraform module. The following is example code for module usage:

variable "tenancy_ocid" {}
variable "user_ocid" {}
variable "fingerprint" {}
variable "private_key_path" {}

module "oci-ampere-a1-AlmaLinux" {
  source                   = "github.com/amperecomputing/terraform-oci-ampere-a1-AlmaLinux"
  tenancy_ocid             = var.tenancy_ocid
  user_ocid                = var.user_ocid
  fingerprint              = var.fingerprint
  private_key_path         = var.private_key_path
# Optional
# oci_vcn_cidr_block       = "10.2.0.0/16"
# oci_vcn_cidr_subnet      = "10.2.1.0/24"
# instance_prefix          = "ampere-a1-"
# oci_vm_count             = "4"
# ampere_a1_vm_memory      = "8"
# ampere_a1_cpu_core_count = "1"
}

output "oci_ampere_a1_private_ips" {
  value     = module.oci-ampere-a1.AmpereA1_PrivateIPs
}
output "oci_ampere_a1_public_ips" {
  value = module.oci-ampere-a1.AmpereA1_PublicIPs
}

Running Terraform

terraform init && terraform plan && terraform apply -auto-approve

Connecting to the instance

The default user is "opc".
Using an ssh client, outputted external IP address, and the key this terraform created, type the following from within the directory you ran Terraform.

ssh -i ./oci-id_rsa opc@<IPADDRESS>

Additional Terraform resources for OCI Ampere A1

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published