-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into rvwn_tf_rep
- Loading branch information
Showing
34 changed files
with
2,117 additions
and
411 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Set a "catch-all" owner. Should be set to the current active admin for the repo. | ||
* @kcantrel | ||
# | ||
# Set the owner for all the individual samples, if the owner is known and they want to continue to maintain the sample: | ||
/AI/GenAI-ChatBot-application-sample/ @cbenbass | ||
/CloudFormation/deploy-fsx-ontap/ @kcantrel | ||
/Ansible/fsx_inventory_report/ @kcantrel | ||
/Ansible/snapmirror_report/ @kcantrel | ||
/EKS/FSxN-as-PVC-for-EKS/ @mickeysh | ||
/Management-Utilities/auto_create_sm_relationships/ @kcantrel | ||
/Management-Utilities/auto_set_fsxn_auto_grow/ @kcantrel | ||
/Management-Utilities/fsx-ontap-aws-cli-scripts/ @kcantrel | ||
/Management-Utilities/fsxn-rotate-secret/ @kcantrel | ||
/Management-Utilities/warm_performance_tier/ @kcantrel | ||
/Monitoring/CloudWatch-FSx/ @LirazRom10 | ||
/Monitoring/LUN-monitoring/ @LirazRom10 | ||
/Monitoring/auto-add-cw-alarms/ @kcantrel | ||
/Monitoring/monitor-ontap-services/ @kcantrel | ||
/Terraform/deploy-fsx-ontap-sqlserver/ @varunrai | ||
/Terraform/deploy-fsx-ontap-fileshare-access/ @varunrai | ||
/Terraform/deploy-fsx-ontap/ @kcantrel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Dependency Review Action | ||
# | ||
# This Action will scan dependency manifest files that change as part of a Pull Request, | ||
# surfacing known-vulnerable versions of the packages declared or updated in the PR. | ||
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable | ||
# packages will be blocked from merging. | ||
# | ||
# Source repository: https://github.com/actions/dependency-review-action | ||
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement | ||
name: 'Dependency review' | ||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
# If using a dependency submission action in this workflow this permission will need to be set to: | ||
# | ||
# permissions: | ||
# contents: write | ||
# | ||
# https://docs.github.com/en/enterprise-cloud@latest/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api | ||
permissions: | ||
contents: read | ||
# Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option | ||
pull-requests: write | ||
|
||
jobs: | ||
dependency-review: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout repository' | ||
uses: actions/checkout@v4 | ||
- name: 'Dependency Review' | ||
uses: actions/dependency-review-action@v4 | ||
# Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options. | ||
with: | ||
comment-summary-in-pr: always | ||
# fail-on-severity: moderate | ||
# deny-licenses: GPL-1.0-or-later, LGPL-2.0-or-later | ||
# retry-on-snapshot-warnings: true |
37 changes: 37 additions & 0 deletions
37
.github/workflows/update-CloudformationTemplate-auto-add-cw-alarms.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
# Copyright (c) NetApp, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: "Update Cloudformation Template" | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'Monitoring/auto-add-cw-alarms/auto_add_cw_alarms.py' | ||
push: | ||
paths: | ||
- 'Monitoring/auto-add-cw-alarms/auto_add_cw_alarms.py' | ||
branches: | ||
- main | ||
|
||
jobs: | ||
update-Cloudformation-Template: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# added or changed files to the repository. | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout pull request | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Update the Cloudformation Template | ||
shell: bash | ||
working-directory: Monitoring/auto-add-cw-alarms | ||
run: ./update-auto-add-cw-alarms-CF-Template | ||
|
||
- name: Commit the changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Ansible Samples | ||
Ansible is a general purpose automation engine. It can be used to automate most repetitive IT tasks. | ||
The typical input you provide Ansible is a "Playbook." This folder holds various playbooks that can be used | ||
to help automate tasks around the management of a FSx for ONTAP file system. | ||
Click here for more information on [Ansible](https://www.ansible.com/). | ||
|
||
| Tool | Description | | ||
| --- | --- | | ||
| [Inventory Report](./fsx_inventory_report) | Creates a report of all the FSxN file systems within an AWS account.| | ||
| [SnapMirror Report](./snapmirror_report) | Creates a report of all SnapMirror relationships within all the FSxN file systems within an AWS account.| | ||
|
||
## Author Information | ||
|
||
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors). | ||
|
||
## License | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"). | ||
|
||
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](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. | ||
|
||
© 2024 NetApp, Inc. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Ansible Inventory Report | ||
This Ansible playbook generates a report of all the FSx for ONTAP file systems within an AWS account. | ||
In includes all the SVMs and Volumes. The format of the report is as follows: | ||
``` | ||
Region: <region_name> | ||
File System ID: <file-system-id-1> | ||
SVM ID: <svm-id-1-1> | ||
Volumes: | ||
<volume-id-1-1-1> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
<volume-id-1-1-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
SVM ID: <svm-id-1-2> | ||
Volumes: | ||
<volume-id-1-2-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
<volume-id-1-2-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
File System ID: <file-system-id-2> | ||
SVM ID: <svm-id-2-1> | ||
Volumes: | ||
<volume-id-2-1-1> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
<volume-id-2-1-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
SVM ID: <svm-id-2-2> | ||
Volumes: | ||
<volume-id-2-2-1> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
<volume-id-2-2-2> <volume-type> <security-style> <volume-size-in-megabytes> <volume-name> | ||
``` | ||
Where: | ||
- \<volume-size-in-megabytes> is the provisioned size of the volume in megabytes. | ||
- \<security-style> is the security style of the volume (e.g. UNIX, NTFS). | ||
- \<volume-type> is the type of the volume (e.g. RW, DP). | ||
|
||
## Requirements | ||
- jq - A lightweight and flexible command-line JSON processor. Installation instructions can be found [here](https://jqlang.github.io/jq/download/) | ||
- Ansible 2.9 or later. Installation instructions can be found [here](https://docs.ansible.com/ansible/latest/installation_guide/index.html) | ||
- AWS Ansible collection. This should be included with the base installation of Ansible. | ||
|
||
## Installation | ||
There are three files used to create the report: | ||
- `generate_report.yaml`: The Ansible playbook that generates the report. | ||
- `processs_region.yaml`: A collection of tasks that will process all the FSxNs in a region. | ||
- `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. | ||
|
||
## Configuration | ||
There are a variable that can be changed at the top of the `generate_report.yaml` file: | ||
- report\_name - Sets the file path of the report that will be generated. | ||
|
||
Since this script leverages the AWS Ansible collection as well as the `aws` cli, you will need to provide authentication credentials for them. | ||
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). | ||
|
||
## Usage | ||
To generate the report copy the three files mentioned above and run the following command: | ||
```bash | ||
ansible-playbook generate_report.yaml | ||
``` | ||
|
||
## Author Information | ||
|
||
This repository is maintained by the contributors listed on [GitHub](https://github.com/NetApp/FSx-ONTAP-samples-scripts/graphs/contributors). | ||
|
||
## License | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"). | ||
|
||
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](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. | ||
|
||
© 2024 NetApp, Inc. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# This Ansible playbook generates an inventory report for all the FSXNs | ||
# in all the AWS regions for the account that it is running under. | ||
################################################################################# | ||
--- | ||
- vars: | ||
report_name: output.txt | ||
################################################################################# | ||
# | ||
# Don't change anything below this line. | ||
# | ||
################################################################################# | ||
fsxn_regions: [] | ||
opted_in_regions: [] | ||
|
||
name: Playbook to generate an inventory report on all the FSxNs. | ||
hosts: localhost | ||
collections: | ||
- amazon.aws | ||
gather_facts: false | ||
|
||
tasks: | ||
- name: Make sure the report file is empty. | ||
ansible.builtin.shell: | ||
cmd: echo "" > {{ report_name }} | ||
|
||
- name: Get all the regions that support FSxN that are opted into. | ||
include_tasks: get_fsxn_regions.yaml | ||
|
||
- name: Generate the report for all the FSxNs. | ||
include_tasks: process_region.yaml | ||
loop: "{{ fsxn_regions }}" | ||
loop_control: | ||
loop_var: region |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# These tasks are used to set a variable named 'fsnx_regions' that contains a | ||
# list of regions that support FSxN and are opted-in. | ||
################################################################################ | ||
- name: Get all the opted-in regions | ||
amazon.aws.aws_region_info: | ||
register: region_info | ||
|
||
- name: Get region names | ||
set_fact: | ||
enabled_regions: "{{ region_info.regions | map(attribute='region_name') | list }}" | ||
|
||
- name: Get the capabilities of all regions | ||
set_fact: | ||
regions_capabilities: "{{ lookup('ansible.builtin.url', 'https://api.regional-table.region-services.aws.a2z.com/index.json', split_lines=false) }}" | ||
|
||
- name: Filter regions that support FSxN and are opted-in | ||
set_fact: | ||
fsxn_regions: >- | ||
{{ | ||
regions_capabilities.prices | ||
| selectattr("attributes.aws:serviceName", "equalto", "Amazon FSx for NetApp ONTAP") | ||
| selectattr("attributes.aws:region", "in", enabled_regions) | ||
| map(attribute="attributes.aws:region") | ||
| list | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Since Ansible can't handle nested loops, this is a block of tasked that is | ||
# run for each region. It assume that the calling playbook used 'region' as | ||
# its loop variable. | ||
################################################################################ | ||
--- | ||
- name: Get all the FSxNs for the specified region. | ||
ansible.builtin.shell: | ||
cmd: aws fsx describe-file-systems --region {{ region }} --query 'FileSystems[*].{FileSystemId:FileSystemId}' --output text | sed -e '/^$/d' | ||
register: fsxn_ids_per_region | ||
|
||
- name: Get all the SVMs and volumes for each FSxN. | ||
ansible.builtin.shell: | ||
cmd: | | ||
echo "Region: {{ region }}" >> {{ report_name }}; | ||
fs={{ item }}; | ||
echo " File System ID: ${fs}" >> {{ report_name }}; | ||
svms=$(aws fsx describe-storage-virtual-machines --filters Name=file-system-id,Values=${fs} --region {{ region }} --output=text --query 'StorageVirtualMachines[*].StorageVirtualMachineId'); | ||
for svm in $svms; do | ||
echo " SVM ID: ${svm}" >> {{ report_name }}; | ||
echo " Volume IDs:" >> {{ report_name }}; | ||
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 }}; | ||
done | ||
loop: "{{ fsxn_ids_per_region.stdout_lines }}" |
Oops, something went wrong.