I am trying to expand an ext4 partition to fill a disk on Alpine using Ansible.
Following the community parted module documentation here I should be able too. However when it comes to performing that action the returned error message says "Warning: Partition /dev/xvda3 is being used. Are you sure you want to continue?\n".
Is there anyway to force this action to proceed on a live system as it looks like Parted is asking for user interaction even though the -s flag is enable?
The task I'm using:
- name: Read device information
community.general.parted: device=/dev/xvda unit=MiB
register: sdb_info
- name: Extend an existing partition to fill all available space
community.general.parted:
device: /dev/xvda
number: "{{ sdb_info.partitions | length }}"
part_end: "100%"
resize: true
state: present
The full error from ansible-playbook main.yaml -vvvv:
fatal: [10.10.30.100]: FAILED! => {
"changed": false,
"err": "Warning: Partition /dev/xvda3 is being used. Are you sure you want to continue?\n",
"invocation": {
"module_args": {
"align": "optimal",
"device": "/dev/xvda",
"flags": null,
"fs_type": null,
"label": "msdos",
"name": null,
"number": 3,
"part_end": "100%",
"part_start": "0%",
"part_type": "primary",
"resize": true,
"state": "present",
"unit": "KiB"
}
},
"msg": "Error while running parted script: /usr/sbin/parted -s -m -a optimal /dev/xvda -- resizepart 3 100%",
"out": "",
"rc": 1
}
Target host:
- Alpine-VM 3.16.2
- Parted 3.5
- Python 3.10.5
Local:
- Ansible 2.13.3
- Python 3.10.4