I have seen something similar with re-running LVM operations and remember they 
mentioned to add a force: yes option (I don't recall the exact wording though) 
in oder the not fail on re-execution. Wondering whether something alike would 
help here too.


> On 12/06/2021 10:07 AM Lucas Possamai <[email protected]> wrote:
> 
> 
> Hi all.
> 
> I'm having issues with the parted plugin. It works when I run the playbook 
> for the first time, but if I try to run again, it will fail.
> 
> I actually want this task to be run only once, but the run_once parameter is 
> not working either.
> 
> ------------------------------------------------
> 
> - name: Add new partition "{{ data_volume }}"
> run_once: true
> parted:
> device: "{{ data_volume }}"
> number: 2
> fs_type: ext4
> state: present
> 
> Error: 
> fatal: [localhost]: FAILED! => {"changed": false, "err": "Error: Partition(s) 
> on /dev/nvme2n1 are being used.\n", "msg": "Error while running parted 
> script: /usr/sbin/parted -s -m -a optimal /dev/nvme2n1 -- unit KiB mklabel 
> msdos mkpart primary ext4 0% 100%", "out": "", "rc": 1}
> 
> If I unmount the partition, it will work. But then it will delete everything 
> in that partition and I don't want that if I am running the playbook for the 
> second or third time.
> 
> ------------------------------------------------
> 
> 
> All the tasks relevant are below:
> 
> - name: Add new partition "{{ data_volume }}"
> run_once: true
> parted:
> device: "{{ data_volume }}"
> number: 2
> fs_type: ext4
> state: present
> 
> - name: Create a ext4 filesystem on "{{ data_volume }}" (/data)
> run_once: true
> community.general.filesystem:
> fstype: ext4
> dev: "{{ data_volume }}"
> 
> - name: Mount /data
> ansible.posix.mount:
> path: /data
> src: "{{ data_volume }}"
> fstype: ext4
> state: mounted
> opts: defaults
> 
> What am I missing?
> 
> I'm using Ansible 2.11 and Ubuntu 20.
> 
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> mailto:[email protected] .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/CAE_gQfVZwnbceY%3DsSPu5updRQ8_1ZieJDiwX_a78AD3pndXKpQ%40mail.gmail.com
>  
> https://groups.google.com/d/msgid/ansible-project/CAE_gQfVZwnbceY%3DsSPu5updRQ8_1ZieJDiwX_a78AD3pndXKpQ%40mail.gmail.com?utm_medium=email&utm_source=footer
>  .
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/983409790.526213.1638782482524%40office.mailbox.org.

Reply via email to