Merge pull request #6065 from wtsi-hgi/fix/ansible-inventory-dir

use InventoryDirectory as inventory when set
This commit is contained in:
Megan Marsh 2018-03-27 16:58:27 -07:00 committed by GitHub
commit 7fd0cfa764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -321,6 +321,9 @@ func (p *Provisioner) Cancel() {
func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error { func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator, privKeyFile string) error {
playbook, _ := filepath.Abs(p.config.PlaybookFile) playbook, _ := filepath.Abs(p.config.PlaybookFile)
inventory := p.config.inventoryFile inventory := p.config.inventoryFile
if len(p.config.InventoryDirectory) > 0 {
inventory = p.config.InventoryDirectory
}
var envvars []string var envvars []string
args := []string{"--extra-vars", fmt.Sprintf("packer_build_name=%s packer_builder_type=%s", args := []string{"--extra-vars", fmt.Sprintf("packer_build_name=%s packer_builder_type=%s",