---
- block:
  # note: mdadm.postinst calls update-grub, which is stubbed by the grub role
  - name: Install mdadm package
    apt:
      name: mdadm
      install_recommends: no
      cache_valid_time: "{{ apt_cache_valid_time }}"

  - name: Set raid variables for mdadm config file
    set_fact:
      raid_name: zooxdata
      raid_mount_point: /media/zoox/zooxdata
      raid_device: /dev/md/0
      raid_metadata_version: 1.2

  - name: Render mdadm config file
    template:
      src: mdadm.conf.j2
      dest: /etc/mdadm/mdadm.conf

  - name: Update initramfs
    command: update-initramfs -u -k {{ zoox_kernel_version }}

  become: yes
