I'm using packer inside "proxified" network and I know that packer is using standard proxy env variables:
- http_proxy
- https_proxy
But my problem is located inside VM and when I want to provisioned its VM I must add the following configuration at each provisioners:
{
"variables": {
"http_proxy": "{{env `http_proxy`}}",
"https_proxy": "{{env `https_proxy`}}",
"ftp_proxy": "{{env `ftp_proxy`}}",
"no_proxy": "{{env `no_proxy`}}"
},
...
"provisioners": [
{
"only": ["virtualbox-iso"],
"environment_vars": [
"http_proxy={{user `http_proxy`}}",
"https_proxy={{user `https_proxy`}}",
"ftp_proxy={{user `ftp_proxy`}}",
"no_proxy={{user `no_proxy`}}"
],
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"scripts": [
...
]
},
{
"environment_vars": [
"http_proxy={{user `http_proxy`}}",
"https_proxy={{user `https_proxy`}}",
"ftp_proxy={{user `ftp_proxy`}}",
"no_proxy={{user `no_proxy`}}"
],
"type": "shell",
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"inline": ["yum update"]
}
]
}
It's a bit redundant.
There is a better way to achieve my goal?