LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 06: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, 10:49 AM   #2
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
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, 12: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



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 01:36 AM
software as a service? virtualization? ssh? how to deploy a new aplication jbcolmena Linux - Server 4 07-30-2010 01:51 PM
SSH host keys are not being read correctly from .ssh/known_hosts. bartonski Linux - Software 3 10-29-2009 04:40 PM
SSH host keys VS SSH keys kenneho Linux - Security 3 09-11-2008 06:03 AM
Configuring SSH to accept only keys (already have keys) fr0st Linux - Security 3 11-04-2003 03:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:31 PM.

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
Open Source Consulting | Domain Registration