Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ansible role for checking existence of SSH key on target
---
- 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
You can’t perform that action at this time.