---
- hosts: dramble
  become: yes

  vars_files:
    - vars/main.yml
    - config.yml

  pre_tasks:
    - name: Ensure dependencies are installed.
      apt: name={{ item }} state=present
      with_items:
        - sudo
        - openssh-server

    - import_tasks: tasks/cgroup-features.yml

    - name: Disable swap.
      command: >
        dphys-swapfile swapoff &&
        dphys-swapfile uninstall &&
        update-rc.d dphys-swapfile remove
      when: ansible_swaptotal_mb > 0

    # See: https://github.com/geerlingguy/raspberry-pi-dramble/issues/65
    # - name: Ensure rpcbind is purged (first run only).
    #   apt: name=rpcbind state=absent purge=yes

  roles:
    # TODO: Re-enable firewall once I can figure out exactly which ports are
    # required to get cni, flannel, etc. all working correctly.
    # - { role: geerlingguy.firewall, tags: ['firewall'] }
    - { role: geerlingguy.security, tags: ['security'] }
    - { role: geerlingguy.nfs, tags: ['nfs'] }
    - { role: geerlingguy.pip, tags: ['pip', 'docker'] }
    - { role: docker-arm, tags: ['docker'] }
    - { role: geerlingguy.kubernetes, tags: ['kubernetes'] }
    - { role: leds, tags: ['leds'] }

  tasks:
    - include_tasks: tasks/nfs.yml
    - import_tasks: tasks/led-monitor.yml

---
- hosts: dramble
  become: yes

  vars_files:
    - vars/main.yml
    - config.yml

  pre_tasks:
    - name: Ensure dependencies are installed.
      apt: name={{ item }} state=present
      with_items:
        - sudo
        - openssh-server

    - import_tasks: tasks/cgroup-features.yml

    - name: Disable swap.
      command: >
        dphys-swapfile swapoff &&
        dphys-swapfile uninstall &&
        systemctl disable dphys-swapfile
      when: ansible_swaptotal_mb > 0

    # See: https://github.com/geerlingguy/raspberry-pi-dramble/issues/65
    # - name: Ensure rpcbind is purged (first run only).
    #   apt: name=rpcbind state=absent purge=yes

  roles:
    # TODO: Re-enable firewall once I can figure out exactly which ports are
    # required to get cni, flannel, etc. all working correctly.
    # - { role: geerlingguy.firewall, tags: ['firewall'] }
    - { role: geerlingguy.security, tags: ['security'] }
    - { role: geerlingguy.nfs, tags: ['nfs'] }
    - { role: geerlingguy.pip, tags: ['pip', 'docker'] }
    - { role: docker-arm, tags: ['docker'] }
    - { role: geerlingguy.kubernetes, tags: ['kubernetes'] }
    - { role: leds, tags: ['leds'] }

  tasks:
    - include_tasks: tasks/nfs.yml
    - import_tasks: tasks/led-monitor.yml

Make sure swap doesn't survive a reboot.
Make sure swap doesn't survive a reboot.
