Hello Team,

I have run the command suggested by you please find the output of both the 
commands:

Command 1:

*root@packer:~/packer# set | grep SSH_*
SSH_AGENT_PID=4482
SSH_AUTH_SOCK=/tmp/ssh-SVokQwOeRx7G/agent.4481

Command 2:

*root@packer:~/packer# ssh-add -L*
ssh-rsa 
AAAAB3NzaC1yc2EAAAADAQABAAABAQDjnEEn4+sO3U9o4+Xr9KEtjrDX+i2jMPazXNPnMFoZNwFG3XPDrnl+Whb+SHjBsdfXx+iQkasASKCo1ap118g0hSFMgLVtIlFyD0GqePId4uejLrYZG79AbbEWn0kB+RitaG2S2S2OMHcUAeGtmoyIXHqvPEo9tDoSht6ReFk9UY2eGQUjy8QFz/2TIbF8IpEZz5JvGkmuGF0PqPn0GQZw6sw4VJlE5Zre52qyEMQel4mHAKXQiWhSG0wpK5IOfPuUmXXLCzJp0
 
id_rsa

I have added the provisioners also in my build and getting the SSH 
connnection time out error on port 22.

Because we are running our gitlab on port 971.

I have copied the config file using file provisioner which specify our 
gitlab domain and port. Yet why it still trying to connect on port 22? 

I have attached my builder and config file. Please refer the attached file 
for configuration.

*Error:*

==> digitalocean: Uploading /root/packer/config => /home/deploy/.ssh/
1 items:  37 B / 37 B 
[=================================================================================================================================================================================]
 
2s
==> digitalocean: Provisioning with shell script: ch.sh
==> digitalocean: Provisioning with shell script: /tmp/packer-shell281110143
    digitalocean: SSH_AUTH_SOCK='/tmp/ssh-wi6xZWcfsn/agent.1643'
    digitalocean: SSH_CLIENT='2.3.4.5 56914 22'
    digitalocean: SSH_CONNECTION='2.3.4.5 56914 3.4.5.6 22'
    digitalocean: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6, OpenSSL 1.0.2g  1 Mar 
2016
    digitalocean: ssh-rsa 
AAAAB3NzaC1yc2EAAAADAQABAAABAQDjnEEn4+sO3U9o4+Xr9KEtjrDX+i2jMPazXNPnMFoZNwFG3XPDrnl+Whb+SHjBsdfXx+iQkasASKCo1ap118g0hSFMgLVtIlFyD0GqePId4uejLrYZG79AbbEWn0kB+RitaG2S2S2OMHcUAeGtmoyIXHqvPEo9tDoSht6ReFk9UY2eGQUjy8QFz/2TIbF8IpEZz5JvGkmuGF0PqPn0GQZw6sw4VJlE5Zre52qyEMQel4mHAKXQiWhSG0wpK5IOfPuUmXXLCzJp0
 
id_rsa
    digitalocean: debug1: Reading configuration data /etc/ssh/ssh_config
    digitalocean: debug1: /etc/ssh/ssh_config line 19: Applying options for 
*
    digitalocean: Pseudo-terminal will not be allocated because stdin is 
not a terminal.
    digitalocean: debug2: resolving "git.xyz.com" port 22
    digitalocean: debug2: ssh_connect_direct: needpriv 0
    digitalocean: debug1: Connecting to git.xyz.com [1.2.3.4] port 22.
    digitalocean: debug1: connect to address 1.2.3.4 port 22: Connection 
timed out
    digitalocean: ssh: connect to host git.xyz.com port 22: Connection 
timed out

*Note:*  I have changed the some part of SSH key, Domain of our gitlab and 
some IP's with other regular digit like 1.2.3.4 etc.


On Tuesday, January 1, 2019 at 7:28:08 PM UTC+5:30, Rickard von Essen wrote:
>
> 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] <javascript:>"
>   ]
> },
>
> And rerun the packer build and provide the output.
>
> On Mon, Dec 31, 2018 at 12:12 PM Tekchand Dagar <[email protected] 
> <javascript:>> 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] <javascript:>.
>> 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/7015adbf-9a54-49c3-a5be-f2b9627283d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: builder.json.odt
Description: application/vnd.oasis.opendocument.text

Attachment: ch.sh.odt
Description: application/vnd.oasis.opendocument.text

Attachment: config.odt
Description: application/vnd.oasis.opendocument.text

Reply via email to