---
- hosts: all
  vars:
    node_ip_address: 10.254.0.254
  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
  #- name: Add node name to hosts file
  - name: Add node to cockpit
    template:
      src: ../templates/cockpit-machine.j2
      dest: /etc/cockpit/machines.d/{{node_ip_address}}-sotolito.json
      owner: root
      group: wheel
      mode: '0644'


---
- hosts: all
  vars:
    node_ip_address: 10.254.0.254
  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
  #- name: Add node name to hosts file
  - name: Add node to cockpit
    template:
      src: cockpit-machine.j2
      dest: /etc/cockpit/machines.d/{{node_ip_address}}-sotolito.json
      owner: root
      group: wheel
      mode: '0644'


Fix node playbook template path
Fix node playbook template path
