Hello,
i am trying to create file which will be use to create partition in windows.
I am using variables in below format.
additional_disks:
- drive_letter: E
mount_point: TMP1
disk_size: 7
label: DBInstall
block_size: 4096k
datastore: vsanDatastoreCMP001 - drive_letter: F
mount_point: TMP2
disk_size: 9
label: DBInstall1
block_size: 4096k
datastore: vsanDatastoreCMP001 - drive_letter: G
mount_point: TMP3
disk_size: 10
label: DBInstall2
block_size: 4096k
datastore: vsanDatastoreCMP001
I am using below code:
- name: Testing Iteration
copy:
dest: /tmp/testtemp
content: |
{% for var in additional_disks %}
select disk {{ my_idx | int +2 }}
create partition primary
assign letter “{{ item.drive_letter }}”
format fs=ntfs label={{ item.label }} quick
{% endfor %}
with_items: - “{{ additional_disks }}”
loop_control:
index_var: my_idx
label: " "
delegate_to: localhost
Gettin output:
select disk 4
create partition primary
assign letter “G”
format fs=ntfs label=DBInstall2 quick
select disk 4
create partition primary
assign letter “G”
format fs=ntfs label=DBInstall2 quick
select disk 4
create partition primary
assign letter “G”
format fs=ntfs label=DBInstall2 quick
expected output:
select disk 2
create partition primary
assign letter E
format fs=ntfs label=DBInstall quick
select disk 3
create partition primary
assign letter F
format fs=ntfs label=DBInstall quick
select disk 4
create partition primary
assign letter G
format fs=ntfs label=DBInstall2 quick
Can you please help to get correct outpt.