HI All,
I have written packer script to build AMI with provisioning using Ansible,
I can see ec2 instance gets created, but Packer is not able to take ssh to
that ec2 instance. Could you please let me know from below piece of code
when I have made mistakes. Even I was triggering using GitLab CI/CD
pipeline.
Code:
{
"min_packer_version": "1.8.0",
"variables": {
"build_version": "{{isotime `2006-01-02`}}"
},
"builders": [
{
"type": "amazon-ebs",
"name": "linux-soe-build-project",
"region": "{{user `region`}}",
"vpc_id": "{{user `vpc_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"communicator": "ssh",
"ssh_username": "ec2-user",
"ssh_port": 22,
"ssh_keypair_name": "keypair",
"ssh_private_key_file": "/home/gitlab-runner/.ssh/keypair.pem",
"ssh_agent_auth": false,
"ssh_timeout": "10m",
"ami_name": "{{user `ami_build`}}-{{user `build_version`}}",
"ami_description": "{{user `ami_description`}}",
"instance_type": "t2.micro",
"availability_zone": "{{user `availability_zone`}}",
"security_group_id": "sg-xxxxxxxxxxxxxxx",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "base-image-amazonlinux-17-07-2022",
"root-device-type": "ebs"
},
"owners": ["xxxxxxxxxxxxxx"],
"most_recent": true
},
"launch_block_device_mappings": [
{
"device_name": "/dev/xvda",
"volume_type": "gp2",
"volume_size": 8,
"delete_on_termination": true
}
],
"tags": {
"Name": "golden-image-automation",
"DeploymentType": "Auotmated",
"Environment": "Test",
"Owner": "[email protected]"
},
"snapshot_tags": {
"Name": "snapshot-build-automated",
"DeploymentType": "Auotmated",
"Owner": "[email protected]"
}
}
],
"provisioners": [
{
"type": "file",
"source": "./ansible",
"destination": "/tmp/ansible"
},
{
"type": "file",
"source": "./script",
"destination":"/tmp/script"
}
]
Error: Attached.
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/23cde326-0b2b-4caa-b2d5-aa65202073d2n%40googlegroups.com.