<p>I still don't get how your <code>config.yml</code> could launch ansible without a step part. Here is my findings, but I'm unsure it is what you're after, but that was too long for a comment. </p>

<p>According to the <a href="https://circleci.com/docs/2.0/project-walkthrough/#deploy-through-circleci" rel="noreferrer">documentation here</a> you have to add a <code>add_ssh_keys</code> with the fingerprint of your key as seen in the UI.</p>

<pre><code>- add_ssh_keys:
    fingerprints:
      - "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
</code></pre>

CC BY-SA 3.0
2017-04-11T08:26:49.093Z
2017-04-11T08:26:49.093Z
Tensibai
<p><strong>Aim</strong> </p>

<p>To deploy docker container using ansible using CircleCI-2.0.</p>

<p><strong>Method</strong></p>

<p>A private key has been created and added using the CircleCI-2.0 UI.</p>

<p><em>.circle/config.yml</em></p>

<pre><code>version: 2
jobs:
  build:
    docker:
      - image: ubuntu:xenial
    working_directory: ~/project
</code></pre>

<p><strong>Results</strong></p>

<p>Running ansible results in:</p>

<pre><code>Failed to connect to the host via ssh: Warning: Permanently added
Permission denied (publickey,password)
</code></pre>

<p><strong>Discussion</strong></p>

<p>The assumption was made that the keys would have been stored in ~/.ssh, but this seems to be empty.</p>

<blockquote>
  <p>Is your target host accepting this key (when tried manually)?</p>
</blockquote>

<p>Yes. Log in using <code>ssh root@host -i key</code> succeeds.</p>

<blockquote>
  <p>Are you using the same user in the container?</p>
</blockquote>

<p>Yes. The <code>root</code> user is used both manually as from the CircleCI-2.0.</p>

<p><strong>Conclusion</strong></p>

<p>In summary, the question is where does CircleCI-2.0 store the private keys that have been submitted using the UI? The <code>~/.ssh</code> directory is empty.</p>

<circleci-2.0>
Where does CircleCI-2.0 store the ssh private keys?
030
# Where does CircleCI-2.0 store the ssh private keys?

(Asked by: username_0 on 2017-04-11)

Aim 
To deploy docker container using ansible using CircleCI-2.0.
Method
A private key has been created and added using the CircleCI-2.0 UI.
.circle/config.yml
version: 2
jobs:
  build:
    docker:
      - image: ubuntu:xenial
    working_directory: ~/project

Results
Running ansible results in:
Failed to connect to the host via ssh: Warning: Permanently added
Permission denied (publickey,password)

Discussion
The assumption was made that the keys would have been stored in ~/.ssh, but this seems to be empty.

Is your target host accepting this key (when tried manually)?

Yes. Log in using ssh root@host -i key succeeds.

Are you using the same user in the container?

Yes. The root user is used both manually as from the CircleCI-2.0.
Conclusion
In summary, the question is where does CircleCI-2.0 store the private keys that have been submitted using the UI? The ~/.ssh directory is empty.

**Tags:** circleci-2.0


---

## 1 answers

### Answer by username_1 on 2017-04-11. Score: 5 | Accepted answer

I still don't get how your config.yml could launch ansible without a step part. Here is my findings, but I'm unsure it is what you're after, but that was too long for a comment. 
According to the documentation here you have to add a add_ssh_keys with the fingerprint of your key as seen in the UI.
- add_ssh_keys:
    fingerprints:
      - "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"


---

