Skip to content

Commit

Permalink
adding 22.04 removing stale oses
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Pouliot committed Sep 25, 2024
1 parent 61d316a commit 0022f50
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions examples/ubuntu2404/cloud-init.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#cloud-config

apt:
sources:
docker.list:
source: deb [arch=arm64] https://download.docker.com/linux/ubuntu $RELEASE stable
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88

package_update: true
package_upgrade: true

packages:
- screen
- rsync
- git
- curl
- docker-ce
- docker-ce-cli
- python3-pip
- python3-dev
- python3-selinux
- python3-setuptools
- python3-venv
- libffi-dev
- gcc
- libssl-dev

groups:
- docker
system_info:
default_user:
groups: [docker]

runcmd:
- docker run -d --name registry --restart=always -p 4000:5000 -v registry:/var/lib/registry registry:2
- pip3 install -U pip
- pip3 install -U wheel
- echo 'OCI Ampere A1 Ubuntu 24.04 Example' >> /etc/motd
30 changes: 30 additions & 0 deletions examples/ubuntu2404/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Example of Ampere A1 running Ubuntu 24.04 on OCI using this module
variable "tenancy_ocid" {}
variable "user_ocid" {}
variable "fingerprint" {}
variable "private_key_path" {}
locals {
cloud_init_template_path = "${path.cwd}/cloud-init.yaml.tpl"
}
module "oci-ampere-a1" {
source = "github.com/amperecomputing/terraform-oci-ampere-a1"
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"
oci_os_image = "ubuntu2404"
instance_prefix = "ampere-a1-ubuntu-2404"
oci_vm_count = "1"
ampere_a1_vm_memory = "24"
ampere_a1_cpu_core_count = "4"
cloud_init_template_file = local.cloud_init_template_path
}
output "oci_ampere_a1_private_ips" {
value = module.oci-ampere-a1.ampere_a1_private_ips
}
output "oci_ampere_a1_public_ips" {
value = module.oci-ampere-a1.ampere_a1_public_ips
}
7 changes: 7 additions & 0 deletions images.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ output "oci_aarch64_images_map" {
data.oci_core_images.oraclelinux-9-aarch64.images.0.display_name,
data.oci_core_images.oraclelinux-8-aarch64.images.0.display_name,
data.oci_core_images.oraclelinux-7_9-aarch64.images.0.display_name,
data.oci_core_images.ubuntu-24_04-aarch64.images.0.display_name,
data.oci_core_images.ubuntu-22_04-aarch64.images.0.display_name,
data.oci_core_images.ubuntu-20_04-aarch64.images.0.display_name,
# Ubuntu 18.04 no longer in OCI catalog
Expand All @@ -29,6 +30,7 @@ output "oci_aarch64_images_map" {
data.oci_core_images.oraclelinux-9-aarch64.images.0.id,
data.oci_core_images.oraclelinux-8-aarch64.images.0.id,
data.oci_core_images.oraclelinux-7_9-aarch64.images.0.id,
data.oci_core_images.ubuntu-24_04-aarch64.images.0.id,
data.oci_core_images.ubuntu-22_04-aarch64.images.0.id,
data.oci_core_images.ubuntu-20_04-aarch64.images.0.id,
# Ubuntu 18.04 no longer in OCI catalog
Expand All @@ -50,6 +52,7 @@ locals {
data.oci_core_images.oraclelinux-9-aarch64.images.0.display_name,
data.oci_core_images.oraclelinux-8-aarch64.images.0.display_name,
data.oci_core_images.oraclelinux-7_9-aarch64.images.0.display_name,
data.oci_core_images.ubuntu-24_04-aarch64.images.0.display_name,
data.oci_core_images.ubuntu-22_04-aarch64.images.0.display_name,
data.oci_core_images.ubuntu-20_04-aarch64.images.0.display_name,
# Ubuntu 18.04 no longer in OCI catalog
Expand All @@ -66,6 +69,7 @@ locals {
data.oci_core_images.oraclelinux-9-aarch64.images.0.id,
data.oci_core_images.oraclelinux-8-aarch64.images.0.id,
data.oci_core_images.oraclelinux-7_9-aarch64.images.0.id,
data.oci_core_images.ubuntu-24_04-aarch64.images.0.id,
data.oci_core_images.ubuntu-22_04-aarch64.images.0.id,
data.oci_core_images.ubuntu-20_04-aarch64.images.0.id,
# Ubuntu 18.04 no longer in OCI catalog
Expand Down Expand Up @@ -103,6 +107,9 @@ locals {
oraclelinux79 = {
os_image_id = data.oci_core_images.oraclelinux-7_9-aarch64.images.0.id
}
ubuntu2404 = {
os_image_id = data.oci_core_images.ubuntu-24_04-aarch64.images.0.id
}
ubuntu2204 = {
os_image_id = data.oci_core_images.ubuntu-22_04-aarch64.images.0.id
}
Expand Down
28 changes: 28 additions & 0 deletions ubuntu2404.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# gets the Ubuntu 24.04 images, the first result in the images list (index 0) is the latest patched version
# filter to specific display name pattern to include the aarch64 images

data "oci_core_images" "ubuntu-24_04-aarch64" {
compartment_id = var.tenancy_ocid

operating_system = "Canonical Ubuntu"
operating_system_version = "24.04"

# include Aarch64 specific images
filter {
name = "display_name"
values = ["^.*-aarch64-.*$"]
regex = true
}
}

# Output OCI Ubuntu 24.04 Image Name
output "Ubuntu-24_04-aarch64-latest_name" {
value = data.oci_core_images.ubuntu-24_04-aarch64.images.0.display_name
sensitive = false
}

# Output OCI Ubuntu 24.04 Image ID
output "Ubuntu-24_04-aarch64-latest_ocid" {
value = data.oci_core_images.ubuntu-24_04-aarch64.images.0.id
sensitive = false
}

0 comments on commit 0022f50

Please sign in to comment.