# Managed by ansible
[Unit]
Description=Connect THECUS iSCSI disks
Requires=dhcpcd.service iscsid.service
After=dhcpcd.service iscsid.service
Wants=network.target
# Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=bash -xc "/usr/bin/ip addr show dev enp1s0f1 | grep -F 192.168.0.10/24 || /usr/bin/ip addr add 192.168.0.10/24 dev enp1s0f1"
ExecStart=/usr/bin/bash -xc "for i in `/usr/bin/iscsiadm -m discovery -t sendtargets -p 192.168.0.100 | cut -d' ' -f2`; do /usr/bin/iscsiadm -m node --targetname=$i --login -p 192.168.0.100; done"
# ExecStart=/usr/bin/iscsiadm -m discovery -t sendtargets -p 192.168.0.100
## ExecStart=/usr/bin/iscsiadm -m node --targetname=iqn.2016-04.com.thecus.n8800prov2:iscsi.3x4t.raid0 --login -p 192.168.0.100
## ExecStart=/usr/bin/iscsiadm -m node --targetname=iqn.2016-12.com.thecus.n8800prov2:iscsi.raid5b.raid1 --login -p 192.168.0.100
# ExecStart=/usr/bin/iscsiadm -m node --targetname=iqn.2016-12.com.thecus.n8800prov2:iscsi.raid5b.raid0 --login -p 192.168.0.100
# ExecStart=/usr/bin/iscsiadm -m node --targetname=iqn.2021-08.com.thecus.n8800prov2:iscsi.single4ta.raid1 --login -p 192.168.0.100
# ExecStart=/usr/bin/iscsiadm -m node --targetname=iqn.2021-09.com.thecus.n8800prov2:iscsi.single4tb.raid2 --login -p 192.168.0.100

[Install]
WantedBy=multi-user.target
