From b28a3c0ff47c6cf91c3b394250837903ff4f0a7f Mon Sep 17 00:00:00 2001 From: Gev Date: Wed, 10 Jul 2024 20:16:40 +0400 Subject: [PATCH 1/2] ansible file path changed in packer --- packer/PosgresawsTemplate.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packer/PosgresawsTemplate.pkr.hcl b/packer/PosgresawsTemplate.pkr.hcl index d19071f..72212e2 100644 --- a/packer/PosgresawsTemplate.pkr.hcl +++ b/packer/PosgresawsTemplate.pkr.hcl @@ -26,7 +26,7 @@ build { sources = ["source.amazon-ebs.example"] provisioner "ansible" { - playbook_file = "/home/runner/work/Team1-react-rust-postgres/Team1-react-rust-postgres/packer_ansible/ansible/setup_postgresql.yml" + playbook_file = "ansible/setup_postgresql.yml" } } From 24d34911ebe56a7e86b0ef4d382ba0650bfff213 Mon Sep 17 00:00:00 2001 From: Gev Date: Wed, 10 Jul 2024 20:18:08 +0400 Subject: [PATCH 2/2] typo workflow file removed --- .github/workflows/build-amii.yml | 56 -------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 .github/workflows/build-amii.yml diff --git a/.github/workflows/build-amii.yml b/.github/workflows/build-amii.yml deleted file mode 100644 index 224b1e7..0000000 --- a/.github/workflows/build-amii.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Build AMI with Packer and Ansible - -on: - workflow_dispatch: - -jobs: - build-ami: - runs-on: ubuntu-latest - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - #POSTGRES_USER: ${{ secrets.POSTGRES_USER }} - #POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - #POSTGRES_DB: ${{ secrets.POSTGRES_DB }} - - steps: - - name: Checkout ansible-packer branch - uses: actions/checkout@v2 - with: - ref: ansible-packer - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.11' - - - name: Install Ansible - run: | - sudo apt update - sudo apt install -y ansible - - - name: Install Latest Packer and Initialize - run: | - wget -O packer.zip https://releases.hashicorp.com/packer/1.11.1/packer_1.11.1_linux_amd64.zip - unzip -o packer.zip -d packer_install - sudo mv packer_install/packer /usr/local/bin/ - rm -rf packer.zip packer_install # Clean up extracted files and zip - packer --version # Verify Packer installation - packer init packer/PosgresawsTemplate.pkr.hcl - - - name: Validate Packer Template - run: packer validate packer/PosgresawsTemplate.pkr.hcl - - - name: Run Packer build and print AMI ID - run: | - packer build -machine-readable -var aws_access_key=${{ secrets.AWS_ACCESS_KEY_ID }} -var aws_secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY }} packer/PosgresawsTemplate.pkr.hcl | tee packer_output.txt - ami_id=$(awk -F, '$0 ~/artifact,0,id/ {print $6}' packer_output.txt) - echo "AMI_ID=$ami_id" >> $GITHUB_ENV - echo "AMI_ID=$ami_id" # Print AMI ID to console - - - name: Save AMI_ID as artifact - uses: actions/upload-artifact@v2 - with: - name: packer-output - path: packer_output.txt -