--- - name: ensure cloud-init packages are installed package: name: - cloud-init - cloud-utils-growpart - gdisk - block: - name: ensure cloud-init scripts directory exists file: path: /var/lib/cloud/scripts/per-instance state: directory mode: '0755' - name: create growpart cloud-init script to grow partition on boot template: src: grow_part.sh.j2 dest: /var/lib/cloud/scripts/per-instance/grow_part.sh mode: u=rwx,g=rx,o=rx # when: # - ansible_lvm is defined # - ansible_lvm.lvs is defined # - ansible_lvm.lvs[the_root_lvname] is defined # - ansible_lvm.lvs[the_root_lvname].vg is defined # - ansible_lvm.vgs is defined # - ansible_lvm.pvs is defined # - ansible_cmdline is defined # - ansible_cmdline.root is defined # - ansible_lvm.lvs[the_root_lvname].vg in ansible_cmdline.root