Copy file with Ansible remote provisioner

797 views
Skip to first unread message

David González Martínez

unread,
Apr 22, 2016, 8:30:53 AM4/22/16
to Packer
I'm trying to work with Ansible remote provisioner to adapt some playbooks to use with virtual machines created with KVM builder. Almost everything works well, but I need to copy some files from a local folder to the remote virtual machine being generated. I know that scp doesn't work with Ansible provisioner. What's the right way to make the copy module work without scp? Shouldn't sftp work instead by default? The playbook works well if I use it out of Packer.

Any advice would be appreciated.

Alvaro Miranda Aguilera

unread,
Apr 23, 2016, 12:37:22 AM4/23/16
to packe...@googlegroups.com
Hello,

packer does have a native file provisioner, have you used it?


Alvaro

On Sat, Apr 23, 2016 at 12:30 AM, David González Martínez <gonzo...@gmail.com> wrote:
I'm trying to work with Ansible remote provisioner to adapt some playbooks to use with virtual machines created with KVM builder. Almost everything works well, but I need to copy some files from a local folder to the remote virtual machine being generated. I know that scp doesn't work with Ansible provisioner. What's the right way to make the copy module work without scp? Shouldn't sftp work instead by default? The playbook works well if I use it out of Packer.

Any advice would be appreciated.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/6af32ffe-ec3e-4850-b5e4-b10957d6785f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David González Martínez

unread,
Apr 26, 2016, 5:05:54 PM4/26/16
to Packer
Yes, I know about the file provisioner, but I want to do all the steps in an Ansible Playbook.

There is an option for sftp server in Ansible provisioner, but I can't find any infomation about the way to use it in Ansible.

Alvaro Miranda Aguilera

unread,
Apr 26, 2016, 5:12:56 PM4/26/16
to packe...@googlegroups.com
Hello,

Perhaps you can grab the information in other way of the server and ssh.

As for a pure ansible way, maybe ansible mailing list can help better.

Avaro,

David González Martínez

unread,
Apr 27, 2016, 6:43:35 AM4/27/16
to Packer
It's working now. I'm using CentOS 6 and after changing the parameter sftp_command the problem is solved:

"sftp_command":"/usr/libexec/openssh/sftp-server -e"

The solution was already published in this thread.
Reply all
Reply to author
Forward
0 new messages