Skip to content

ansible provisioner fails with "failed to transfer file" #110

Open
@hc-github-team-packer

Description

@hc-github-team-packer

This issue was originally opened by @stefangweichinger in hashicorp/packer#11783 and has been migrated to this repository. The original issue description is below.


Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

I have a packer config using the virtualbox-iso builder for building Debian VMs.
This config uses the ansible provisioner and worked fine before.

Recently I see failed builds because the provisioning step fails:

2022/05/17 07:51:59 ui:     debian.virtualbox-iso.bullseye: failed to transfer file to /home/sgw/.ansible/tmp/ansible-local-45402qjbtzya8/tmpeyxtinre /home/vagrant/.ansible/tmp/ansible-tmp-1652766718.7643352-45407-8201740687254/AnsiballZ_setup.py:

Reproduction Steps

Run "packer build" with a packer build using the ansible provisioner.

Packer version

1.8.0

Simplified Packer Template

the part with the provisioner:

  provisioner "ansible" {
    playbook_file = "ansible/vagrant-debian-11-guest-additions.yml"
    user          = "${var.ssh_username}"
    ansible_env_vars = [
      "ANSIBLE_STDOUT_CALLBACK=debug",
      "ANSIBLE_HOST_KEY_CHECKING=False",
      "ANSIBLE_SSH_ARGS='-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s'",
      "ANSIBLE_NOCOLOR=True"
      ]
    ansible_ssh_extra_args = [
      "-o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa"
    ]
  }

These extra_args come from fixing an issue with ssh not able to log into the created VM.
If I comment these vars it fails as well, but with another issue around "host key type" (yes, I found the related issue, that's where my extra_vars come from).

Operating system and Environment details

Fedora 36 Workstation, VirtualBox 6.1.34

 ansible --version
ansible [core 2.12.3]
  config file = None
  configured module search path = ['/home/sgw/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/sgw/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/sgw/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/sgw/.local/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]
  jinja version = 3.0.3
  libyaml = True

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions