ubuntu:latest
i have installed packer and when i try to execute packer build command i am getting an error. please help me solve this error.
My image.json file
{
"variables": {
},
"builders": [{
"type": "amazon-ebs",
"instance_type": "t2.large",
"region": "us-east-1",
"source_ami": "ami-d15a75c7",
"security_group_id": "xxxxx",
"subnet_id": "xxxxxxxxx",
"ami_name": "gitlab-runner-as_ubuntu_docker_{{timestamp}}",
"ssh_username": "ubuntu",
"ssh_pty": true,
"ssh_private_ip": true,
"associate_public_ip_address": false,
"shutdown_behavior": "stop",
"ena_support": true
}],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo apt-get -y update",
"sudo apt-get install -y python-simplejson",
"sudo apt-get install -y python-requests",
"sudo apt-get install -y python-requests",
"sudo apt-get install python-pip -y"
]
},
{
"type": "ansible",
"playbook_file": "/builds/infra/packer-role-gitlab-runner-autoscaling/playbook.yml",
"ansible_env_vars": [
"ANSIBLE_HOST_KEY_CHECKING=False",
"ANSIBLE_REMOTE_TMP=/tmp/ansible",
"ANSIBLE_ASK_SUDO_PASS=False",
"ANSIBLE_REMOTE_USER=ubuntu",
"ANSIBLE_USER_PYTHON=/usr/bin/python3",
"PYTHONPATH=/usr/local/bin/python2.7/site-packages",
"REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt"
]
},
{
"type": "shell",
"script": "/builds/infra/packer-role-gitlab-runner-autoscaling/script.sh"
}
]
}
$ packer -version
1.1.2
$ whoami
root
$ packer_log=1 packer build image.json
amazon-ebs output will be in this color.
1 error(s) occurred:
* user: could not determine current user from environment.
ERROR: Job failed: exit code 1