LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-28-2016, 07:46 PM   #1
soy_vivi
LQ Newbie
 
Registered: Jan 2014
Posts: 6

Rep: Reputation: Disabled
Using ansbile to deploy your ssh keys


Hello everyone,

I'm attempting to deploy my public ssh key (id_rsa.pub) from one server to two other servers. I'm using the the example here http://docs.ansible.com/ansible/auth...ey_module.html with the following configuration file called sshkeys.yml:

- name: Add Pub key
- hosts: server1,server2
- authorized_key: user=user1 key="{{ lookup('file', '/home/user1/.ssh/id_rsa.pub') }}"

The command I'm running is ansible-playbook sshkeys.yml -u user1 -k and the result I'm getting is this:

"ERROR! 'authorized_key' is not a valid attribute for a Play

The error appears to have been in '/home/user1/playbooks/sshkeys.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- hosts: server1,server2
- authorized_key: user=user1 key="{{ lookup('file', '/home/user1/.ssh/id_rsa.pub') }}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

with_items:
- {{ foo }}

Should be written as:

with_items:
- "{{ foo }}"

I'm copy the authorized_key value directly from ansible's documentation site. I have looked up at other examples but they don't vary from mine. Again, I'm just trying to deploy my public key from another server to two remote servers in the same subnet. Thanks in advance for your input.
 
Old 10-01-2016, 11:49 AM   #2
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,088

Rep: Reputation: 196Reputation: 196
Take a look at
http://www.linuxquestions.org/questi...or-4175590516/
Are the two of you in the same class or something?
 
Old 10-01-2016, 01:31 PM   #3
student23
LQ Newbie
 
Registered: Jan 2012
Posts: 21

Rep: Reputation: Disabled
Arizonagroovejet, I posted the same question because I thought this didn't post. I will close this one as a duplicate. Do you have any input on the question?
 
  


Reply

Tags
ansible


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: SSH login without password using SSH keys LXer Syndicated Linux News 0 09-21-2014 02:36 AM
software as a service? virtualization? ssh? how to deploy a new aplication jbcolmena Linux - Server 4 07-30-2010 02:51 PM
SSH host keys are not being read correctly from .ssh/known_hosts. bartonski Linux - Software 3 10-29-2009 05:40 PM
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 07:03 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 04:31 AM


All times are GMT -5. The time now is 11:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration