Merge pull request #1016 from jgornick/ansible-chdir

Update Ansible provisioner to set cwd to staging directory.
This commit is contained in:
Ross Smith II 2014-04-21 07:35:03 -07:00
commit 1984ce1733
1 changed files with 2 additions and 2 deletions

View File

@ -222,8 +222,8 @@ func (p *Provisioner) executeAnsible(ui packer.Ui, comm packer.Communicator) err
extraArgs = " " + strings.Join(p.config.ExtraArguments, " ")
}
command := fmt.Sprintf("%s %s%s -c local -i \"127.0.0.1,\"",
p.config.Command, playbook, extraArgs)
command := fmt.Sprintf("cd %s && %s %s%s -c local -i \"127.0.0.1,\"",
p.config.StagingDir, p.config.Command, playbook, extraArgs)
ui.Message(fmt.Sprintf("Executing Ansible: %s", command))
cmd := &packer.RemoteCmd{
Command: command,