--- - name: resize a partition of a qcow-based instance - quickly using cloud-utils hosts: myhostshere user: root gather_facts: False vars: - dev: /dev/vda - part: 2 tasks: - name: install cloud-utils action: yum name=cloud-utils state=present - name: growpart the second partition (/) to full size action: command growpart $dev $part ignore_errors: true register: growpart - name: reboot the box action: command /sbin/reboot when_integer: ${growpart.rc} == 0 - name: wait for it to come back (should be quick) local_action: wait_for host=${inventory_hostname} port=22 delay=10 timeout=120 when_integer: ${growpart.rc} == 0 - name: resize the ${dev}${part} fs action: command resize2fs ${dev}${part} when_integer: ${growpart.rc} == 0