lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

vda    252:0    0   50G  0 disk

├─vda1 252:1    0  500M  0 part /boot

├─vda2 252:2    0    4G  0 part [SWAP]

└─vda3 252:3    0 10.5G  0 part /

---

- hosts: default

  become: true

  become_method: sudo

  tasks:

    - name: part1

      parted:

        device: "/dev/vda1"

        number: 1

        state: present

    - name: filesystem

      filesystem:

        fstype: ext4

        dev: /dev/vda1

    - name: mounted

      mount:

        path: /opt

        src: /dev/vda1

        fstype: ext4

        state: mounted


    - name: partition

      lvg:

        vg: "datavg"

        pvs: "/dev/vda1"

        state: present

    - name: resize pv

      command: "pvresize /dev/vda1"


    - name: activate vg

      command: "vgchange -a y datavg"


    - name: Ensure

      lvol:

        vg: datavg

        lv: datalv

        size: "100%FREE"

      ignore_errors: true


    - name: sql file

      filesystem:

        dev: "/dev/datavg


error:

TASK [part1] 
**********************************************************************************************************************************************************************************************

fatal: [localhost]: FAILED! => {"changed": false, "err": "Error: 
Partition(s) on /dev/vda1 are being used.\n", "msg": "Error while running 
parted script: /sbin/parted -s -m -a optimal /dev/vda1 -- unit KiB mklabel 
msdos mkpart primary 0% 100%", "out": "", "rc": 1}



On Monday, July 11, 2022 at 10:52:11 AM UTC+5:30 Ashok Reddy wrote:

> Thanks for providing your input.
>
> On Friday, July 8, 2022 at 5:18:41 PM UTC+5:30 [email protected] wrote:
>
>>
>>
>> On 2022-07-08 (Fri) 11:50, Ashok Reddy wrote:
>> > I am trying to create new partition.
>> > If that is not available, so that only need to create the /dev/vdb 
>> > partition.
>>
>> Your logic is flawed.
>> You cannot create devices.
>> You can only create partitions on existing devices.
>>
>>
>>
>>

-- 
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/0601f782-eb0c-4771-9a80-3250d1100f2bn%40googlegroups.com.

Reply via email to