- name: Install packages 'parted' and 'cloud-guest-utils' (for /usr/bin/growpart, though raspi-config uses fdisk)
  package:
    name:
      - parted               # 2022-03-15: RasPiOS and Ubuntu install this regardless -- so rarely nec, but just in case.
      - cloud-guest-utils    # 2022-04-02: For growpart command -- whereas RasPiOS's 'raspi-config --expand-rootfs' instead uses fdisk (requiring a reboot, see do_expand_rootfs() in https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config).  FYI Ubuntu pre-installs cloud-guest-utils, for use with cloud-init.
    state: present

- name: "Install from templates: /usr/sbin/iiab-expand-rootfs, /etc/systemd/system/iiab-expand-rootfs.service"
  template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: "{{ item.mode }}"
  with_items:
    - { src: 'iiab-expand-rootfs', dest: '/usr/sbin/', mode: '0755' }
    - { src: 'iiab-expand-rootfs.service', dest: '/etc/systemd/system/', mode: '0644' }

- name: Enable iiab-expand-rootfs.service
  systemd:
    name: iiab-expand-rootfs
    enabled: yes