Comments (2)
I think the ssh
option -o IdentitiesOnly=yes
should be removed from extraArgs
in the ansible-local
provisioner
(perhaps this invalid option is causing ansible
to ignore the additional extraArgs
)
I've tried removing it from the src & go clean && go build
- & removing the existing plugin & placing the new plugin in:
~/$PACKER_CONIG_DIR/.packer.d/plugins/github.com/hashicorp/ansible
but I still see it showing up in the ansible
command:
lxd.build-local: Executing Ansible: cd /tmp/packer-provisioner-ansible-local/62463d8a-fb15-88fd-755c-fa094aeaaa9e && ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook /tmp/packer-provisioner-ansible-local/62463d8a-fb15-88fd-755c-fa094aeaaa9e/playbooktest.yml --extra-vars "packer_build_name=build-local packer_builder_type=lxd packer_http_addr=ERR_HTTP_ADDR_NOT_IMPLEMENTED_BY_BUILDER -o IdentitiesOnly=yes" --extra-vars "build_template=alpine-lxd" -c local -i /tmp/packer-provisioner-ansible-local/62463d8a-fb15-88fd-755c-fa094aeaaa9e/inventory.yml
I can make a PR for this change but wanted to test the change properly first - am I missing a step ?
(NB for others: the ansible provisioner works perfectly with the ansible lxd
connection plugin community.general.lxd)
from packer-plugin-ansible.
When it comes to the -o IdentitiesOnly=yes
issue, I believe the issue is caused by the fact, that what should be actually a value of --ssh-extra-args
has been crammed into the value of --extra-vars
.
So the initial fix (untested) might look a little more like this (although I believe the whole extraArgs
handling should be a refactored a little for better readability/maintainability):
diff --git a/provisioner/ansible-local/provisioner.go b/provisioner/ansible-local/provisioner.go
index 9619733..c6ece7d 100644
--- a/provisioner/ansible-local/provisioner.go
+++ b/provisioner/ansible-local/provisioner.go
@@ -549,7 +549,7 @@ func (p *Provisioner) invokeGalaxyCommand(args []string, ui packersdk.Ui, comm p
func (p *Provisioner) executeAnsible(ui packersdk.Ui, comm packersdk.Communicator) error {
inventory := filepath.ToSlash(filepath.Join(p.config.StagingDir, filepath.Base(p.config.InventoryFile)))
- extraArgs := fmt.Sprintf(" --extra-vars \"packer_build_name=%s packer_builder_type=%s packer_http_addr=%s -o IdentitiesOnly=yes\" ",
+ extraArgs := fmt.Sprintf(" --extra-vars \"packer_build_name=%s packer_builder_type=%s packer_http_addr=%s\" --ssh-extra-args \"-o IdentitiesOnly=yes\" ",
p.config.PackerBuildName, p.config.PackerBuilderType, p.generatedData["PackerHTTPAddr"])
if len(p.config.ExtraArguments) > 0 {
extraArgs = extraArgs + strings.Join(p.config.ExtraArguments, " ")
from packer-plugin-ansible.
Related Issues (20)
- How use_proxy argument works?
- Duplicate of ansible_ssh_private_key_file HOT 2
- Ansible provisioner fails in Windows azure build
- ansible provisioner fails with "failed to transfer file" HOT 4
- ansible-local provisioner installs galaxy roles to <staging dir>/galaxy_roles/ but does not add that to Ansible's role path HOT 4
- Options in ansible_ssh_extra_args not properly concatenated
- Error: "fail to handshake" with vagrant and qemu provider HOT 1
- Installing dnf packages causes connection loss HOT 1
- Error: unrecognized arguments: playbook.yml HOT 4
- Add support for host key algorithms other than ssh-rsa on local ssh proxy HOT 6
- Documentation typo HOT 1
- Setup module fails on azure VM build with no error HOT 1
- Amazon Ubuntu AMI: fail to handshake HOT 4
- Can't use Ansible provisioner with just SSH username and password HOT 1
- ansible_env_vars are not set before version check
- `ansible_ssh_extra_args` not passing arguments to SSH correctly HOT 4
- Ansible provisioner doesn't honor winrm_use_ssl option from WinRM communicator HOT 6
- Build fails from RHEL 9.2 HOT 3
- ansible-local provisioner cannot set packer_http_addr properly when the variable is not implemented
- Ansible Provisionner auto-generated keys are blank (Linux) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packer-plugin-ansible.