<p>Quoting from the cookbook <a href="https://github.com/poise/application_git/blob/master/README.md#properties" rel="nofollow noreferrer">README</a>:</p>

<blockquote>
  <p>deploy_key – SSH key to use with git. Can be specified either as a
  path to key file already created or as a string value containing the
  key directly.</p>
</blockquote>

<p>And:</p>

<blockquote>
  <p>The application_git resource deploys code from git. It extends the
  core git resource to support deploy keys and disabling strict host key
  verification.</p>
</blockquote>

<p>So checking the core git resource <a href="https://docs.chef.io/resource_git.html#properties" rel="nofollow noreferrer">documentation</a>:</p>

<blockquote>
  <p>ssh_wrapper Ruby Type: String</p>
  
  <p>The path to the wrapper script used when running SSH with git. The
  GIT_SSH environment variable is set to this.</p>
</blockquote>

<p>so something like this (untested) should do (using the wrapper in the cookbook) :</p>

<pre><code>cookbook_file '/path/to/my/desired/ssh_wrapper.sh' do
  source 'my_ssh_wrapper.sh'
end

application 'accounts' do
  action :deploy
  path &lt;somepath&gt;
  owner 'nobody'
  group 'nogroup'
  git 'name' do
    repository &lt;repopath&gt;
    revision &lt;value&gt;
    ssh_wrapper '/path/to/my/desired/ssh_wrapper.sh'
    deploy_key deploy_key
 end
end 
</code></pre>

<p>You can of course do the same with the deploy_key, but using something like chef_vault or an encrypted databag sounds better to avoid commiting deploy keys within the cookbook.</p>

CC BY-SA 4.0
2018-05-29T05:10:59.857Z
Ssh_wrapper change will work with this. But main issue is for deploy_key path
Arora20
CC BY-SA 4.0
2018-05-29T07:24:37.867Z
What is the problem using another cookbook_file resource for deploy_key ?
Tensibai
CC BY-SA 4.0
2018-05-28T15:20:44.950Z
2018-05-28T15:20:44.950Z
Tensibai
<p>I am using Chef 12.0.3 for managing servers. Earlier I was using application cookbook for cloning repository. But now in higher version of application cookbook, this support is moved to new cookbook application_git.</p>

<p>Issue:</p>

<ol>
<li>I want to change the path of deploy key</li>
<li>Contents of ssh_wrapper</li>
<li>Path of ssh_wrapper.</li>
</ol>

<p>What I have tried (Current code):</p>

<pre><code>application 'accounts' do
  action :deploy
  path &lt;somepath&gt;
  owner 'nobody'
  group 'nogroup'
  git 'name' do
    repository &lt;repopath&gt;
    revision &lt;value&gt;
    deploy_key deploy_key
 end
end 
</code></pre>

<p>I am not able to find if I need to pass path using ssh_wrapper_path or ssh_wrapper or deploy_key_path. All are failing.</p>

<p>Currently, I am able to get keys and wrapper but at a wrong place.</p>

<git><deployment><chef>
Customizing deploy key and ssh wrapper path for git cloning through application_git cookbook
Arora20
# Customizing deploy key and ssh wrapper path for git cloning through application_git cookbook

(Asked by: username_0 on 2018-05-28)

I am using Chef 12.0.3 for managing servers. Earlier I was using application cookbook for cloning repository. But now in higher version of application cookbook, this support is moved to new cookbook application_git.
Issue:

I want to change the path of deploy key
Contents of ssh_wrapper
Path of ssh_wrapper.

What I have tried (Current code):
application 'accounts' do
  action :deploy
  path 
  owner 'nobody'
  group 'nogroup'
  git 'name' do
    repository 
    revision 
    deploy_key deploy_key
 end
end 

I am not able to find if I need to pass path using ssh_wrapper_path or ssh_wrapper or deploy_key_path. All are failing.
Currently, I am able to get keys and wrapper but at a wrong place.

**Tags:** git, deployment, chef


---

## 1 answers

### Answer by username_1 on 2018-05-28. Score: 1

Quoting from the cookbook README:

deploy_key – SSH key to use with git. Can be specified either as a
  path to key file already created or as a string value containing the
  key directly.

And:

The application_git resource deploys code from git. It extends the
  core git resource to support deploy keys and disabling strict host key
  verification.

So checking the core git resource documentation:

ssh_wrapper Ruby Type: String
The path to the wrapper script used when running SSH with git. The
  GIT_SSH environment variable is set to this.

so something like this (untested) should do (using the wrapper in the cookbook) :
cookbook_file '/path/to/my/desired/ssh_wrapper.sh' do
  source 'my_ssh_wrapper.sh'
end

application 'accounts' do
  action :deploy
  path 
  owner 'nobody'
  group 'nogroup'
  git 'name' do
    repository 
    revision 
    ssh_wrapper '/path/to/my/desired/ssh_wrapper.sh'
    deploy_key deploy_key
 end
end 

You can of course do the same with the deploy_key, but using something like chef_vault or an encrypted databag sounds better to avoid commiting deploy keys within the cookbook.

> **Comments:**
> **username_0**: Ssh_wrapper change will work with this. But main issue is for deploy_key path  
> **username_1**: What is the problem using another cookbook_file resource for deploy_key ?  

---

