Skip to content

Instantly share code, notes, and snippets.

@cocampbe
Created March 14, 2019 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocampbe/8d3b5ea33625825916ea08b21cb60802 to your computer and use it in GitHub Desktop.
Save cocampbe/8d3b5ea33625825916ea08b21cb60802 to your computer and use it in GitHub Desktop.
Simple ansible playbook to push ssh public key to hosts
---
- hosts: all
gather_facts: false
become: no
tasks:
- name: copy ssh key public key
lineinfile:
line: 'your_public key string'
path: /home/your_home_directory/.ssh/authorized_keys
create: yes
@cocampbe
Copy link
Author

Use the -k option to prompt for your ssh password to push the key to multiple hosts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment