Last active
August 29, 2015 14:01
-
-
Save t2ru/25ebcd1fff051198cc43 to your computer and use it in GitHub Desktop.
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: | |
- servers | |
vars: | |
ansible_ssh_user: root | |
tasks: | |
- name: make sure local keys directory exists | |
local_action: file path=./keys state=directory | |
- name: check key pair exists | |
local_action: command test -f keys/id_rsa | |
failed_when: false | |
register: key_pair_exists | |
changed_when: key_pair_exists.rc != 0 | |
- name: generating ssh key pair | |
local_action: shell ssh-keygen -t rsa -f keys/id_rsa -N "" | |
when: key_pair_exists|changed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment