fix: persist iscsi connections on reboot and wait for network before mount
Some checks failed
Deploy / Prepare Build (push) Failing after 3m58s

This commit is contained in:
2024-11-01 02:23:30 +10:00
parent dab2fea58b
commit cdc0144a2b
6 changed files with 202 additions and 193 deletions

View File

@ -29,6 +29,10 @@
command: sudo iscsiadm -m node -T "{{ target_iqn }}" -p "10.10.10.2" --login
when: target_iqn is defined and target_iqn not in iscsi_sessions.stdout
- name: Set iSCSI target for automatic login
command: sudo iscsiadm -m node -T "{{ target_iqn }}" -p "10.10.10.2" --op update --name node.startup --value automatic
when: target_iqn is defined
- name: Fail if no target_iqn found
fail:
msg: "No target IQN found for iSCSI server IP 10.10.10.2"
@ -74,10 +78,11 @@
path: /data
src: "{{ iscsi_device }}1" # Mount the new partition
fstype: ext4
opts: defaults,_netdev
state: mounted
- name: Ensure iSCSI target is mounted at boot
lineinfile:
path: /etc/fstab
line: "{{ iscsi_device }}1 /data ext4 defaults 0 0"
state: present
# - name: Ensure iSCSI target is mounted at boot
# lineinfile:
# path: /etc/fstab
# line: "{{ iscsi_device }}1 /data ext4 _netdev 0 0"
# state: present