---
- hosts: all
  tasks:
  - name: Create ssh directory
    file:
      path: /root/.ssh
      state: directory
      mode: '0700'
  - name: Add master node key to node
    blockinfile:
      block: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}"
      dest: /root/.ssh/authorized_keys


---
- hosts: all
  tasks:
  - name: Create ssh directory
    file:
      path: /root/.ssh
      state: directory
      mode: '0700'
  - name: Add master node key to node
    blockinfile:
      block: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}"
      dest: /root/.ssh/authorized_keys
      create: yes


Create authorized_keys file in add node playbook
Create authorized_keys file in add node playbook
