hashicorp / packer-plugin-ansible

Packer plugin for Ansible Provisioner
https://www.packer.io/docs/provisioners/ansible
Mozilla Public License 2.0
49 stars 35 forks source link

ansible-local provisioner doesn't support `ansible_env_vars` #50

Open pcantea opened 3 years ago

pcantea commented 3 years ago

Overview of the Issue

ansible_env_vars argument for the ansible-local provisioner is not supported

Reproduction Steps

Configure ansible-local provisioner with ansible_env_vars

Plugin and Packer version

Packer v1.7.2

required_plugins {
    amazon = {
      version = "~> 1.0"
      source  = "github.com/hashicorp/amazon"
    }
    ansible = {
      version = ">= 1.0.0"
      source  = "github.com/hashicorp/ansible"
    }
  }

Simplified Packer Buildfile

provisioner "ansible-local" {
    playbook_dir     = abspath("./provisioners/ansible")
    playbook_file    = abspath("./provisioners/ansible/playbook.yml")
    ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
  }

Operating system and Environment details

macOS big Sur 11.4

Log Fragments and crash.log files

Error: Failed preparing provisioner-block "ansible-local" ""

  on build.pkr.hcl line 27:
  (source code not available)

build.pkr.hcl:31,5-21: Unsupported argument; An argument named
"ansible_env_vars" is not expected here.
SwampDragons commented 3 years ago

Oops, you're right! this is either a docs issue (option needs to be removed from Ansible docs) or a feature request. We'll take a look when we get a chance, but it may be a while and I suspect this may be a good issue for community contribution, since the code is probably mostly able to be copied form the Ansible (non-remote) provisioner.