Bootstrapping host using ansible ?

44 views
Skip to first unread message

Christophe Meessen

unread,
Jan 14, 2016, 11:01:48 AM1/14/16
to Ansible Project
Forgive me this possibly naive question, I'm new to ansible.

I would like to upload the public key used for ssh authentication with ansible.
There is an ansible module (http://docs.ansible.com/ansible/authorized_key_module.html) to do that.

But I can't find an example how to call it directly (not from a playbook).

The problem is the key argument for which I have a file. From the documentation I need to pass the argument value
key="{{ lookup('file', 'id_rsa_ansible.pub') }}"

How do I do that on the command line ?

I expect something like this

$ ansible all -m authorized_key -a "user=root key=xxx" --ask-pass

What should I put at the 'xxx' ? 

David Karban

unread,
Jan 14, 2016, 11:24:44 AM1/14/16
to ansible...@googlegroups.com

Hi, in this invocation you need to supply key itself to 'key' parameter.

David

Dne 14. 1. 2016 17:01 napsal uživatel "Christophe Meessen" <christoph...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f41af6ba-2cab-4551-a224-66c79e4c04d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Larry Smith

unread,
Jan 15, 2016, 1:06:58 AM1/15/16
to Ansible Project
@Christophe - I bootstrap my hosts with a few roles in which one of those is to upload ssh keys and another one to manager users which I run prior to the SSH key role.

Reply all
Reply to author
Forward
0 new messages