Created
March 14, 2019 13:17
-
-
Save cocampbe/8d3b5ea33625825916ea08b21cb60802 to your computer and use it in GitHub Desktop.
Simple ansible playbook to push ssh public key to hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the -k option to prompt for your ssh password to push the key to multiple hosts.