Commit 525802e9 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

provisioner/ansible-local: templates for role, playbook paths [GH-749]

parent 77d0d63b
...@@ -66,6 +66,8 @@ BUG FIXES: ...@@ -66,6 +66,8 @@ BUG FIXES:
* builder/virtualbox: don't download guest additions if disabled. [GH-731] * builder/virtualbox: don't download guest additions if disabled. [GH-731]
* post-processor/vsphere: Uploads VM properly. [GH-694] * post-processor/vsphere: Uploads VM properly. [GH-694]
* post-processor/vsphere: Process user variables. * post-processor/vsphere: Process user variables.
* provisioner/ansible-local: all configurations are processed as templates
[GH-749]
* provisioner/ansible-local: playbook paths are properly validated * provisioner/ansible-local: playbook paths are properly validated
as directories, not files. [GH-710] as directories, not files. [GH-710]
* provisioner/chef-solo: Environments are recognized. [GH-726] * provisioner/chef-solo: Environments are recognized. [GH-726]
......
...@@ -54,6 +54,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { ...@@ -54,6 +54,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
// Templates // Templates
templates := map[string]*string{ templates := map[string]*string{
"playbook_file": &p.config.PlaybookFile,
"staging_dir": &p.config.StagingDir, "staging_dir": &p.config.StagingDir,
} }
...@@ -66,6 +67,22 @@ func (p *Provisioner) Prepare(raws ...interface{}) error { ...@@ -66,6 +67,22 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
} }
} }
sliceTemplates := map[string][]string{
"playbook_paths": p.config.PlaybookPaths,
"role_paths": p.config.RolePaths,
}
for n, slice := range sliceTemplates {
for i, elem := range slice {
var err error
slice[i], err = p.config.tpl.Process(elem, nil)
if err != nil {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("Error processing %s[%d]: %s", n, i, err))
}
}
}
// Validation // Validation
err = validateFileConfig(p.config.PlaybookFile, "playbook_file", true) err = validateFileConfig(p.config.PlaybookFile, "playbook_file", true)
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment