Skip to content

Commit 4dbd711

Browse files
authored
fix dead link and change the remote exec example by simpler inline example (#45)
1 parent af91f3c commit 4dbd711

File tree

1 file changed

+1
-91
lines changed

1 file changed

+1
-91
lines changed

README.md

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -79,98 +79,8 @@ net start winrm
7979
## Configure iSCSI volume attachments
8080
* For guidance configuring iSCSI on a Windows platform, see [Adding a Block Volume to a Windows Instance](https://docs.cloud.oracle.com/iaas/Content/GSG/Tasks/addingstorageForWindows.htm).
8181

82-
* For guidance configuring iSCSI on a Linux platform, see [iSCSI Commands and Information](https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/iscsiinformation.htm). See also the example file [remote-exec.tf](https://github.com/oracle/terraform-provider-oci/blob/master/docs/examples/compute/instance/remote-exec.tf) for inline commands using `remote_exec_script`.
82+
* For guidance configuring iSCSI on a Linux platform, see [iSCSI Commands and Information](https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/iscsiinformation.htm). See also this example of inline iSCSI commands execution using `iscsiadm` CLI called from terraform file: [instance.tf](https://github.com/terraform-providers/terraform-provider-oci/blob/master/examples/compute/instance/instance.tf).
8383

84-
Following is the sample inline script that isn't using CHAP authentication:
85-
86-
```hcl
87-
# Logging for troubleshooting.
88-
set -x
89-
sudo -s bash -c "lsscsi -t"
90-
91-
# Command provided in Oracle Cloud Infrastructure console to register ISCSI device.
92-
sudo -s bash -c "iscsiadm -m node -o new -T ${self.iqn} -p ${self.ipv4}:${self.port}"
93-
94-
# Command provided in Oracle Cloud Infrastructure console for registration to survive reboot.
95-
sudo -s bash -c "iscsiadm -m node -o update -T ${self.iqn} -n node.startup -v automatic"
96-
97-
# Command provided in Oracle Cloud Infrastructure console to log into iscsi device.
98-
sudo -s bash -c "iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -l"
99-
100-
# troubleshooting command.
101-
sudo -s bash -c "lsscsi -t"
102-
103-
# troubleshooting command.
104-
lsscsi -t | grep disk | grep ${self.iqn} | awk '{print $1,$2,$3,$4,$5}'
105-
106-
# Find the specific OS level device that is associated with the iscsi volume.
107-
device=$(lsscsi -t | grep disk | grep ${self.iqn} | awk '{print $4}')
108-
109-
# Create a file system on the device. In this case, we use the ext4 filesystem.
110-
sudo -s bash -c "mkfs.ext4 -F $device"
111-
112-
# Find the UUID of the iscsi volume.
113-
uuid=$(sudo blkid | grep $device | awk '{print $2}')
114-
115-
# Create a directory in the OS to mount the new filesystem.
116-
sudo -s bash -c "mkdir -p ${var.volume_mount_directory}"
117-
118-
# Mount the filesystem so that it is available.
119-
sudo -s bash -c "mount -t ext4 $uuid ${var.volume_mount_directory}"
120-
121-
# Ensure the filesystem is loaded on a reboot of the instance.
122-
echo "$uuid ${var.volume_mount_directory} ext4 defaults,noatime,_netdev,nofail 0 2" | sudo tee --append /etc/fstab > /dev/null
123-
```
124-
125-
Following is the sample inline script for using CHAP authentication:
126-
127-
```hcl
128-
# Logging for troubleshooting.
129-
set -x
130-
sudo -s bash -c "lsscsi -t"
131-
132-
# Command provided in Oracle Cloud Infrastructure console to register ISCSI device.
133-
sudo -s bash -c "iscsiadm -m node -o new -T ${self.iqn} -p ${self.ipv4}:${self.port}"
134-
135-
# Command provided in Oracle Cloud Infrastructure console for registration to survive reboot.
136-
sudo -s bash -c "iscsiadm -m node -o update -T ${self.iqn} -n node.startup -v automatic"
137-
138-
# Authenticate the iSCSI connection by providing the volume's CHAP credentials.
139-
sudo -s bash -c "iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -o update -n node.session.auth.authmethod -v CHAP"
140-
141-
# Provide the volume's CHAP user name.
142-
sudo -s bash -c "iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -o update -n node.session.auth.username -v ${self.chap_username}"
143-
144-
# Provide the volume's CHAP password.
145-
sudo -s bash -c "iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -o update -n node.session.auth.password -v ${self.chap_secret}"
146-
147-
# Command provided in Oracle Cloud Infrastructure console to log into iscsi device.
148-
sudo -s bash -c "iscsiadm -m node -T ${self.iqn} -p ${self.ipv4}:${self.port} -l"
149-
150-
# troubleshooting command.
151-
sudo -s bash -c "lsscsi -t"
152-
153-
# troubleshooting command.
154-
lsscsi -t | grep disk | grep ${self.iqn} | awk '{print $1,$2,$3,$4,$5}'
155-
156-
# Find the specific OS level device that is associated with the iscsi volume.
157-
device=$(lsscsi -t | grep disk | grep ${self.iqn} | awk '{print $4}')
158-
159-
# Create a file system on the device. In this case, we use the ext4 filesystem.
160-
sudo -s bash -c "mkfs.ext4 -F $device"
161-
162-
# Find the UUID of the iscsi volume.
163-
uuid=$(sudo blkid | grep $device | awk '{print $2}')
164-
165-
# Create a directory in the OS to mount the new filesystem.
166-
sudo -s bash -c "mkdir -p ${var.volume_mount_directory}"
167-
168-
# Mount the filesystem so that it is available.
169-
sudo -s bash -c "mount -t ext4 $uuid ${var.volume_mount_directory}"
170-
171-
# Ensure the filesystem is loaded on a reboot of the instance.
172-
echo "$uuid ${var.volume_mount_directory} ext4 defaults,noatime,_netdev,nofail 0 2" | sudo tee --append /etc/fstab > /dev/null
173-
```
17484

17585
## Contributing
17686

0 commit comments

Comments
 (0)