Hi ,
Terraform create linux vm using custom image which has an attached the managed data disk and that data disk is already portioned. In papally terraform added the second and third data disk into vm .
Now i tried to run ansible playbook to partitioned the second and third data disk (lun values = 2 and 3) using parted module
-
name: fact for lun1 and lun2
set_fact:
lun: “[ ‘2’,‘3’ ]” -
name: lun disks information
community.general.parted:
device: /dev/disk/azure/scsi1/lun{{ item }}
unit: MiB
loop: ‘{{ lun }}’
register: lun_info -
name: Use parted to make new disk and label
community.general.parted:
device: /dev/disk/azure/scsi1/lun{{ item.item }}
label: “gpt”
number: ‘{{ item.item }}’
state: present
part_end: “100%”
resize: true
loop: ‘{{ lun_info.results }}’
So then error msg will be as below . So can someone help on this ?
“changed”: false,
912 “err”: “Error: You requested a partition from 0.00kiB to 536870912kiB (sectors 0…1073741823).\nThe closest location we can manage is 17.0kiB to 1024kiB (sectors 34…2047).\n”,
913 “item”: {
914 “ansible_loop_var”: “item”,
915 “changed”: false,
916 “disk”: {
917 “dev”: “/dev/sdd”,
918 “logical_block”: 512,
919 “model”: “Msft Virtual Disk”,
920 “physical_block”: 4096,
921 “size”: 524288.0,
922 “table”: “gpt”,
923 “unit”: “mib”
924 },
925 “failed”: false,
926 “invocation”: {
927 “module_args”: {
928 “align”: “optimal”,
929 “device”: “/dev/disk/azure/scsi1/lun2”,
930 “flags”: null,
931 “fs_type”: null,
932 “label”: “msdos”,
933 “name”: null,
934 “number”: null,
935 “part_end”: “100%”,
936 “part_start”: “0%”,
937 “part_type”: “primary”,
938 “resize”: false,
939 “state”: “info”,
940 “unit”: “MiB”
941 }
942 },
943 “item”: “2”,
944 “partitions”: [
945 {
946 “begin”: 1.0,
947 “end”: 524287.0,
948 “flags”: ,
949 “fstype”: “”,
950 “name”: “primary”,
951 “num”: 1,
952 “size”: 524286.0,
953 “unit”: “mib”
954 }
955 ],
956 “script”: “unit ‘MiB’ print”
957 },
958 “out”: “”,
959 “rc”: 1
960}
961MSG:
962Error while running parted script: /sbin/parted -s -m -a optimal /dev/disk/azure/scsi1/lun2 – unit KiB mkpart primary 0% 100%