Skip to content

Commit e2287f0

Browse files
authored
Merge branch 'main' into rvwn_tf_rep
2 parents 02f7ebd + 3cec50d commit e2287f0

34 files changed

+2117
-411
lines changed

.github/CODEOWNERS

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# Set a "catch-all" owner. Should be set to the current active admin for the repo.
3+
* @kcantrel
4+
#
5+
# Set the owner for all the individual samples, if the owner is known and they want to continue to maintain the sample:
6+
/AI/GenAI-ChatBot-application-sample/ @cbenbass
7+
/CloudFormation/deploy-fsx-ontap/ @kcantrel
8+
/Ansible/fsx_inventory_report/ @kcantrel
9+
/Ansible/snapmirror_report/ @kcantrel
10+
/EKS/FSxN-as-PVC-for-EKS/ @mickeysh
11+
/Management-Utilities/auto_create_sm_relationships/ @kcantrel
12+
/Management-Utilities/auto_set_fsxn_auto_grow/ @kcantrel
13+
/Management-Utilities/fsx-ontap-aws-cli-scripts/ @kcantrel
14+
/Management-Utilities/fsxn-rotate-secret/ @kcantrel
15+
/Management-Utilities/warm_performance_tier/ @kcantrel
16+
/Monitoring/CloudWatch-FSx/ @LirazRom10
17+
/Monitoring/LUN-monitoring/ @LirazRom10
18+
/Monitoring/auto-add-cw-alarms/ @kcantrel
19+
/Monitoring/monitor-ontap-services/ @kcantrel
20+
/Terraform/deploy-fsx-ontap-sqlserver/ @varunrai
21+
/Terraform/deploy-fsx-ontap-fileshare-access/ @varunrai
22+
/Terraform/deploy-fsx-ontap/ @kcantrel

.github/linters/.yaml-lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
extends: default
33
rules:
44
line-length: disable
5+
comments-indentation: disable
56
trailing-spaces: disable
67
truthy: disable
78
braces:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
6+
# packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
10+
name: 'Dependency review'
11+
on:
12+
pull_request:
13+
branches: [ "main" ]
14+
15+
# If using a dependency submission action in this workflow this permission will need to be set to:
16+
#
17+
# permissions:
18+
# contents: write
19+
#
20+
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api
21+
permissions:
22+
contents: read
23+
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
24+
pull-requests: write
25+
26+
jobs:
27+
dependency-review:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: 'Checkout repository'
31+
uses: actions/checkout@v4
32+
- name: 'Dependency Review'
33+
uses: actions/dependency-review-action@v4
34+
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
35+
with:
36+
comment-summary-in-pr: always
37+
# fail-on-severity: moderate
38+
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later
39+
# retry-on-snapshot-warnings: true
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
# Copyright (c) NetApp, Inc.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: "Update Cloudformation Template"
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- 'Monitoring/auto-add-cw-alarms/auto_add_cw_alarms.py'
11+
push:
12+
paths:
13+
- 'Monitoring/auto-add-cw-alarms/auto_add_cw_alarms.py'
14+
branches:
15+
- main
16+
17+
jobs:
18+
update-Cloudformation-Template:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
# Give the default GITHUB_TOKEN write permission to commit and push the
22+
# added or changed files to the repository.
23+
contents: write
24+
25+
steps:
26+
- name: Checkout pull request
27+
uses: actions/checkout@v4
28+
with:
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
31+
- name: Update the Cloudformation Template
32+
shell: bash
33+
working-directory: Monitoring/auto-add-cw-alarms
34+
run: ./update-auto-add-cw-alarms-CF-Template
35+
36+
- name: Commit the changes
37+
uses: stefanzweifel/git-auto-commit-action@v5
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gen-ai-standalone-app",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"private": true,
55
"scripts": {
66
"dev": "cross-env HOST=localhost PORT=9091 next dev",
@@ -9,27 +9,27 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@clerk/nextjs": "^5.2.2",
13-
"@reduxjs/toolkit": "^2.2.5",
14-
"@types/react-redux": "^7.1.33",
12+
"@clerk/nextjs": "^5.7.2",
13+
"@reduxjs/toolkit": "^2.2.8",
14+
"@types/react-redux": "^7.1.34",
1515
"aws-amplify": "5.3.11",
1616
"cross-env": "^7.0.3",
17-
"html-react-parser": "^5.1.10",
17+
"html-react-parser": "^5.1.18",
1818
"moment": "^2.30.1",
19-
"next": "14.2.4",
19+
"next": "14.2.15",
2020
"react": "^18",
2121
"react-dom": "^18",
2222
"react-popper-tooltip": "^4.4.2",
2323
"react-redux": "^9.1.2",
24-
"sass": "^1.77.6"
24+
"sass": "^1.79.5"
2525
},
2626
"devDependencies": {
2727
"@svgr/webpack": "^8.1.0",
28-
"@types/node": "^20",
28+
"@types/node": "^22",
2929
"@types/react": "^18",
3030
"@types/react-dom": "^18",
3131
"eslint": "^8",
32-
"eslint-config-next": "14.2.4",
32+
"eslint-config-next": "14.2.15",
3333
"typescript": "^5"
3434
}
3535
}

Ansible/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Ansible Samples
2+
Ansible is a general purpose automation engine. It can be used to automate most repetitive IT tasks.
3+
The typical input you provide Ansible is a "Playbook." This folder holds various playbooks that can be used
4+
to help automate tasks around the management of a FSx for ONTAP file system.
5+
Click here for more information on [Ansible](https://www.ansible.com/).
6+
7+
| Tool | Description |
8+
| --- | --- |
9+
| [Inventory Report](./fsx_inventory_report) | Creates a report of all the FSxN file systems within an AWS account.|
10+
| [SnapMirror Report](./snapmirror_report) | Creates a report of all SnapMirror relationships within all the FSxN file systems within an AWS account.|
11+
12+
## Author Information
13+
14+
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).
15+
16+
## License
17+
18+
Licensed under the Apache License, Version 2.0 (the "License").
19+
20+
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
21+
22+
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.
23+
24+
See the License for the specific language governing permissions and limitations under the License.
25+
26+
© 2024 NetApp, Inc. All Rights Reserved.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Ansible Inventory Report
2+
This Ansible playbook generates a report of all the FSx for ONTAP file systems within an AWS account.
3+
In includes all the SVMs and Volumes. The format of the report is as follows:
4+
```
5+
Region: <region_name>
6+
File System ID: <file-system-id-1>
7+
SVM ID: <svm-id-1-1>
8+
Volumes:
9+
<volume-id-1-1-1> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
10+
<volume-id-1-1-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
11+
SVM ID: <svm-id-1-2>
12+
Volumes:
13+
<volume-id-1-2-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
14+
<volume-id-1-2-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
15+
File System ID: <file-system-id-2>
16+
SVM ID: <svm-id-2-1>
17+
Volumes:
18+
<volume-id-2-1-1> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
19+
<volume-id-2-1-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
20+
SVM ID: <svm-id-2-2>
21+
Volumes:
22+
<volume-id-2-2-1> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
23+
<volume-id-2-2-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name>
24+
```
25+
Where:
26+
- \<volume-size-in-megabytes> is the provisioned size of the volume in megabytes.
27+
- \<security-style> is the security style of the volume (e.g. UNIX, NTFS).
28+
- \<volume-type> is the type of the volume (e.g. RW, DP).
29+
30+
## Requirements
31+
- jq - A lightweight and flexible command-line JSON processor. Installation instructions can be found [here](https://jqlang.github.io/jq/download/)
32+
- Ansible 2.9 or later. Installation instructions can be found [here](https://docs.ansible.com/ansible/latest/installation_guide/index.html)
33+
- AWS Ansible collection. This should be included with the base installation of Ansible.
34+
35+
## Installation
36+
There are three files used to create the report:
37+
- `generate_report.yaml`: The Ansible playbook that generates the report.
38+
- `processs_region.yaml`: A collection of tasks that will process all the FSxNs in a region.
39+
- `get_all_fsxn_regions.yaml`: A collection of tasks that retrieves all the AWS regions, that are enabled for the account, where FSx for ONTAP is available.
40+
41+
## Configuration
42+
There are a variable that can be changed at the top of the `generate_report.yaml` file:
43+
- report\_name - Sets the file path of the report that will be generated.
44+
45+
Since this script leverages the AWS Ansible collection as well as the `aws` cli, you will need to provide authentication credentials for them.
46+
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).
47+
48+
## Usage
49+
To generate the report copy the three files mentioned above and run the following command:
50+
```bash
51+
ansible-playbook generate_report.yaml
52+
```
53+
54+
## Author Information
55+
56+
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors).
57+
58+
## License
59+
60+
Licensed under the Apache License, Version 2.0 (the "License").
61+
62+
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
63+
64+
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.
65+
66+
See the License for the specific language governing permissions and limitations under the License.
67+
68+
© 2024 NetApp, Inc. All Rights Reserved.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# This Ansible playbook generates an inventory report for all the FSXNs
3+
# in all the AWS regions for the account that it is running under.
4+
#################################################################################
5+
---
6+
- vars:
7+
report_name: output.txt
8+
#################################################################################
9+
#
10+
# Don't change anything below this line.
11+
#
12+
#################################################################################
13+
fsxn_regions: []
14+
opted_in_regions: []
15+
16+
name: Playbook to generate an inventory report on all the FSxNs.
17+
hosts: localhost
18+
collections:
19+
- amazon.aws
20+
gather_facts: false
21+
22+
tasks:
23+
- name: Make sure the report file is empty.
24+
ansible.builtin.shell:
25+
cmd: echo "" > {{ report_name }}
26+
27+
- name: Get all the regions that support FSxN that are opted into.
28+
include_tasks: get_fsxn_regions.yaml
29+
30+
- name: Generate the report for all the FSxNs.
31+
include_tasks: process_region.yaml
32+
loop: "{{ fsxn_regions }}"
33+
loop_control:
34+
loop_var: region
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# These tasks are used to set a variable named 'fsnx_regions' that contains a
3+
# list of regions that support FSxN and are opted-in.
4+
################################################################################
5+
- name: Get all the opted-in regions
6+
amazon.aws.aws_region_info:
7+
register: region_info
8+
9+
- name: Get region names
10+
set_fact:
11+
enabled_regions: "{{ region_info.regions | map(attribute='region_name') | list }}"
12+
13+
- name: Get the capabilities of all regions
14+
set_fact:
15+
regions_capabilities: "{{ lookup('ansible.builtin.url', 'https://api.regional-table.region-services.aws.a2z.com/index.json', split_lines=false) }}"
16+
17+
- name: Filter regions that support FSxN and are opted-in
18+
set_fact:
19+
fsxn_regions: >-
20+
{{
21+
regions_capabilities.prices
22+
| selectattr("attributes.aws:serviceName", "equalto", "Amazon FSx for NetApp ONTAP")
23+
| selectattr("attributes.aws:region", "in", enabled_regions)
24+
| map(attribute="attributes.aws:region")
25+
| list
26+
}}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Since Ansible can't handle nested loops, this is a block of tasked that is
3+
# run for each region. It assume that the calling playbook used 'region' as
4+
# its loop variable.
5+
################################################################################
6+
---
7+
- name: Get all the FSxNs for the specified region.
8+
ansible.builtin.shell:
9+
cmd: aws fsx describe-file-systems --region {{ region }} --query 'FileSystems[*].{FileSystemId:FileSystemId}' --output text | sed -e '/^$/d'
10+
register: fsxn_ids_per_region
11+
12+
- name: Get all the SVMs and volumes for each FSxN.
13+
ansible.builtin.shell:
14+
cmd: |
15+
echo "Region: {{ region }}" >> {{ report_name }};
16+
fs={{ item }};
17+
echo " File System ID: ${fs}" >> {{ report_name }};
18+
svms=$(aws fsx describe-storage-virtual-machines --filters Name=file-system-id,Values=${fs} --region {{ region }} --output=text --query 'StorageVirtualMachines[*].StorageVirtualMachineId');
19+
for svm in $svms; do
20+
echo " SVM ID: ${svm}" >> {{ report_name }};
21+
echo " Volume IDs:" >> {{ report_name }};
22+
aws fsx describe-volumes --filters Name=storage-virtual-machine-id,Values=${svm} --region {{ region }} --output=json --query 'Volumes[*].{Size: OntapConfiguration.SizeInMegabytes, ID: VolumeId, Name: Name, Type: OntapConfiguration.OntapVolumeType, Style: OntapConfiguration.SecurityStyle}' | jq -r '.[] | " \(.ID) \(.Type) \(.Style) \(.Size) \(.Name)"' >> {{ report_name }};
23+
done
24+
loop: "{{ fsxn_ids_per_region.stdout_lines }}"

0 commit comments

Comments
 (0)