---
- name: /etc/sysctl.d/99-kubernetes-cri.conf
  copy:
    dest: /etc/sysctl.d/99-kubernetes-cri.conf
    content: |
      net.bridge.bridge-nf-call-iptables  = 1
      net.ipv4.ip_forward                 = 1
      net.bridge.bridge-nf-call-ip6tables = 1
    mode: 0644
    owner: root
    group: root
  notify: "Reboot Server"

- name: /etc/modules-load.d/netfilter.conf
  copy:
    dest: /etc/modules-load.d/netfilter.conf
    content: |
      overlay
      br_netfilter
    mode: 0644
    owner: root
    group: root
  notify: "Reboot Server"

- name: /etc/networkd-dispatcher/routable.d/50-ifup-promisc
  copy:
    dest: /etc/networkd-dispatcher/routable.d/50-ifup-promisc
    content: |
      #!/bin/sh
      ip link set eth0 promisc on
    mode: 0755
    owner: root
    group: root
  notify: "Reboot Server"
  when: board == "pi4"

- name: /etc/network/if-up.d/50-ifup-promisc
  copy:
    dest: /etc/network/if-up.d/50-ifup-promisc
    content: |
      #!/bin/sh
      ip link set eth0 promisc on
    mode: 0755
    owner: root
    group: root
  notify: "Reboot Server"
  when: board == "pine64"

- name: Shared mount point
  file:
    path: /mnt/shared
    state: directory
    owner: nobody
    group: nogroup

- name: Public Share
  ansible.posix.mount:
    src: 10.42.42.10:/mnt/DroboFS/Shares/Public
    path: /mnt/shared
    opts: _netdev,auto,nofail,noatime,nolock,intr,tcp,actimeo=1800
    state: mounted
    fstype: nfs

- name: Shared mount point
  file:
    path: /mnt/kubernetes
    state: directory
    owner: nobody
    group: nogroup
  
- name: Kubernetes Share
  ansible.posix.mount:
    src: 10.42.42.10:/mnt/DroboFS/Shares/Kubernetes
    path: /mnt/kubernetes
    opts: _netdev,auto,nofail,noatime,nolock,intr,tcp,actimeo=1800
    state: mounted
    fstype: nfs
