app-sre: Update AMIs to rhel-9.0

This commit is contained in:
Diaa Sami 2022-09-23 15:17:23 +02:00 committed by Diaa Sami
parent 49cf427e6a
commit 06fbd926ae
7 changed files with 22 additions and 22 deletions

View file

@ -27,7 +27,7 @@
# We need EPEL for monit # We need EPEL for monit
- name: Add EPEL - name: Add EPEL
dnf: dnf:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
state: present state: present
disable_gpg_check: yes disable_gpg_check: yes
when: ansible_distribution == 'RedHat' when: ansible_distribution == 'RedHat'

View file

@ -26,10 +26,10 @@ source "amazon-ebs" "image_builder" {
build { build {
source "amazon-ebs.image_builder" { source "amazon-ebs.image_builder" {
name = "rhel-8-x86_64" name = "rhel-9-x86_64"
# Use a static RHEL 8.6 Cloud Access Image. # Use a static RHEL 9.0 Cloud Access Image.
source_ami = "ami-03debf3ebf61b20cd" source_ami = "ami-0f7c7d22de9e097ea"
ssh_username = "ec2-user" ssh_username = "ec2-user"
instance_type = "c6a.large" instance_type = "c6a.large"
aws_polling { aws_polling {
@ -38,7 +38,7 @@ build {
} }
# Set a name for the resulting AMI. # Set a name for the resulting AMI.
ami_name = "${var.image_name}-rhel-8-x86_64" ami_name = "${var.image_name}-rhel-9-x86_64"
# Apply tags to the resulting AMI/EBS snapshot. # Apply tags to the resulting AMI/EBS snapshot.
tags = { tags = {
@ -46,7 +46,7 @@ build {
Name = "${var.image_name}" Name = "${var.image_name}"
composer_commit = "${var.composer_commit}" composer_commit = "${var.composer_commit}"
os = "rhel" os = "rhel"
os_version = "8" os_version = "9"
arch = "x86_64" arch = "x86_64"
} }
@ -60,10 +60,10 @@ build {
} }
source "amazon-ebs.image_builder" { source "amazon-ebs.image_builder" {
name = "rhel-8-aarch64" name = "rhel-9-aarch64"
# Use a static RHEL 8.6 Cloud Access Image. # Use a static RHEL 9.0 Cloud Access Image.
source_ami = "ami-0c84d76d81209a0e2" source_ami = "ami-019ece25c0f135889"
ssh_username = "ec2-user" ssh_username = "ec2-user"
instance_type = "c6g.large" instance_type = "c6g.large"
aws_polling { aws_polling {
@ -72,7 +72,7 @@ build {
} }
# Set a name for the resulting AMI. # Set a name for the resulting AMI.
ami_name = "${var.image_name}-rhel-8-aarch64" ami_name = "${var.image_name}-rhel-9-aarch64"
# Apply tags to the resulting AMI/EBS snapshot. # Apply tags to the resulting AMI/EBS snapshot.
tags = { tags = {
@ -80,7 +80,7 @@ build {
Name = "${var.image_name}" Name = "${var.image_name}"
composer_commit = "${var.composer_commit}" composer_commit = "${var.composer_commit}"
os = "rhel" os = "rhel"
os_version = "8" os_version = "9"
arch = "aarch64" arch = "aarch64"
} }

View file

@ -16,8 +16,8 @@
- name: Add EPEL - name: Add EPEL
dnf: dnf:
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
state: present state: present
name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
disable_gpg_check: yes disable_gpg_check: yes
- name: Subscribe - name: Subscribe
@ -81,7 +81,7 @@
- name: Mockbuild osbuild - name: Mockbuild osbuild
shell: >- shell: >-
mock mock
-r "rhel-8-{{ ansible_architecture }}" -r "rhel-9-{{ ansible_architecture }}"
--rebuild --rebuild
--define "commit {{ OSBUILD_COMMIT }}" --define "commit {{ OSBUILD_COMMIT }}"
--define "_rpmfilename %%{NAME}.rpm" --define "_rpmfilename %%{NAME}.rpm"
@ -100,7 +100,7 @@
- name: Mockbuild osbuild-composer - name: Mockbuild osbuild-composer
shell: >- shell: >-
mock mock
-r "rhel-8-{{ ansible_architecture }}" -r "rhel-9-{{ ansible_architecture }}"
--rebuild --rebuild
--define "commit {{ COMPOSER_COMMIT }}" --define "commit {{ COMPOSER_COMMIT }}"
--define "_rpmfilename %%{NAME}.rpm" --define "_rpmfilename %%{NAME}.rpm"

View file

@ -60,10 +60,10 @@ fi
if [ "$ON_JENKINS" = true ]; then if [ "$ON_JENKINS" = true ]; then
# jenkins on main: build rhel only # jenkins on main: build rhel only
PACKER_ONLY_EXCEPT=--only=amazon-ebs.rhel-8-x86_64,amazon-ebs.rhel-8-aarch64 PACKER_ONLY_EXCEPT=--only=amazon-ebs.rhel-9-x86_64,amazon-ebs.rhel-9-aarch64
elif [ -n "$CI_COMMIT_BRANCH" ] && [ "$CI_COMMIT_BRANCH" == "main" ]; then elif [ -n "$CI_COMMIT_BRANCH" ] && [ "$CI_COMMIT_BRANCH" == "main" ]; then
# Schutzbot on main: build all except rhel # Schutzbot on main: build all except rhel
PACKER_ONLY_EXCEPT=--except=amazon-ebs.rhel-8-x86_64,amazon-ebs.rhel-8-aarch64 PACKER_ONLY_EXCEPT=--except=amazon-ebs.rhel-9-x86_64,amazon-ebs.rhel-9-aarch64
elif [ -n "$CI_COMMIT_BRANCH" ]; then elif [ -n "$CI_COMMIT_BRANCH" ]; then
# Schutzbot but not main, build everything (use dummy except) # Schutzbot but not main, build everything (use dummy except)
PACKER_ONLY_EXCEPT=--except=amazon-ebs.dummy PACKER_ONLY_EXCEPT=--except=amazon-ebs.dummy
@ -84,8 +84,8 @@ function write_inventories {
# write rpmrepo_distribution variable # write rpmrepo_distribution variable
local rpmrepo_distribution="$distro" local rpmrepo_distribution="$distro"
if [[ $rpmrepo_distribution == rhel-8 ]]; then if [[ $rpmrepo_distribution == rhel-9 ]]; then
rpmrepo_distribution=rhel-8-cdn rpmrepo_distribution=rhel-9-cdn
fi fi
cat >"$item/group_vars/all.yml" <<EOF cat >"$item/group_vars/all.yml" <<EOF
--- ---
@ -94,8 +94,8 @@ EOF
# get distro name for schutzfile # get distro name for schutzfile
local schutzfile_distro="$distro" local schutzfile_distro="$distro"
if [[ $schutzfile_distro == rhel-8 ]]; then if [[ $schutzfile_distro == rhel-9 ]]; then
schutzfile_distro=rhel-8.6 schutzfile_distro=rhel-9.0
fi fi
# get osbuild_commit from schutzfile # get osbuild_commit from schutzfile

View file

@ -14,11 +14,11 @@ import boto3
arch_info = {} arch_info = {}
arch_info["x86_64"] = { arch_info["x86_64"] = {
"ImageId": "ami-03debf3ebf61b20cd", "ImageId": "ami-0f7c7d22de9e097ea",
"InstanceType": "c5.large" "InstanceType": "c5.large"
} }
arch_info["aarch64"] = { arch_info["aarch64"] = {
"ImageId": "ami-0c84d76d81209a0e2", "ImageId": "ami-019ece25c0f135889",
"InstanceType": "c6g.large" "InstanceType": "c6g.large"
} }