--private-key option

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

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

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

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)