# \--private-key option

**URL:** <https://forum.ansible.com/t/private-key-option/12508>\
**Category:** Ansible Project\
**Created:** [March 15, 2013, 1:07pm UTC](https://forum.ansible.com/t/private-key-option/12508 "2013-03-15T13:07:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Greenberg](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@Ed\_Greenberg](https://forum.ansible.com/u/Ed_Greenberg)\
**Post date:** [March 15, 2013, 1:07pm UTC](https://forum.ansible.com/t/private-key-option/12508/1 "2013-03-15T13:07:39Z")

</div>

We’ve let our Ansible get old, though functional, and I tried out the new version. I discovered that the --private-key option seems not to be supported any more. I was able to do command line things with the ssh-agent, but we have playbooks that run from cron jobs and I’m not sure how I can run these without the private key being specified.

For instance, one of my scripts does this:

pb = ansible.playbook.PlayBook(  
playbook=playbook,  
module\_path=self.options[‘module\_path’],  
host\_list=self.options[‘inventory’],  
forks=self.options[‘forks’],  
debug=self.options[‘debug’],  
remote\_user=self.options[‘remote\_user’],  
remote\_pass=self.sshpass,  
callbacks=playbook\_cb,  
runner\_callbacks=runner\_cb,  
stats=stats,  
timeout=self.options[‘timeout’],  
transport=self.options[‘connection’],  
sudo=self.options[‘sudo’],  
sudo\_user=self.options[‘sudo\_user’],  
sudo\_pass=self.sudopass,  
extra\_vars=self.extra\_vars,  
private\_key\_file=self.options[‘private\_key\_file’]  
)

and then pb.run()

I looked at the new lib/ansible/playbook.py and discovered that it no longer looks for the private\_key\_file variable when initing class PlayBook.

Is there a workaround?

Thanks,

Ed G

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 15, 2013, 2:13pm UTC](https://forum.ansible.com/t/private-key-option/12508/2 "2013-03-15T14:13:30Z")

</div>

Ed,

There is totally a --private-key option.

I'm not sure what you are saying or experiencing, but all the things  
you ask about are there, including the option and passing this value  
to the constructor.

--Michael

---

<div class="post-metadata">

**Author:** ![Ed\_Greenberg](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@Ed\_Greenberg](https://forum.ansible.com/u/Ed_Greenberg)\
**Post date:** [March 15, 2013, 3:06pm UTC](https://forum.ansible.com/t/private-key-option/12508/3 "2013-03-15T15:06:07Z")

</div>

Thank you for the reply, Michael. I must have gotten something really strange when I tried to get the code. I’m not a git expert by any means.

The fresh git clone that I just did seems to be much different than whatever I had.

Thanks for confirming what SHOULD be there.

Ed

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [March 15, 2013, 3:34pm UTC](https://forum.ansible.com/t/private-key-option/12508/4 "2013-03-15T15:34:54Z")

</div>

You might have a much older install on that box.

Be sure you are running out of git with "source ./hacking/env-setup"

(or just install it)
