Well, This appears to be a known issue to many but I've applied many of the workarounds I found online but none of them worked!
I'm running packer from a docker container to build an image on openstack. I could get the ip address of the instance but couldn't ping/ssh/execute ansible within packer provisioners.
All of them fail with this error:
openstack: ping: 172.30.16.165: Name or service not known
Funny thing is I could ping the same ip from other machines and the docker container executing packer. So, not sure why the packer provisioner couldn't do. DNS & network settings of the host & docker container are all same.
Also, I could connect to other floating ips on the same openstack tenant. I'm using floating-ip-network to assign to an external ip to connect to the instance at a later point.
{
"type": "shell",
"expect_disconnect": "true",
"inline": [
"echo Rebooting...",
"sudo -u root /sbin/init 6"
]
},
{
"type": "shell",
"pause_before": "60s",
"inline": [
"echo waiting for 60s"
]
},
{
"type": "shell-local",
"inline": [
"ping -c 4 $(cat /tmp/ipaddress)"
]
}
I did add the ip to /etc/hosts file but it didn't fix the issue. If someone could help me with this, it would be really great.
Thanks in advance.