From f843e5fffb2b797dc05e1ac7233969f87e1004c4 Mon Sep 17 00:00:00 2001 From: lolli001 Date: Fri, 19 Jul 2024 14:55:44 -0400 Subject: [PATCH] Updated --- README.md | 10 +++++++++- ansible/rhel-arm-baseline.yaml | 3 ++- buildspec.yml | 16 +++++++-------- modules/image-pipeline/build.pkr.hcl | 29 +++++++++++----------------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index c486fcb..1035740 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,13 @@ export AWS_PROFILE=229685449397-csvd-dev-gov.inf-admin-t2 aws sts get-caller-identity +git push origin main --force +git push ansible-upstream main --force +git push goss-upstream main --force + +rebecaa linn : She does x86 (get context for ARM) + + +cd ~/.aws/ + -rebecaa linn : She does x86 (get context for ARM) \ No newline at end of file diff --git a/ansible/rhel-arm-baseline.yaml b/ansible/rhel-arm-baseline.yaml index 48551e5..3eb6b5e 100644 --- a/ansible/rhel-arm-baseline.yaml +++ b/ansible/rhel-arm-baseline.yaml @@ -1,3 +1,4 @@ + --- name: RHEL ARM Baseline @@ -32,7 +33,7 @@ tasks: state: present groups: wheel shell: /bin/bash - password: "{{ 'password' | password_hash('sha512') }}" # Need to change password here + password: "{{ 'password' | password_hash('sha512') }}" # Change 'password' to a secure password or hash - name: Configure SSH for exampleuser authorized_key: diff --git a/buildspec.yml b/buildspec.yml index 140d9b1..5609c65 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -5,14 +5,12 @@ phases: runtime-versions: python: 3.11 commands: - - echo "Installing dependencies..." - - pip install ansible boto3 - + - echo "Installing Python version 3.11 ... + - pyenv global $PYTHON_311_VERSION + - echo "Installing Ansible ..." + - pip3 install ansible build: commands: - - echo "Running Packer build..." - - packer build -var project_name=rhel-arm-image-pipeline-demo -var ansible_dir=${CODEBUILD_SRC_DIR_SourceAnsibleOutput} build.pkr.hcl - -artifacts: - files: - - '**/*' + - echo "Building with Packer ..." + - packer init build.pkr.hcl + - packer build -var project_name=rhel-arm-image-pipeline-demo -var ansible_dir=${CODEBUILD_SRC_DIR}/ansible build.pkr.hcl \ No newline at end of file diff --git a/modules/image-pipeline/build.pkr.hcl b/modules/image-pipeline/build.pkr.hcl index c72da85..ffc5da8 100644 --- a/modules/image-pipeline/build.pkr.hcl +++ b/modules/image-pipeline/build.pkr.hcl @@ -1,18 +1,5 @@ -packer { - required_plugins { - amazon = { - version = ">= 1.0.0" - source = "github.com/hashicorp/amazon" - } - ansible = { - version = ">= 1.0.0" - source = "github.com/hashicorp/ansible" - } - } -} - -source "amazon-ebs" "rhel-arm" { - ami_name = "${var.project_name}-${timestamp()}" +source "amazon-ebs" "rhel" { + ami_name = "rhel-arm-{{timestamp}}" instance_type = "t4g.micro" region = "us-gov-west-1" source_ami = "ami-0ce8fc041db68907c" @@ -20,9 +7,15 @@ source "amazon-ebs" "rhel-arm" { } build { - sources = ["source.amazon-ebs.rhel-arm"] + sources = ["source.amazon-ebs.rhel"] provisioner "ansible" { - playbook_file = "${var.ansible_dir}/rhel-arm-baseline.yaml" + playbook_file = "ansible/rhel-arm-baseline.yaml" } -} + + post-processor "shell-local" { + inline = [ + "echo 'Build finished!'", + ] + } +} \ No newline at end of file