You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i'm using Packer on a docker image for a CI/CD on Gitlab for Amazon AWS.
Here is my packer files : `packer {
required_plugins {
amazon = {
version = "> 1.3"
source = "github.com/hashicorp/amazon"
}
ansible = {
version = "> 1.1"
source = "github.com/hashicorp/ansible"
}
}
}
variable "associate_public_ip_address" {
type = string
default = "true"
}
variable "base_ami" {
type = string
default = "ami-007855ac798b5175e"
}
variable "instance_type" {
type = string
default = "t2.micro"
}
variable "region" {
type = string
default = "us-east-1"
}
variable "app_name" {
type = string
default = "WebApp"
}
variable "server_port" {
type = string
default = "8080"
}
variable "ssh_username" {
type = string
default = "ubuntu"
}
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Hello, i'm using Packer on a docker image for a CI/CD on Gitlab for Amazon AWS.
Here is my packer files : `packer {
required_plugins {
amazon = {
version = "
> 1.3"> 1.1"source = "github.com/hashicorp/amazon"
}
ansible = {
version = "
source = "github.com/hashicorp/ansible"
}
}
}
variable "associate_public_ip_address" {
type = string
default = "true"
}
variable "base_ami" {
type = string
default = "ami-007855ac798b5175e"
}
variable "instance_type" {
type = string
default = "t2.micro"
}
variable "region" {
type = string
default = "us-east-1"
}
variable "app_name" {
type = string
default = "WebApp"
}
variable "server_port" {
type = string
default = "8080"
}
variable "ssh_username" {
type = string
default = "ubuntu"
}
locals {
timestamp = formatdate("YYYY-MM-DD_hh-mm-ss", timestamp())
cleaned_app_name = replace("${var.app_name}", "/[^a-zA-Z0-9()\\[\\] .\\/@_-]/", "_")
ami_name = "${local.cleaned_app_name}-${local.timestamp}"
}
source "amazon-ebs" "static-web-ami" {
ami_name = local.ami_name
associate_public_ip_address = var.associate_public_ip_address
instance_type = var.instance_type
region = var.region
source_ami = var.base_ami
ssh_username = var.ssh_username
iam_instance_profile = "LabInstanceProfile"
tags = {
Name = "Project-${local.ami_name}"
}
}
build {
sources = [
"source.amazon-ebs.static-web-ami"
]
provisioner "ansible" {
playbook_file = "play.yml"
extra_arguments = ["--extra-vars", "server_port=${var.server_port}"]
ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
use_proxy = false
}
}
`
I got this message when using this code for my CI/CD to create a AMI :
And here is the yml file on gitlab CI/CD : `packer-build:
stage: build
image:
name: hashicorp/packer:latest
entrypoint: ["/bin/sh", "-c"]
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN : $AWS_SESSION_TOKEN
APP_NAME: "patate" # Définir le nom du projet ici
SERVER_PORT: "8081" # Définir le port ici
before_script:
- apk add --update --no-cache openssh-client python3 py3-pip python3-dev gcc musl-dev libffi-dev openssl-dev make
- eval $(ssh-agent -s)
script:
- ls
- python3 -m venv venv
- source venv/bin/activate
- pip install --upgrade pip
- pip install ansible
- packer init buildAMI.pkr.hcl
- packer validate buildAMI.pkr.hcl
- packer build -var "app_name=${APP_NAME}" -var "server_port=${SERVER_PORT}" buildAMI.pkr.hcl
only:
- main
`
Log Fragments and crash.log files
I can't locate the crash.log files
It will be very helpful if you can help me thanks a lot.
The text was updated successfully, but these errors were encountered: