Created
February 18, 2019 08:35
-
-
Save Zooloo2014/29c7552b31f5069669caae7b5d1d2f82 to your computer and use it in GitHub Desktop.
Ansible role for checking existence of SSH key on target
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
--- | |
- set_fact: do_token="{{ lookup('env', 'DO_API_TOKEN')}}" | |
- set_fact: ssh_key_name="{{ lookup('env', 'SSH_KEY_NAME')}}" | |
- name: ensure ssh key exists and get the key id | |
digital_ocean: | |
state: present | |
command: ssh | |
name: my_ssh_key | |
ssh_pub_key: "{{ lookup('file', '{{ ssh_key_name }}.pub') }}" | |
register: my_ssh_key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment