HiveBrain v1.2.0
Get Started
← Back to all entries
debugdockerMinor

Error when using 'ansible-local' provisioner with Docker container

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
localerrorcontainerwithprovisionerdockerusingwhenansible

Problem

I'm getting an error when running the ansible-local provisioner with a docker builder in Hashicorps Packer.

My template (template.json):

{
  "builders": [
        {
            "type": "docker",
            "image": "ubuntu",
            "commit": "true"
        }
    ],
   "provisioners": [
        {
            "type": "shell",
            "inline": ["sudo apt-get update"]
        },
        {
            "type": "shell",
            "script": "setup_ansible.sh"
        },
        {
            "type": "ansible-local",
            "playbook_file": "./kubeadm.yml"
        }
   ]
}


The error:

docker: Executing Ansible: cd /tmp/packer-provisioner-ansible-local/5a8f3bad-8413-16c3-b255-6a06a9076ef3 && ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook /tmp/packer-provisioner-ansible-local/5a8f3bad-8413-16c3-b255-6a06a9076ef3/kubeadm.yml --extra-vars \"packer_build_name=docker packer_builder_type=docker packer_http_addr=\"  -c local -i /tmp/packer-provisioner-ansible-local/5a8f3bad-8413-16c3-b255-6a06a9076ef3/packer-provisioner-ansible-local135505282
docker: ERROR! the playbook: packer_builder_type=docker could not be found

Solution

It seems that there is some bug in Hashicorps Packer 1.2.0, consider downgrading or upgrading to v1.2.1, comments in GH issue page confirm that the deployed fix is working.

Context

StackExchange DevOps Q#3419, answer score: 1

Revisions (0)

No revisions yet.