---
- name: Install gdeploy
  package:
    name: gdeploy
    state: latest
- name: Ensure root has an .ssh directory
  file:
    path: /root/.ssh
    owner: root
    group: root
    mode: 0700
    state: directory
- name: Wipe existing known_hosts file
  file:
    path: /root/.ssh/known_hosts
    state: absent
- name: Gather ssh keys
  shell: /usr/bin/ssh-keyscan -t ecdsa  {{ hostvars[ item ]['ansible_default_ipv4']['address'] }} >> /root/.ssh/known_hosts
  with_items:
    - "{{ groups['hypervisors'] }}"
- name: Create gdeploy.conf from template
  template:
    src: gdeploy.conf
    dest: /root/gdeploy.conf
  notify: run gdeploy
