Refactor to idempotent methods
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Danny Bessems 2022-04-20 08:18:13 +02:00
parent 5e83766370
commit 51302033aa
1 changed files with 15 additions and 3 deletions

View File

@ -66,9 +66,21 @@
groups: k3s_ha
with_items: "{{ nodes }}"
- name: Store public keys in 'known_hosts'
ansible.builtin.command:
cmd: ssh-keyscan -t rsa {{ item.ip }} >> ~/.ssh/known_hosts
- name: Add new VM's as 'known_hosts'
block:
- name: Scan public key
ansible.builtin.command:
cmd: "ssh-keyscan -t rsa {{ item.ip }}"
register: publickey
- name: Store public key
ansible.builtin.known_hosts:
name: "{{ item.name }}"
key: "{{ publickey.stdout }}"
state: present
path: ~/.ssh/known_hosts
with_items: "{{ nodes }}"
- name: Provision Kubernetes