Skip to content

Commit f2f7621

Browse files
committed
Initial Version
1 parent c141cd1 commit f2f7621

File tree

2 files changed

+75
-13
lines changed

2 files changed

+75
-13
lines changed

Infrastructure_as_Code/Ansible/Volume_Management/README.md

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Ansible Volume Management samples
2-
This folder contains to Ansible playbooks that can be used to manage volumes within a FSx for ONTAP file system.
2+
This folder contains Ansible playbooks that can be used to manage volumes within a FSx for ONTAP file system.
33

44
They have been configured to use the new `use_lambda` feature that allows it to leverage an Workload Factory Link
5-
to issue the API calls to the FSx for ONTAP file system which alleviate the requirement of the Ansible control
5+
to issue the API calls to the FSx for ONTAP file system which alleviates the requirement of the Ansible control
66
node to have network connectivity to the FSx for ONTAP file system. For more information on how to set up a
77
Workload Factory Link, please refer to the [NetApp Workload Factory documentation](https://docs.netapp.com/us-en/workload-fsx-ontap/links-overview.html).
88

@@ -22,23 +22,25 @@ The list of playbooks included in this folder is as follows:
2222
Each playbook requires various variables to be set in order to run.
2323
| Variable | Used By Playbook | Required | Default | Description |
2424
|:-------- |:----------------:|:--------:|:-------:|:-----------|
25-
| volume\_name| All | Yes | None | The name of the volume you want to act one.|
26-
| volume\_size| create\_volume | Yes | None | The size, in MiBs, of the volume to create.|
25+
| fsxn\_hostname| All | Yes | None | The hostname, or IP address, of the FSxN where the volume resides.|
2726
| vserver | All | Yes | None | The name of the vserver where the volume resides.|
28-
| fsxn\_hostname| All | Yes | None | The hostname or IP address of the FSxN where the volume resides.|
29-
| lambda\_function\_name| All | No | None | The name of the Workload Factory Link to use when issuing API calls to the FSx for ONTAP file system.|
30-
| aws\_region | All | No | None | The AWS region where the Link lambda function resides.|
31-
| secret\_name | Yes | All | None | The name of the AWS secret that contains the credentials to authenticate with the FSx for ONTAP file system.|
32-
| snapshot\_name | create\_snapshot | Yes | None | The name of the snapshot to create.|
27+
| secret\_name | All | Yes | None | The name of the AWS secret that contains the credentials to authenticate with the FSx for ONTAP file system.|
28+
| volume\_name| All | Yes | None | The name of the volume you want to act on.|
29+
| lambda\_function\_name| All | No | None | The name of the Workload Factory Link Lambda function to use when issuing API calls to the FSx for ONTAP file system.|
30+
| aws\_region | All | No | None | The AWS region where the Lambda function resides.|
31+
| volume\_size| create\_volume | Yes | None | The size, in MiBs, of the volume to create.|
3332
| security\_style | create\_volume | No | UNIX | The security style to use when creating the volume. Valid options are UNIX or NTFS.|
3433
| aggr | create\_volume | No | aggr1 | The name of the aggregate to create the volume on.|
3534
| volume\_type | create\_volume | No | RW | The type of volume to create. Valid options are RW and DP.|
3635
| junction\_path | create\_volume | No | `/<volume_name>` | The junction path to use when creating the volume.|
36+
| snapshot\_name | create\_snapshot | Yes | None | The name of the snapshot to create.|
3737

38-
A convenient way to set all the required variable is to put them into a file named `varabless.yaml`.
38+
A convenient way to set all the required variable is to put them into a file named `variables.yaml`.
3939
All the playbooks will attempt to load this file and use any variables defined in it. Otherwise,
40-
you can set them by using the `--extra-vars` flag when running the playbook.
40+
you can set them by using the `--extra-vars` flag when running the playbook. An example `variables.yaml`
41+
file is included in this folder.
4142

43+
## Authentication
4244
So that you don't have to hardcode secrets into the playbook, or variable files, all the playbooks
4345
will leverage an AWS Secrets Manager secret to retrieve the credentials for FSx for ONTAP file system.
4446

@@ -51,6 +53,66 @@ Each secret should have two `keys`:
5153
Since this script leverages the AWS Ansible collection you will need to provide authentication credentials for it.
5254
You can read more about how to do that [here](https://docs.ansible.com/ansible/latest/collections/amazon/aws/docsite/aws_ec2_guide.html#authentication).
5355

56+
## Example Run:
57+
Here is an example of running the `create_volume.yaml` playbook to create a new
58+
volume named `vol1` with a size of 1024 MiBs on the `fsx` vserver:
59+
```bash
60+
$ ansible-playbook create_volume.yaml --extra-vars "volume_name=vol1 volume_size=1024 vserver=fsx"
61+
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
62+
63+
PLAY [Playbook to create a volumes on an FSx for ONTAP file system.] *******************************************************
64+
65+
TASK [Ensure required variables are set.] **********************************************************************************
66+
skipping: [localhost] => (item=volume_name)
67+
skipping: [localhost] => (item=volume_size)
68+
skipping: [localhost] => (item=vserver)
69+
skipping: [localhost] => (item=secret_name)
70+
skipping: [localhost]
71+
72+
TASK [Set security_style to unix if not provide.] **************************************************************************
73+
ok: [localhost]
74+
75+
TASK [Set aggr to 'aggr1' if not provided.] ********************************************************************************
76+
ok: [localhost]
77+
78+
TASK [Set volume_type to "rw" if not provided.] ****************************************************************************
79+
ok: [localhost]
80+
81+
TASK [Set use_lambda to true if lambda_function_name is provided.] *********************************************************
82+
ok: [localhost]
83+
84+
TASK [Set aws_provide to "default" if not provided.] ***********************************************************************
85+
ok: [localhost]
86+
87+
TASK [Set junction path to "/<volume_name>" if not provided.] **************************************************************
88+
ok: [localhost]
89+
90+
TASK [Ensure that aws_region has been provided if use_lambda is true.] *****************************************************
91+
skipping: [localhost]
92+
93+
TASK [Set aws_region to "" if not set at this point.] **********************************************************************
94+
skipping: [localhost]
95+
96+
TASK [Set lambda_function_name to "" if not set at this point.] ************************************************************
97+
skipping: [localhost]
98+
99+
TASK [Get username and password from AWS secret.] **************************************************************************
100+
ok: [localhost]
101+
102+
TASK [Create the volume] ***************************************************************************************************
103+
changed: [localhost]
104+
105+
PLAY RECAP *****************************************************************************************************************
106+
localhost : ok=8 changed=1 unreachable=0 failed=0 skipped=4 rescued=0 ignored=0
107+
```
108+
109+
The above example had a `variables.yaml` file with the following contents:
110+
```yaml
111+
fsxn_hostname: "10.0.0.13"
112+
lambda_function_name: "lambda-8nlmlCR"
113+
aws_region: "us-west-2"
114+
secret_name: "fsxn/default"
115+
```
54116
## Author Information
55117
56118
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).

Infrastructure_as_Code/Ansible/snapmirror_report/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ the number before it represents the number of seconds. For example, 'P1DT2H3M4S'
2323
- A file with a list of the FSx for ONTAP file systems and their corresponding secrets. The format of the file is described below.
2424

2525
## Installation
26-
There are three files used to create the report:
27-
- `generate_report.yaml`: The main Ansible playbook that generates the report.
26+
There are three components to this playbook:
27+
- `generate_report.yaml`: The main Ansible playbook that calls the other files.
2828
- `get_all_fsxn_regions.yaml`: A collection of tasks that retrieves all the regions, that are enabled for the account, where FSx for ONTAP is also available.
2929
- `processs_region.yaml`: A collection of tasks that will process all the FSxNs within a region.
3030

0 commit comments

Comments
 (0)