Partitioning Mismatch

Hi guys. So i have a problem i couldn’t find an answer to. It’s hard to describe, but i try.

I want to partition and install the OS in my SSD and use ansible later to partition my HDD.
I am using this ruby-code in my partition-template to find my SSD

<%ssd = nil%>
<%if @host.facts['blockdevices'] != nil %>
<%devices = @host.facts['blockdevices'].split(',')%>

<%if devices != nil%>
<%for device in devices%>
# Device = <%=device%>
# Size = <%=@host.facts['blockdevice_' + device +'_size']%>
# Model = <%=@host.facts['blockdevice_' + device +'_model']%>
 <%model=@host.facts['blockdevice_' + device +'_model']%>
 <%if model == 'SK hynix SC311 S'%> <%ssd = device%> <%end%>
# SSD found in <%=ssd%>

# select disks for partman 
d-i partman-auto/disk string /dev/<%=ssd%>

If i use the preview Button i see:

 Device = sda
 Size = 256060514304
 Model = SK hynix SC311 S

 Device = sdb
 Size = 1000204886016
 Model = ST1000LM049-2GH1
 Device = sdc
 Size = 0
 Model = SD/MMC CRW
 Device = sr0
 Size = 1073741312
 Model = DVD+-RW GU90N

# SSD found in sda

# select disks for partman
d-i partman-auto/disk string /dev/sda

Expected outcome:
Building a Host should partition the SSD.

Actual outcome
It Stops at [!!] Partition Disks with Error: No root file system
looking at the available disks it now tells me my SSD is sdb and my HDD sdc. sda is not listed. My suspicion is, that it take the alphabetical order (as found under /dev/disks/by-id) and puts the DVD drive as sda.

How should i change my Code, so this won"t occur?
Thanks in advance

What are facts coming from? If it was discovery, then it’s a different kernel version with different flags, disks may appear in incorrect order. Can you use /dev/disks/by-path (physical names I think it is) perhaps?

Sorry for the late response.
Yes, it seems like the mismatch happens because of different versions.
But i can’t use /dev/disk/by-id/ either, since the devices all look like this

/dev/disk/by-id # ls
ata-SK-<Modelname>-<unique string>

How would you usually partition multiple disks at one?