This module creates a Network File Sharing (NFS) file system based on a VM
instance and compute disk. This file system can share directories and
files with other clients over a network. nfs-server
can be used by
vm-instance and SchedMD
community modules that create compute VMs.
For more information on this and other network storage options in the Cluster Toolkit, see the extended Network Storage documentation.
WARNING: This module has only been tested against the HPC centos7 OS disk image (the default). Using other images may work, but have not been verified.
- id: homefs
source: community/modules/file-system/nfs-server
use: [network1]
settings:
auto_delete_disk: true
This creates a NFS on a virtual machine which allow other VMs to mount the volume as an external file system.
NOTE:
auto_delete_disk
is set to true in this example, which means that runningterraform destroy
also deletes the disk. To retain the disk afterterraform destroy
either set this to false or don't include the settings so it defaults to false. Note that withauto_delete_disk: false
, you will need to manually delete the disk after destroying a deployment group withnfs-server
.
To mount the NFS Server you must first ensure that the NFS client has been
installed the and then call the proper mount
command.
Both of these steps are automatically handled with the use of the use
command
in a selection of Cluster Toolkit modules. See the compatibility matrix in
the network storage doc for a complete list of supported modules.
See the hpc-centos-ss.yaml test config for an example of using this module
with a vm-instance
module.
If mounting is not automatically handled as described above, the nfs-server
module outputs runners that can be used with the startup-script module to
install the client and mount the file system. See the following example:
- id: nfs
source: community/modules/file-system/nfs-server
use: [network1]
settings: {local_mounts: [/mnt1]}
- id: mount-at-startup
source: modules/scripts/startup-script
settings:
runners:
- $(nfs.install_nfs_client_runner)
- $(nfs.mount_runner)
Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Name | Version |
---|---|
terraform | >= 0.14.0 |
>= 3.83 | |
null | >= 3.0 |
random | ~> 3.0 |
Name | Version |
---|---|
>= 3.83 | |
null | >= 3.0 |
random | ~> 3.0 |
No modules.
Name | Type |
---|---|
google_compute_disk.attached_disk | resource |
google_compute_disk.boot_disk | resource |
google_compute_instance.compute_instance | resource |
null_resource.image | resource |
random_id.resource_name_suffix | resource |
google_compute_default_service_account.default | data source |
google_compute_image.compute_image | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
auto_delete_disk | Whether or not the nfs disk should be auto-deleted | bool |
false |
no |
deployment_name | Name of the HPC deployment, used as name of the NFS instance if no name is specified. | string |
n/a | yes |
disk_size | Storage size gb | number |
"100" |
no |
image | DEPRECATED: The VM image used by the nfs server | string |
null |
no |
instance_image | The VM image used by the nfs server. Expected Fields: name: The name of the image. Mutually exclusive with family. family: The image family to use. Mutually exclusive with name. project: The project where the image is hosted. |
map(string) |
{ |
no |
labels | Labels to add to the NFS instance. Key-value pairs. | map(string) |
n/a | yes |
local_mounts | Mountpoint for this NFS compute instance | list(string) |
[ |
no |
machine_type | Type of the VM instance to use | string |
"n2d-standard-2" |
no |
metadata | Metadata, provided as a map | map(string) |
{} |
no |
name | The resource name of the instance. | string |
null |
no |
network_self_link | The self link of the network to attach the nfs VM. | string |
"default" |
no |
project_id | Project in which the HPC deployment will be created | string |
n/a | yes |
scopes | Scopes to apply to the controller | list(string) |
[ |
no |
service_account | Service Account for the NFS Server | string |
null |
no |
subnetwork_self_link | The self link of the subnetwork to attach the nfs VM. | string |
null |
no |
type | The service tier of the instance. | string |
"pd-ssd" |
no |
zone | The zone name where the nfs instance located in. | string |
n/a | yes |
Name | Description |
---|---|
install_nfs_client | Script for installing NFS client |
install_nfs_client_runner | Runner to install NFS client using the startup-script module |
mount_runner | Runner to mount the file-system using an ansible playbook. The startup-script module will automatically handle installation of ansible. - id: example-startup-script source: modules/scripts/startup-script settings: runners: - $(your-fs-id.mount_runner) ... |
network_storage | export of all desired folder directories |