diff --git a/ansible/files/antea/iscsi-thecus.service b/ansible/files/antea/iscsi-thecus.service index 607173aea630b44bf0b722d5501504d1092d42ac..4846b0d2610e0dc9460384c019131afd0ff9010e 100644 --- a/ansible/files/antea/iscsi-thecus.service +++ b/ansible/files/antea/iscsi-thecus.service @@ -1,22 +1,22 @@ # Managed by ansible [Unit] Description=Connect THECUS iSCSI disks -Requires=dhcpcd.service -After=dhcpcd.service +Requires=dhcpcd.service iscsid.service +After=dhcpcd.service iscsid.service Wants=network.target # Before=network.target [Service] Type=oneshot RemainAfterExit=yes -# ExecStart=/usr/bin/ip link set up dev enp1s0f1 -ExecStart=/usr/bin/ip addr add 192.168.0.10/24 dev enp1s0f1 -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 +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