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

This commit is contained in:
Mitchell Hashimoto 2013-12-27 08:28:50 -07:00
parent 77d0d63b1d
commit 525802e9e6
2 changed files with 20 additions and 1 deletions

View File

@ -66,6 +66,8 @@ BUG FIXES:
* builder/virtualbox: don't download guest additions if disabled. [GH-731]
* post-processor/vsphere: Uploads VM properly. [GH-694]
* 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
as directories, not files. [GH-710]
* provisioner/chef-solo: Environments are recognized. [GH-726]

View File

@ -54,6 +54,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
// Templates
templates := map[string]*string{
"playbook_file": &p.config.PlaybookFile,
"staging_dir": &p.config.StagingDir,
}
@ -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
err = validateFileConfig(p.config.PlaybookFile, "playbook_file", true)
if err != nil {