zuul-jobs/roles/add-sshkey/tasks/main.yaml
Monty Taylor b214e276ec
Add role for adding ssh key to remote nodes
Some tasks, such as proposal tasks, need to make outbound ssh
connections via non-ansible means. Add a role that takes a secret and
writes out a private key and optionally a known hosts entry.

Change-Id: I569b93ba0e775896b5a4f59b544fe32d1e2dce9b
2017-08-25 17:18:27 -05:00

11 lines
312 B
YAML

- name: Write out ssh key
file:
path: "~/.ssh/id_rsa"
content: "{{ ssh_key.ssh_private_key }}"
- name: Add host key information to known hosts
known_hosts:
name: "{{ ssh_key.fqdn }}"
key: "{{ ssh_key.ssh_known_hosts }}"
when: ssh_key.ssh_known_hosts is defined and ssh_key.fqdn is defined