2016-05-25 17:23:07 -04:00
|
|
|
{
|
|
|
|
"variables": {
|
|
|
|
"template_name": "debian",
|
2017-10-30 21:48:43 -04:00
|
|
|
"template_parameters": "SUITE=jessie",
|
|
|
|
"container_name": "packer-lxc",
|
|
|
|
"set_var": "hello"
|
2016-05-25 17:23:07 -04:00
|
|
|
},
|
2017-10-30 21:48:43 -04:00
|
|
|
"provisioners": [
|
|
|
|
{
|
|
|
|
"type": "shell",
|
|
|
|
"inline": [
|
|
|
|
"if [ \"$SET_VAR\" != \"{{user `set_var`}}\" ]; then",
|
|
|
|
" echo \"Got unexpected value '$SET_VAR' for SET_VAR\" 1>&2",
|
|
|
|
" exit 1",
|
|
|
|
"fi"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
2016-05-25 17:23:07 -04:00
|
|
|
"builders": [
|
|
|
|
{
|
|
|
|
"type": "lxc",
|
|
|
|
"name": "lxc-{{user `template_name`}}",
|
|
|
|
"template_name": "{{user `template_name`}}",
|
2017-10-30 21:48:43 -04:00
|
|
|
"container_name": "{{user `container_name`}}",
|
|
|
|
"create_options": [ "-f", "{{user `init_config`}}" ],
|
|
|
|
"attach_options": [ "--clear-env", "--set-var", "SET_VAR={{user `set_var`}}" ],
|
2016-05-25 17:23:07 -04:00
|
|
|
"config_file": "/usr/share/lxc/config/{{user `template_name`}}.common.conf",
|
|
|
|
"template_environment_vars": [ "{{user `template_parameters`}}" ]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|