Skip to content

Instantly share code, notes, and snippets.

@vicendominguez
Created May 19, 2014 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vicendominguez/2c2fde50270c0eb89427 to your computer and use it in GitHub Desktop.
Save vicendominguez/2c2fde50270c0eb89427 to your computer and use it in GitHub Desktop.
Ansible:plauing with pub keys
#this is a part of the original playbook:
- name: Creating pub SSH keys
command: ssh-keygen -N '' -f /root/.ssh/id_rsa
- name: Downloading pub key
fetch: src=/root/.ssh/id_rsa.pub dest=/tmp/id_rsa.tmp flat=yes
- name: Coping local key to other.server.net
local_action: shell cat /tmp/id_rsa.tmp | ssh -p 2244 root@other.server.net "cat >> /root/.ssh/authorized_keys"
- name: Deleting temporal files
local_action: command rm -f /tmp/id_rsa.tmp
- name: Syncing configuration files from other.server.net
shell: rsync -avHz --rsh='ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p2244' root@other-server.net:/opt/conf/* /opt/conf/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment