To troubleshot this provide the following info:

On the Packer host, what's the output of:

set | grep SSH_
ssh-add -L

In your packer template add

"provisioners": [{
  "type": "shell",
  "inline": [
     "set | grep SSH_",
     "ssh-add -L",
     "ssh -vvv [email protected]"
  ]
},

And rerun the packer build and provide the output.

On Mon, Dec 31, 2018 at 12:12 PM Tekchand Dagar <[email protected]>
wrote:

> Hello Team,
>
> I am creating image using packer and i have used the the *shell* and 
> *ansible-local
> provisioners *and all the required packages are installed successfully.
> Now i need to fetch my application code from gitlab in my image. I can use
> only SSH method because HTTP(S) method is disabled on our Gitlab. I have
> attached my json builder file as well as some other files for reference.
> Please refer the attached file.
>
>  To fetch the application code from Gitlab I have followed the below steps:
>
> Step 1: I have copied the private ssh key in a file on packer host. The
> file permission is 600 and ownership is deploy:deploy. Because i need to
> fetch the code as deploy user.
> Step 2: I have run the command *eval "$(ssh-agent)" *to run the ssh agent.
> Step 3: On the host running Packer loaded  ssh key that have access to git
> repository ssh-add <path to private key>.
>
>
> But when i am running my packer builder all provisioners are completed
> successfully except *ch.yml *part. Which is used to clone the repository
> from gitlab. I am getting the below error:
>
> *fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": "git clone
> [email protected]:rana/test-packr-clone.git", "delta": "0:00:00.012369", "end":
> "2018-12-31 11:03:04.843409", "msg": "non-zero return code", "rc": 128,
> "start": "2018-12-31 11:03:04.831040", "stderr": "fatal: could not create
> work tree dir 'test-packr-clone': Permission denied", "stderr_lines":
> ["fatal: could not create work tree dir 'test-packr-clone': Permission
> denied"], "stdout": "", "stdout_lines": []}*
>
>
> Can you please help me to fix this issue? Its roadblock to complete my
> project.
>
> Any help will be appreciated.
>
> Thanks.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/24c7e0fe-8662-40cd-9203-1026ffcdffd1%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/24c7e0fe-8662-40cd-9203-1026ffcdffd1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt81e8nWrONF3s2Od_5Dc3RiRu7AEwwF%2BB4W0PY%2BixJ_bQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to