How to run an Ansible shell script from a Cron job?

So here is what I roughly intend:

# ssh-agent -s > root-ssh-info
# source root-ssh-info
# ssh-add
# > inputpw
# logout

cron job runs as root
looks for /root/root-ssh-info and sources it
can now run ansible as usual.

Yes - it means the first time your admin box boots up you need to input that password, etc but that's not the end of the world, I don't think.

-sv

Co-incidentally I had mailed Seth about this only an hour or two ago...

Looks like one way of handling this problem is keychain:-
  https://github.com/funtoo/keychain

Same idea, just a script around the packaging of it.

  Nigel.

I don't have any problem with that script - looks like a whole lot of shell script - 1400 lines worth. I'll need to read through it.

Seems kinda unmaintained which worries me.

A simple ssh-agent + ssh-add seems pretty straightforward to me - but maybe there's a lot I'm overlooking. I'll read keychain and check.

-sv

Thanks all,

Keychain worked a treat.

Thanks,
G

Seth Vidal wrote:

I don't have any problem with that script - looks like a whole lot of
shell script - 1400 lines worth. I'll need to read through it.

Its definitely pretty big...

Seems kinda unmaintained which worries me.

I'm not so worried about that - its been around for a dozen years, with
some reworking during that time, but has settled down to a very low rate
of churn... but then its a fairly limited defined problem, and ssh-agent
etc has not had a lot of churn in functionality either.

  Nigel.