Refactor block
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
parent
51302033aa
commit
a52d8014d1
17
playbook.yml
17
playbook.yml
@ -66,22 +66,19 @@
|
|||||||
groups: k3s_ha
|
groups: k3s_ha
|
||||||
with_items: "{{ nodes }}"
|
with_items: "{{ nodes }}"
|
||||||
|
|
||||||
- name: Add new VM's as 'known_hosts'
|
- name: Scan public keys
|
||||||
block:
|
|
||||||
|
|
||||||
- name: Scan public key
|
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: "ssh-keyscan -t rsa {{ item.ip }}"
|
cmd: "ssh-keyscan -t rsa {{ item.ip }}"
|
||||||
register: publickey
|
register: publickeys
|
||||||
|
with_items: "{{ nodes }}"
|
||||||
|
|
||||||
- name: Store public key
|
- name: Store public keys
|
||||||
ansible.builtin.known_hosts:
|
ansible.builtin.known_hosts:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item.item }}"
|
||||||
key: "{{ publickey.stdout }}"
|
key: "{{ item.stdout }}"
|
||||||
state: present
|
state: present
|
||||||
path: ~/.ssh/known_hosts
|
path: ~/.ssh/known_hosts
|
||||||
|
with_items: "{{ publickeys.results }}"
|
||||||
with_items: "{{ nodes }}"
|
|
||||||
|
|
||||||
- name: Provision Kubernetes
|
- name: Provision Kubernetes
|
||||||
hosts: k3s_ha
|
hosts: k3s_ha
|
||||||
|
Loading…
Reference in New Issue
Block a user