summaryrefslogtreecommitdiffstats
path: root/ansible_collections/netapp/azure
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:04:41 +0000
commit975f66f2eebe9dadba04f275774d4ab83f74cf25 (patch)
tree89bd26a93aaae6a25749145b7e4bca4a1e75b2be /ansible_collections/netapp/azure
parentInitial commit. (diff)
downloadansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.tar.xz
ansible-975f66f2eebe9dadba04f275774d4ab83f74cf25.zip
Adding upstream version 7.7.0+dfsg.upstream/7.7.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/netapp/azure')
-rw-r--r--ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/bug_report.yml210
-rw-r--r--ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/feature_request.yml100
-rw-r--r--ansible_collections/netapp/azure/.github/workflows/coverage.yml45
-rw-r--r--ansible_collections/netapp/azure/.github/workflows/main.yml64
-rw-r--r--ansible_collections/netapp/azure/CHANGELOG.rst171
-rw-r--r--ansible_collections/netapp/azure/COPYING674
-rw-r--r--ansible_collections/netapp/azure/FILES.json705
-rw-r--r--ansible_collections/netapp/azure/HACK.md13
-rw-r--r--ansible_collections/netapp/azure/MANIFEST.json37
-rw-r--r--ansible_collections/netapp/azure/README.md157
-rw-r--r--ansible_collections/netapp/azure/changelogs/.plugin-cache.yaml35
-rw-r--r--ansible_collections/netapp/azure/changelogs/changelog.yaml169
-rw-r--r--ansible_collections/netapp/azure/changelogs/config.yaml32
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/20.2.0.yaml2
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/20.4.0.yaml3
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/20.5.0.yaml6
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/20.6.0.yaml3
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/20.7.0.yaml2
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/20.8.0.yaml3
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3505.yaml4
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3526.yaml3
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3663.yaml2
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3704.yaml5
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3849.yaml3
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3935.yaml2
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3949.yaml6
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4001.yaml2
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4070.yaml3
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4135.yaml2
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4246.yaml4
-rw-r--r--ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4416.yaml2
-rw-r--r--ansible_collections/netapp/azure/meta/runtime.yml8
-rw-r--r--ansible_collections/netapp/azure/plugins/doc_fragments/azure.py129
-rw-r--r--ansible_collections/netapp/azure/plugins/doc_fragments/azure_tags.py31
-rw-r--r--ansible_collections/netapp/azure/plugins/doc_fragments/netapp.py43
-rw-r--r--ansible_collections/netapp/azure/plugins/module_utils/azure_rm_netapp_common.py156
-rw-r--r--ansible_collections/netapp/azure/plugins/module_utils/netapp_module.py271
-rw-r--r--ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_account.py404
-rw-r--r--ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_capacity_pool.py259
-rw-r--r--ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_snapshot.py226
-rw-r--r--ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_volume.py399
-rw-r--r--ansible_collections/netapp/azure/requirements.txt3
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/aliases3
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/meta/main.yml2
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/tasks/main.yml41
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/aliases3
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/meta/main.yml2
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/tasks/main.yml47
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/aliases3
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/meta/main.yml2
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/tasks/main.yml51
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/aliases3
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/meta/main.yml2
-rw-r--r--ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/tasks/main.yml57
-rw-r--r--ansible_collections/netapp/azure/tests/runner/requirements/integration.cloud.azure.txt1
-rw-r--r--ansible_collections/netapp/azure/tests/runner/requirements/requirements-azure.txt9
-rw-r--r--ansible_collections/netapp/azure/tests/runner/requirements/unit.cloud.azure.txt1
-rw-r--r--ansible_collections/netapp/azure/tests/runner/requirements/units.txt1
-rw-r--r--ansible_collections/netapp/azure/tests/unit/compat/__init__.py0
-rw-r--r--ansible_collections/netapp/azure/tests/unit/compat/builtins.py33
-rw-r--r--ansible_collections/netapp/azure/tests/unit/compat/mock.py122
-rw-r--r--ansible_collections/netapp/azure/tests/unit/compat/unittest.py44
-rw-r--r--ansible_collections/netapp/azure/tests/unit/plugins/module_utils/test_netapp_module.py149
-rw-r--r--ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_account.py173
-rw-r--r--ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_capacity_pool.py197
-rw-r--r--ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_snapshot.py165
-rw-r--r--ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume.py501
-rw-r--r--ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume_import.py74
-rw-r--r--ansible_collections/netapp/azure/tests/unit/requirements.txt3
69 files changed, 6087 insertions, 0 deletions
diff --git a/ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/bug_report.yml b/ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 000000000..ed35f3ddd
--- /dev/null
+++ b/ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,210 @@
+---
+name: 🐛 Bug report
+description: Create a report to help us improve
+
+body:
+- type: markdown
+ attributes:
+ value: >
+ **Thank you for wanting to report a bug in netapp.azure!**
+
+
+ ⚠
+ Verify first that your issue is not [already reported on
+ GitHub][issue search] and keep in mind that we may have to keep
+ the current behavior because [every change breaks someone's
+ workflow][XKCD 1172].
+ We try to be mindful about this.
+
+ Also test if the latest release and devel branch are affected too.
+
+
+ **Tip:** If you are seeking community support, please consider
+ [Join our Slack community][ML||IRC].
+
+
+
+ [ML||IRC]:
+ https://join.slack.com/t/netapppub/shared_invite/zt-njcjx2sh-1VR2mEDvPcJAmPutOnP~mg
+
+ [issue search]: ../search?q=is%3Aissue&type=issues
+
+ [XKCD 1172]: https://xkcd.com/1172/
+
+
+- type: textarea
+ attributes:
+ label: Summary
+ description: Explain the problem briefly below.
+ placeholder: >-
+ When I try to do X with netapp.azure from the devel branch on GitHub, Y
+ breaks in a way Z under the env E. Here are all the details I know
+ about this problem...
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: Component Name
+ description: >
+ Write the short name of the rst file, module, plugin, task or
+ feature below, *use your best guess if unsure*.
+
+
+ **Tip:** Cannot find it in this repository? Please be advised that
+ the source for some parts of the documentation are hosted outside
+ of this repository. If the page you are reporting describes
+ modules/plugins/etc that are not officially supported by the
+ Ansible Core Engineering team, there is a good chance that it is
+ coming from one of the [Ansible Collections maintained by the
+ community][collections org]. If this is the case, please make sure
+ to file an issue under the appropriate project there instead.
+
+
+ [collections org]: /ansible-collections
+ placeholder: dnf, apt, yum, pip, user etc.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Ansible Version
+ description: >-
+ Paste verbatim output from `ansible --version` below, under
+ the prompt line. Please don't wrap it with tripple backticks — your
+ whole input will be turned into a code snippet automatically.
+ render: console
+ value: |
+ $ ansible --version
+ placeholder: |
+ $ ansible --version
+ ansible [core 2.11.0b4.post0] (detached HEAD ref: refs/) last updated 2021/04/02 00:33:35 (GMT +200)
+ config file = None
+ configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
+ ansible python module location = ~/src/github/ansible/ansible/lib/ansible
+ ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
+ executable location = bin/ansible
+ python version = 3.9.0 (default, Oct 26 2020, 13:08:59) [GCC 10.2.0]
+ jinja version = 2.11.3
+ libyaml = True
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Azure NetApp Files Collection Version
+ description: >-
+ Azure NetApp Files Collection Version. Run `ansible-galaxy collection` and copy the entire output
+ render: console
+ value: |
+ $ ansible-galaxy collection list
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Playbook
+ description: >-
+ The task from the playbook that is give you the issue
+ render: console
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Steps to Reproduce
+ description: |
+ Describe exactly how to reproduce the problem, using a minimal test-case. It would *really* help us understand your problem if you could also pased any playbooks, configs and commands you used.
+
+ **HINT:** You can paste https://gist.github.com links for larger files.
+ value: |
+ <!--- Paste example playbooks or commands between quotes below -->
+ ```yaml (paste below)
+
+ ```
+ placeholder: |
+ 1. Implement the following playbook:
+
+ ```yaml
+ ---
+ # ping.yml
+ - hosts: all
+ gather_facts: false
+ tasks:
+ - ping:
+ ...
+ ```
+ 2. Then run `ANSIBLE_DEBUG=1 ansible-playbook ping.yml -vvvvv`
+ 3. An error occurs.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Expected Results
+ description: >-
+ Describe what you expected to happen when running the steps above.
+ placeholder: >-
+ I expected X to happen because I assumed Y and was shocked
+ that it did not.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Actual Results
+ description: |
+ Describe what actually happened. If possible run with extra verbosity (`-vvvv`).
+
+ Paste verbatim command output and don't wrap it with tripple backticks — your
+ whole input will be turned into a code snippet automatically.
+ render: console
+ placeholder: >-
+ Certificate did not match expected hostname: files.pythonhosted.org. Certificate: {'notAfter': 'Apr 28 19:20:25 2021 GMT', 'subjectAltName': ((u'DNS', 'r.ssl.fastly.net'), (u'DNS', '*.catchpoint.com'), (u'DNS', '*.cnn.io'), (u'DNS', '*.dollarshaveclub.com'), (u'DNS', '*.eater.com'), (u'DNS', '*.fastly.picmonkey.com'), (u'DNS', '*.files.saymedia-content.com'), (u'DNS', '*.ft.com'), (u'DNS', '*.meetupstatic.com'), (u'DNS', '*.nfl.com'), (u'DNS', '*.pagar.me'), (u'DNS', '*.picmonkey.com'), (u'DNS', '*.realself.com'), (u'DNS', '*.sbnation.com'), (u'DNS', '*.shakr.com'), (u'DNS', '*.streamable.com'), (u'DNS', '*.surfly.com'), (u'DNS', '*.theverge.com'), (u'DNS', '*.thrillist.com'), (u'DNS', '*.vox-cdn.com'), (u'DNS', '*.vox.com'), (u'DNS', '*.voxmedia.com'), (u'DNS', 'eater.com'), (u'DNS', 'ft.com'), (u'DNS', 'i.gse.io'), (u'DNS', 'picmonkey.com'), (u'DNS', 'realself.com'), (u'DNS', 'static.wixstatic.com'), (u'DNS', 'streamable.com'), (u'DNS', 'surfly.com'), (u'DNS', 'theverge.com'), (u'DNS', 'vox-cdn.com'), (u'DNS', 'vox.com'), (u'DNS', 'www.joyent.com')), 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'California'),), (('localityName', u'San Francisco'),), (('organizationName', u'Fastly, Inc'),), (('commonName', u'r.ssl.fastly.net'),))}
+ Exception:
+ Traceback (most recent call last):
+ File "/usr/local/lib/python2.6/dist-packages/pip/basecommand.py", line 215, in main
+ status = self.run(options, args)
+ File "/usr/local/lib/python2.6/dist-packages/pip/commands/install.py", line 335, in run
+ wb.build(autobuilding=True)
+ File "/usr/local/lib/python2.6/dist-packages/pip/wheel.py", line 749, in build
+ self.requirement_set.prepare_files(self.finder)
+ File "/usr/local/lib/python2.6/dist-packages/pip/req/req_set.py", line 380, in prepare_files
+ ignore_dependencies=self.ignore_dependencies))
+ File "/usr/local/lib/python2.6/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
+ session=self.session, hashes=hashes)
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 821, in unpack_url
+ hashes=hashes
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 659, in unpack_http_url
+ hashes)
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 853, in _download_http_url
+ stream=True,
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/sessions.py", line 521, in get
+ return self.request('GET', url, **kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 386, in request
+ return super(PipSession, self).request(method, url, *args, **kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/sessions.py", line 508, in request
+ resp = self.send(prep, **send_kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/sessions.py", line 618, in send
+ r = adapter.send(request, **kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
+ resp = super(CacheControlAdapter, self).send(request, **kw)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/adapters.py", line 506, in send
+ raise SSLError(e, request=request)
+ SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/ef/ab/aa12712415809bf698e719b307419f953e25344e8f42d557533d7a02b276/netapp_lib-2020.7.16-py2-none-any.whl (Caused by SSLError(CertificateError("hostname 'files.pythonhosted.org' doesn't match either of 'r.ssl.fastly.net', '*.catchpoint.com', '*.cnn.io', '*.dollarshaveclub.com', '*.eater.com', '*.fastly.picmonkey.com', '*.files.saymedia-content.com', '*.ft.com', '*.meetupstatic.com', '*.nfl.com', '*.pagar.me', '*.picmonkey.com', '*.realself.com', '*.sbnation.com', '*.shakr.com', '*.streamable.com', '*.surfly.com', '*.theverge.com', '*.thrillist.com', '*.vox-cdn.com', '*.vox.com', '*.voxmedia.com', 'eater.com', 'ft.com', 'i.gse.io', 'picmonkey.com', 'realself.com', 'static.wixstatic.com', 'streamable.com', 'surfly.com', 'theverge.com', 'vox-cdn.com', 'vox.com', 'www.joyent.com'",),))
+ ERROR: Command "/usr/bin/python2.6 /root/ansible/test/lib/ansible_test/_data/quiet_pip.py install --disable-pip-version-check -r /root/ansible/test/lib/ansible_test/_data/requirements/units.txt -r tests/unit/requirements.txt -c /root/ansible/test/lib/ansible_test/_data/requirements/constraints.txt" returned exit status 2.
+ ERROR: Command "docker exec d47eb360db4ce779c1f690db964655b76e68895c4360ff252c46fe7fe6f5c75a /usr/bin/env ANSIBLE_TEST_CONTENT_ROOT=/root/ansible_collections/netapp/ontap LC_ALL=en_US.UTF-8 /usr/bin/python3.6 /root/ansible/bin/ansible-test units --metadata tests/output/.tmp/metadata-9i2qfrcl.json --truncate 200 --redact --color yes --requirements --python default --requirements-mode only" returned exit status 1.
+ validations:
+ required: true
+
+
+- type: markdown
+ attributes:
+ value: >
+ *One last thing...*
+
+
+ Thank you for your collaboration!
+
+
+...
diff --git a/ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/feature_request.yml b/ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 000000000..621d52529
--- /dev/null
+++ b/ansible_collections/netapp/azure/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,100 @@
+---
+name: ✨ Feature request
+description: Suggest an idea for this project
+
+body:
+- type: markdown
+ attributes:
+ value: >
+ **Thank you for wanting to suggest a feature for netapp.azure!**
+
+ 💡
+ Before you go ahead with your request, please first consider if it
+ would be useful for majority of the netapp.azure users. As a
+ general rule of thumb, any feature that is only of interest to a
+ small sub group should be [implemented in a third-party Ansible
+ Collection][contribute to collections] or maybe even just your
+ project alone. Be mindful of the fact that the essential
+ netapp.azure features have a broad impact.
+
+
+ <details>
+ <summary>
+ ❗ Every change breaks someone's workflow.
+ </summary>
+
+
+ [![❗ Every change breaks someone's workflow.
+ ](https://imgs.xkcd.com/comics/workflow.png)
+ ](https://xkcd.com/1172/)
+ </details>
+
+
+ ⚠
+ Verify first that your idea is not [already requested on
+ GitHub][issue search].
+
+ Also test if the main branch does not already implement this.
+
+
+- type: textarea
+ attributes:
+ label: Summary
+ description: >
+ Describe the new feature/improvement you would like briefly below.
+
+
+ What's the problem this feature will solve?
+
+ What are you trying to do, that you are unable to achieve
+ with netapp.azure as it currently stands?
+
+
+ * Provide examples of real-world use cases that this would enable
+ and how it solves the problem you described.
+
+ * How do you solve this now?
+
+ * Have you tried to work around the problem using other tools?
+
+ * Could there be a different approach to solving this issue?
+
+ placeholder: >-
+ I am trying to do X with netapp.azure from the devel branch on GitHub and
+ I think that implementing a feature Y would be very helpful for me and
+ every other user of netapp.azure because of Z.
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: Component Name
+ description: >
+ Write the short name of the module, plugin, task or feature below,
+ *use your best guess if unsure*.
+
+
+ [collections org]: /ansible-collections
+ placeholder: dnf, apt, yum, pip, user etc.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Additional Information
+ description: |
+ Describe how the feature would be used, why it is needed and what it would solve.
+
+ **HINT:** You can paste https://gist.github.com links for larger files.
+ value: |
+ <!--- Paste example playbooks or commands between quotes below -->
+ ```yaml (paste below)
+
+ ```
+ placeholder: >-
+ I asked on https://stackoverflow.com/.... and the community
+ advised me to do X, Y and Z.
+ validations:
+ required: true
+
+...
diff --git a/ansible_collections/netapp/azure/.github/workflows/coverage.yml b/ansible_collections/netapp/azure/.github/workflows/coverage.yml
new file mode 100644
index 000000000..924232e4c
--- /dev/null
+++ b/ansible_collections/netapp/azure/.github/workflows/coverage.yml
@@ -0,0 +1,45 @@
+name: NetApp.azure Ansible Coverage
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 6 * * *'
+
+jobs:
+ sanity:
+ name: Coverage on Azure
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install ansible stable-2.11
+ run: pip install https://github.com/ansible/ansible/archive/stable-2.11.tar.gz --disable-pip-version-check
+
+ - name: Make directory to make ansible-test happy
+ run: |
+ pwd
+ mkdir -p ansible_collections/netapp/azure/
+ rsync -av . ansible_collections/netapp/azure/ --exclude ansible_collections/netapp/azure/
+
+ - name: Run Unit Tests
+ run: ansible-test units --coverage --color --docker --python 3.8
+ working-directory: ansible_collections/netapp/azure/
+
+ # ansible-test support producing code coverage date
+ - name: Generate coverage report
+ run: ansible-test coverage xml -v --requirements --group-by command --group-by version
+ working-directory: ansible_collections/netapp/azure/
+
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v2
+ with:
+ working-directory: ansible_collections/netapp/azure/
+ verbose: true \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/.github/workflows/main.yml b/ansible_collections/netapp/azure/.github/workflows/main.yml
new file mode 100644
index 000000000..7786df5a7
--- /dev/null
+++ b/ansible_collections/netapp/azure/.github/workflows/main.yml
@@ -0,0 +1,64 @@
+name: NetApp Ansible CI
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 6 * * *'
+
+jobs:
+ sanity_azure:
+ name: Sanity (${{ matrix.ansible }} on Azure ANF)
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ ansible:
+ - stable-2.9
+ - stable-2.10
+ - stable-2.11
+ - stable-2.12
+ - devel
+ collection: [azure]
+
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install ansible (${{ matrix.ansible }})
+ run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
+
+ - name: Delete collection tar file (azure)
+ run: rm -f /tmp/netapp-azure*
+
+ - name: Check collection path (azure)
+ run: |
+ pwd
+ ls
+
+ - name: Build collection (azure)
+ run: ansible-galaxy collection build --output-path /tmp .
+
+ - name: Install collection (azure)
+ run: ansible-galaxy collection install /tmp/netapp-azure*
+
+ - name: Delete collection tar file (azure)
+ run: rm -f /tmp/netapp-azure*
+
+ - name: Run sanity tests (azure)
+ run: ansible-test sanity --docker -v --color
+ working-directory: /home/runner/.ansible/collections/ansible_collections/netapp/azure
+
+ - name: Make directory to make ansible-test happy
+ run: |
+ pwd
+ mkdir -p ansible_collections/netapp/azure/
+ rsync -av . ansible_collections/netapp/azure/ --exclude ansible_collections/netapp/azure/
+
+ - name: Run Unit Tests
+ run: ansible-test units --docker -v --color
+ working-directory: ansible_collections/netapp/azure/
diff --git a/ansible_collections/netapp/azure/CHANGELOG.rst b/ansible_collections/netapp/azure/CHANGELOG.rst
new file mode 100644
index 000000000..fc18835a2
--- /dev/null
+++ b/ansible_collections/netapp/azure/CHANGELOG.rst
@@ -0,0 +1,171 @@
+=================================================
+Azure NetApp Files (ANF) Collection Release Notes
+=================================================
+
+.. contents:: Topics
+
+
+v21.10.0
+========
+
+Minor Changes
+-------------
+
+- PR1 - allow usage of Ansible module group defaults - for Ansible 2.12+.
+
+v21.9.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_volume - new option ``feature_flags`` to selectively enable/disable a feature.
+
+Bugfixes
+--------
+
+- azure_rm_netapp_volume - 'Change Ownership' is not permitted when creating NFSv4.1 volume with latest azure-mgmt-netapp package (4.0.0).
+
+v21.8.1
+=======
+
+Bugfixes
+--------
+
+- Hub Automation cannot generate documentation (cannot use doc fragments from another collection).
+
+v21.8.0
+=======
+
+Bugfixes
+--------
+
+- fix CI pipeline as azcollection does not support python 2.6.
+- fix CI pipeline as ignores are not required with latest azcollection.
+
+v21.7.0
+=======
+
+Bugfixes
+--------
+
+- fix CI pipeline to work with azcollection, and isolate UTs from azcollection.
+
+v21.6.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_account - support additional authentication schemes provided by AzureRMModuleBase.
+- azure_rm_netapp_capacity_pool - support additional authentication schemes provided by AzureRMModuleBase, and tags.
+- azure_rm_netapp_capacity_pool - wait for completion when creating, modifying, or deleting a pool.
+- azure_rm_netapp_snapshot - support additional authentication schemes provided by AzureRMModuleBase.
+- azure_rm_netapp_snapshot - wait for completion when creating, modifying, or deleting a pool.
+- azure_rm_netapp_volume - support additional authentication schemes provided by AzureRMModuleBase, and tags.
+
+v21.5.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_volume - enable changes in volume size.
+- azure_rm_netapp_volume - rename msg to mount_path, as documented in RETURN.
+
+v21.3.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_account - new option ``active_directories`` to support SMB volumes.
+- azure_rm_netapp_account - new suboptions ``ad_name``, ``kdc_ip``, ``service_root_ca_certificate``` for Active Directory.
+- azure_rm_netapp_volume - new option ``protocol_types`` to support SMB volumes.
+
+Bugfixes
+--------
+
+- azure_rm_netapp_account - wait for job completion for asynchroneous requests, and report belated errors.
+- support for azure-mgmt-netapp 1.0.0, while maintaining compatibility with 0.10.0.
+
+v21.2.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_account - new option ``active_directories`` to support SMB volumes.
+- azure_rm_netapp_volume - new option ``protocol_types`` to support SMB volumes.
+- azure_rm_netapp_volume - new option ``subnet_name`` as subnet_id is ambiguous. subnet_id is now aliased to subnet_name.
+
+Bugfixes
+--------
+
+- azure_rm_netapp_volume - fix 'Nonetype' object is not subscriptable exception when mount target is not created.
+
+v20.8.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_capacity_pool - Updated ANF capacity pool modify function for size parameter mandatory issue.
+- use a three group format for version_added. So 2.7 becomes 2.7.0. Same thing for 2.8 and 2.9.
+
+v20.7.0
+=======
+
+Bugfixes
+--------
+
+- azure_rm_netapp_capacity_pool - fixed idempotency for delete operation.
+
+v20.6.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_capacity_pool - now allows modify for size.
+- azure_rm_netapp_volume - now returns complete mount_path of the volume specified.
+
+v20.5.0
+=======
+
+Minor Changes
+-------------
+
+- azure_rm_netapp_account - new option ``tags``.
+- azure_rm_netapp_capacity_pool - new option ``service_level``.
+- azure_rm_netapp_volume - new option ``size``.
+- azure_rm_netapp_volume - new option ``vnet_resource_group_for_subnet``, resource group for virtual_network and subnet_id to be used.
+- azure_rm_netapp_volume - now returns mount_path of the volume specified.
+
+v20.4.0
+=======
+
+Bugfixes
+--------
+
+- fix changes to azure-mgmt-netapp as per new release.
+- removed ONTAP dependency import.
+
+v20.2.0
+=======
+
+Bugfixes
+--------
+
+- galaxy.yml - fix path to github repository.
+
+v19.10.0
+========
+
+New Modules
+-----------
+
+- netapp.azure.azure_rm_netapp_account - Manage NetApp Azure Files Account
+- netapp.azure.azure_rm_netapp_capacity_pool - Manage NetApp Azure Files capacity pool
+- netapp.azure.azure_rm_netapp_snapshot - Manage NetApp Azure Files Snapshot
+- netapp.azure.azure_rm_netapp_volume - Manage NetApp Azure Files Volume
diff --git a/ansible_collections/netapp/azure/COPYING b/ansible_collections/netapp/azure/COPYING
new file mode 100644
index 000000000..94a9ed024
--- /dev/null
+++ b/ansible_collections/netapp/azure/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/ansible_collections/netapp/azure/FILES.json b/ansible_collections/netapp/azure/FILES.json
new file mode 100644
index 000000000..cbba60ea2
--- /dev/null
+++ b/ansible_collections/netapp/azure/FILES.json
@@ -0,0 +1,705 @@
+{
+ "files": [
+ {
+ "name": ".",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3fc6781dfd99664ea3df19e10ff3fd4cb5fcb9a1ffab3974bf29a072688fac2b",
+ "format": 1
+ },
+ {
+ "name": "plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/doc_fragments",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/doc_fragments/netapp.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "05eeac3f09944a70935c66674fecd48fc0992c2706bc4168b10f54dff6517b6e",
+ "format": 1
+ },
+ {
+ "name": "plugins/doc_fragments/azure.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e2fddafaafe92473737d8a9b23ad23ce82703b0144a9930f8ace78f7138144f9",
+ "format": 1
+ },
+ {
+ "name": "plugins/doc_fragments/azure_tags.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e8c9d720dbc7605d3ee66799e8e81d0886e404c9a07b6b9b8edc844e0646de64",
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils/azure_rm_netapp_common.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ad77c0d169b499b3bbff9bfc98607b329da4c0939a30b862523cc238dfa349c8",
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils/netapp_module.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "44ebf2058eef2cc291d84bda55a9d22745a54ea08244d2c3fa498c835a60412f",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_netapp_volume.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "57f7917d51e630e28625b9aed1e055fc993912079ec84066b9b4dc00a79fc076",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_netapp_snapshot.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cb97e5fe758ded5c061c587caa4b5ece7e5093aa8735d28b5915b8ffae10493d",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_netapp_account.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "371e98c5eb914d5b5b29d5a38a0128a473a56503b24a0117cad094cd35fa4f68",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/azure_rm_netapp_capacity_pool.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "45ae9bf9be901a5744da83e0476439cc4afc583f996b5116e63a3ff1388789aa",
+ "format": 1
+ },
+ {
+ "name": "tests",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/unittest.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cba95d18c5b39c6f49714eacf1ac77452c2e32fa087c03cf01aacd19ae597b0f",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/builtins.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0ca4cac919e166b25e601e11acb01f6957dddd574ff0a62569cb994a5ecb63e1",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/mock.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0af958450cf6de3fbafe94b1111eae8ba5a8dbe1d785ffbb9df81f26e4946d99",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1776552fe8fe8ec7bc9bb0d8323b4892f297ac3a000d438ffce73c82487eb688",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/module_utils",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/module_utils/test_netapp_module.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "26d17aa4e1be7ddd99dd8150f3f72726693835df4480f09f63d665ba4568054d",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_azure_rm_netapp_volume_import.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6fb1715ddd3de877a50b0f8dd97d5b7e4518ca309f81f188eeedf0da7bd8ed6d",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_azure_rm_netapp_capacity_pool.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "35b9437b1e70cb214f9fb2599f48a2d51fb7f025be21487608a527000cdca225",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_azure_rm_netapp_snapshot.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7fb834aa39535b9eccaab1c67293e4fd44d96c2b8aec2bf963d3dee0e6e939be",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_azure_rm_netapp_volume.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "42e2a55717c6640dc3343055a758b4f930b9010c9d49351dddcc86e828557d5a",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_azure_rm_netapp_account.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d138b9ecf3ad3b50bc4757b2dce610f770523903da67ace63243b66fe1959857",
+ "format": 1
+ },
+ {
+ "name": "tests/integration",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_volume",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_volume/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_volume/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "37ecd68e07721ba9b164a9cf650354e65d9b522a8fa80ee5dd0a0f85ecbbb82c",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_volume/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_volume/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_volume/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "262ad6ab8a8087f2f21d4f26a2c2d02c347a7edf0fb1af8fdb931ab1c1087bbb",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_capacity_pool",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_capacity_pool/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_capacity_pool/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "725cf3d8200cc95ad524962e33008627f642ac6cb17daee6d833d7ad4990c904",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_capacity_pool/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_capacity_pool/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "86ade1ce7ec530fef84440672efaf3b60c253946bb82f5f0a134a9691bc6ffad",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_capacity_pool/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6d10b8feb73c18dc63753fe195137e2505f925ba1cbcdf5df43f67ad8c93f7a3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_snapshot",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_snapshot/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_snapshot/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2c1ad3044c2063456e66ffca7f717b0d5b01561685df50819b3ddab8f256f1e3",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_snapshot/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_snapshot/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_snapshot/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "262ad6ab8a8087f2f21d4f26a2c2d02c347a7edf0fb1af8fdb931ab1c1087bbb",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_account",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_account/tasks",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_account/tasks/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "af6c1c6108bde6652e3e6c3fa84bbf33b9e8e8d214fd5e6e2096d8a900993adb",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_account/meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_account/meta/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "d00bd90476595ae7d97d3ca8f8aa7ff475ebc3dd87d7d12e862bf0527f7bd81f",
+ "format": 1
+ },
+ {
+ "name": "tests/integration/targets/azure_rm_netapp_account/aliases",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "262ad6ab8a8087f2f21d4f26a2c2d02c347a7edf0fb1af8fdb931ab1c1087bbb",
+ "format": 1
+ },
+ {
+ "name": "tests/runner",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/runner/requirements",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/runner/requirements/integration.cloud.azure.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "48edd11776e45cc283be0d76efed83271645ff082d0d22c23d8a16ede3f13104",
+ "format": 1
+ },
+ {
+ "name": "tests/runner/requirements/unit.cloud.azure.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "48edd11776e45cc283be0d76efed83271645ff082d0d22c23d8a16ede3f13104",
+ "format": 1
+ },
+ {
+ "name": "tests/runner/requirements/requirements-azure.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "be5c6dc9b1fe6ffbec88625d6c225df060724e678bf4b179ee4acb6ba18a9fe2",
+ "format": 1
+ },
+ {
+ "name": "tests/runner/requirements/units.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "48edd11776e45cc283be0d76efed83271645ff082d0d22c23d8a16ede3f13104",
+ "format": 1
+ },
+ {
+ "name": "meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "meta/runtime.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "57bdfe68549cbe4f7282f9937425595fee23b756980f10c7c0c2bcb298ac057d",
+ "format": 1
+ },
+ {
+ "name": "changelogs",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3935.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "275e9147e14cace400fea4ad8d2d88e2a3c41daa65545cf5ade52ffac5bea3be",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.5.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e801f1b985b89427664b5bbc3e86c7f94e0515fe71584171438bdd2e6423f802",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3704.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7f7bf4dd5809a694c63075c88409b71d97b3c636fb4c60883e23e1d9c6acf256",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3505.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2117a356f790e63f26cbe90c1b8cbc8e66bc4ba44a3cec0d0f219bb3dee6a663",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3949.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "46256df687411ac1d89895e32713a4830ccffcf1bb823fbf88597481881aa67f",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.7.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "95ad8a5b1d71afce933fdd69b3116309a6d9a559416d8ab3641470eb5286ee9f",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3663.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ede05991f45025041ce7305e06f27f7c7747b0a5e3c61d11e5775796315ad801",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.2.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "91918f48a406834778ff7163c92c12dd1802c0620cb681ee66f8a4709444cf5e",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-4001.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c9b63b1230f04b472b8d55d5bd616c1687972ec14126e643de62788c9788708a",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3526.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "61cb464ce2c8e6aaf9a74beca5e246e4010ee68f2632eba0347e5cf3267e9510",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-4246.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "87733f8557c5f0c13302e47e18712cc094f8e1cf63665519a340c74baee95e1b",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.4.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c4fd861b273aceb9ec0a456ddbae2a6f82bdd6a2244b81e9b1e903a59eaa83bf",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.8.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "266926d348a95b55d65ff99683f9bdfe7ad1302731c08964bb86ce714272d86c",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-4135.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3b73cac3f25ff245e6156120be0b828339193515410dfe1746e9fe58b2fc5d1a",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-4070.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ef62606cf209269c701e931090525e063781b9990853a20f718f250bbccd182d",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.6.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b5988b539e04f6be548b4f07142e208adc5974ed6d67511f2efcd5f721598124",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3849.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cfaa25e04a5dcb6f13b27a52d79dd1ee8a06002d028a86a09184b58c431fc5fd",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-4416.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4224db573f34caeeb956c8728eb343a47bc2729d898001a4c6a671b780dae1bf",
+ "format": 1
+ },
+ {
+ "name": "changelogs/config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "fdb1023b66dee056bc12c35cf7326a01c0ce7a8c1eceea032270fd24db9e1467",
+ "format": 1
+ },
+ {
+ "name": "changelogs/.plugin-cache.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "5297a0a490809a3f9e664aebea58cf1b7c48af79e7ac4a9e1be5845359d7d016",
+ "format": 1
+ },
+ {
+ "name": "changelogs/changelog.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "edbc85fcd35436d9f71c7b5f3247522276ebc4fb00567a74873b163adcadf020",
+ "format": 1
+ },
+ {
+ "name": "README.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3cb633ca474a7fb30d6f8c73956c921b1f3043850ff221fcf3d84afe4921696d",
+ "format": 1
+ },
+ {
+ "name": "COPYING",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903",
+ "format": 1
+ },
+ {
+ "name": ".github",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/coverage.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "081b4ec5fb77d7676357b8600b547e7b2cbad8eb340333305ef5d448d832510b",
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b13e2320cd388d55ecad4a6b8785ae58481464d8b44ff6494c39ca04f48c72b5",
+ "format": 1
+ },
+ {
+ "name": ".github/ISSUE_TEMPLATE",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/ISSUE_TEMPLATE/feature_request.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4ad81e92ae7b1fbef37afde2fc57466d3d7dd20d5ab9bba1e01e0faac83228cf",
+ "format": 1
+ },
+ {
+ "name": ".github/ISSUE_TEMPLATE/bug_report.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ef5f731a1c7790ce52a685a93370a5d0a5523bf75b9b0a0f0d9cc50171c60ac0",
+ "format": 1
+ },
+ {
+ "name": "CHANGELOG.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7ee760ffaaed6d3d476d1eb9fda880bbaf3a2247a5014428c058282b597131a7",
+ "format": 1
+ },
+ {
+ "name": "HACK.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0757d4b54e08f27761851d37143cbe15d58c324db2968fe157546992592bb382",
+ "format": 1
+ }
+ ],
+ "format": 1
+} \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/HACK.md b/ansible_collections/netapp/azure/HACK.md
new file mode 100644
index 000000000..cbd239e0e
--- /dev/null
+++ b/ansible_collections/netapp/azure/HACK.md
@@ -0,0 +1,13 @@
+Because of an issue in Ansible, Hub Automation cannot use doc fragments from an external collection as:
+```
+ - azure.azcollection.azure
+ - azure.azcollection.azure_tags
+```
+
+Red Hat asked us to make local copies of the azcollection doc fragments. They are in
+```
+ansible_collections/netapp/azure/plugins/doc_fragments/azure.py
+ansible_collections/netapp/azure/plugins/doc_fragments/azure_tags.py
+```
+
+Once the Ansible issue is fixed, we should remove these copies, as they may be out of sync with the azcollection.
diff --git a/ansible_collections/netapp/azure/MANIFEST.json b/ansible_collections/netapp/azure/MANIFEST.json
new file mode 100644
index 000000000..4fcd3fa5e
--- /dev/null
+++ b/ansible_collections/netapp/azure/MANIFEST.json
@@ -0,0 +1,37 @@
+{
+ "collection_info": {
+ "namespace": "netapp",
+ "name": "azure",
+ "version": "21.10.0",
+ "authors": [
+ "NetApp Ansible Team <ng-ansibleteam@netapp.com>"
+ ],
+ "readme": "README.md",
+ "tags": [
+ "storage",
+ "cloud",
+ "netapp",
+ "cvs",
+ "anf",
+ "azure"
+ ],
+ "description": "Azure NetApp Files (ANF)",
+ "license": [],
+ "license_file": "COPYING",
+ "dependencies": {
+ "azure.azcollection": ">=1.0.0"
+ },
+ "repository": "https://github.com/ansible-collections/netapp.azure",
+ "documentation": null,
+ "homepage": "https://netapp.io/configuration-management-and-automation/",
+ "issues": "https://github.com/ansible-collections/netapp.azure/issues"
+ },
+ "file_manifest_file": {
+ "name": "FILES.json",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c2d51ddefb3ce0ffdef8c468f22c2dbb09bc3c9828b31141ec8c85d8f37d0d59",
+ "format": 1
+ },
+ "format": 1
+} \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/README.md b/ansible_collections/netapp/azure/README.md
new file mode 100644
index 000000000..f56a07ead
--- /dev/null
+++ b/ansible_collections/netapp/azure/README.md
@@ -0,0 +1,157 @@
+[![Documentation](https://img.shields.io/badge/docs-brightgreen.svg)](https://docs.ansible.com/ansible/devel/collections/netapp/azure/index.html)
+![example workflow](https://github.com/ansible-collections/netapp.azure/actions/workflows/main.yml/badge.svg)
+[![codecov](https://codecov.io/gh/ansible-collections/netapp.azure/branch/main/graph/badge.svg?token=weBYkksxSi)](https://codecov.io/gh/ansible-collections/netapp.azure)
+=============================================================
+
+netapp.azure
+
+Azure NetApp Files (ANF) Collection
+
+Copyright (c) 2019 NetApp, Inc. All rights reserved.
+Specifications subject to change without notice.
+
+=============================================================
+
+# Installation
+```bash
+ansible-galaxy collection install netapp.azure
+```
+To use Collection add the following to the top of your playbook, with out this you will be using Ansible 2.9 version of the module
+```
+collections:
+ - netapp.azure
+```
+
+# Module documentation
+https://docs.ansible.com/ansible/devel/collections/netapp/azure/
+
+# Need help
+Join our Slack Channel at [Netapp.io](http://netapp.io/slack)
+
+# Requirements
+- python >= 2.7
+- azure >= 2.0.0
+- Python azure-mgmt. Install using ```pip install azure-mgmt```
+- Python azure-mgmt-netapp. Install using ```pip install azure-mgmt-netapp```
+- For authentication with Azure NetApp log in before you run your tasks or playbook with 'az login'.
+
+# Code of Conduct
+This collection follows the [Ansible project's Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).
+
+# Release Notes
+
+## 21.10.0
+
+### Minor changes
+ - all modules - allow usage of Ansible module group defaults - for Ansible 2.12+.
+
+## 21.9.0
+
+### New Options
+ - azure_rm_netapp_volume - `feature_flags` to selectively enable/disable a feature.
+
+### Bug Fixes
+ - azure_rm_netapp_volume - 'Change Ownership' is not permitted when creating NFSv4.1 volume with latest azure-mgmt-netapp package (4.0.0).
+
+## 21.8.1
+
+### Bug Fixes
+ - Hub Automation cannot generate documentation (cannot use doc fragments from another collection).
+
+## 21.8.0
+
+### Bug Fixes
+
+- fix CI pipeline as azcollection does not support python 2.6.
+- fix CI pipeline as ignores are not required with latest azcollection.
+
+## 21.7.0
+
+### Bug Fixes
+
+- fix CI pipeline to work with azcollection, and isolate UTs from azcollection.
+
+## 21.6.0
+
+### Minor changes
+
+ - azure_rm_netapp_account - support additional authentication schemes provided by AzureRMModuleBase.
+ - azure_rm_netapp_capacity_pool - support additional authentication schemes provided by AzureRMModuleBase, and tags.
+ - azure_rm_netapp_capacity_pool - wait for completion when creating, modifying, or deleting a pool.
+ - azure_rm_netapp_snapshot - support additional authentication schemes provided by AzureRMModuleBase.
+ - azure_rm_netapp_snapshot - wait for completion when creating or deleting a snapshot.
+ - azure_rm_netapp_volume - support additional authentication schemes provided by AzureRMModuleBase, and tags.
+
+## 21.5.0
+
+### Minor changes
+ - azure_rm_netapp_volume - enable changes in volume size.
+ - azure_rm_netapp_volume - rename msg to mount_path, as documented in RETURN.
+
+## 21.3.0
+
+### New Options
+ - azure_rm_netapp_account - new suboptions `ad_name`, `kdc_ip`, `service_root_ca_certificate` for Active Directory.
+
+### Bug Fixes
+ - support for azure-mgmt-netapp 1.0.0, while maintaining compatibility with 0.10.0.
+ - azure_rm_netapp_account - wait for job completion for asynchroneous requests, and report belated errors.
+
+## 21.2.0
+
+### New Options
+ - azure_rm_netapp_account: new option `active_directories` to support SMB volumes.
+ - azure_rm_netapp_volume: new option `protocol_types` to support SMB volumes.
+
+## 21.1.0
+
+### New Options
+ - azure_rm_netapp_volume - new option `subnet_name` as subnet_id is ambiguous. subnet_id is now aliased to subnet_name.
+
+### Bug Fixes
+ - azure_rm_netapp_volume - fix 'Nonetype' object is not subscriptable exception when mount target is not created.
+
+## 20.8.0
+
+### Module documentation changes
+- azure_rm_netapp_capacity_pool: Updated ANF capacity pool modify function for `size` parameter mandatory issue.
+- use a three group format for `version_added`. So 2.7 becomes 2.7.0. Same thing for 2.8 and 2.9.
+
+## 20.7.0
+
+### Bug Fixes
+- azure_rm_netapp_capacity_pool: fixed idempotency for delete operation.
+
+## 20.6.0
+
+### New Options
+- azure_rm_netapp_capacity_pool: now allows modify for size.
+- azure_rm_netapp_volume: now returns complete mount_path of the volume specified.
+
+## 20.5.0
+
+### New Options
+- azure_rm_netapp_account: new option `tags`.
+- azure_rm_netapp_capacity_pool: new option `service_level`.
+- azure_rm_netapp_volume: new option `size`.
+- azure_rm_netapp_volume: now returns mount_path of the volume specified.
+- azure_rm_netapp_volume: new option `vnet_resource_group_for_subnet`, resource group for virtual_network and subnet_id to be used.
+
+## 20.4.0
+
+### Bug Fixes
+- fix changes to azure-mgmt-netapp as per new release.
+- removed ONTAP dependency import.
+
+## 20.2.0
+
+### Bug Fixes
+- galaxy.yml: fix path to github repository.
+
+## 19.11.0
+- Initial release.
+### New Modules
+- azure_rm_netapp_account: create/delete NetApp Azure Files Account.
+- azure_rm_netapp_capacity_pool: create/delete NetApp Azure Files capacity pool.
+- azure_rm_netapp_snapshot: create/delete NetApp Azure Files Snapshot.
+- azure_rm_netapp_volume: create/delete NetApp Azure Files volume.
diff --git a/ansible_collections/netapp/azure/changelogs/.plugin-cache.yaml b/ansible_collections/netapp/azure/changelogs/.plugin-cache.yaml
new file mode 100644
index 000000000..6e247d8f7
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/.plugin-cache.yaml
@@ -0,0 +1,35 @@
+plugins:
+ become: {}
+ cache: {}
+ callback: {}
+ cliconf: {}
+ connection: {}
+ httpapi: {}
+ inventory: {}
+ lookup: {}
+ module:
+ azure_rm_netapp_account:
+ description: Manage NetApp Azure Files Account
+ name: azure_rm_netapp_account
+ namespace: private.var.folders.zv.gm9l2n2n30g2k5tdmny65l_r0000gp.T.antsibull-changelogrmmpa_fx.collections.ansible_collections.netapp.azure.plugins.modules
+ version_added: 19.10.0
+ azure_rm_netapp_capacity_pool:
+ description: Manage NetApp Azure Files capacity pool
+ name: azure_rm_netapp_capacity_pool
+ namespace: private.var.folders.zv.gm9l2n2n30g2k5tdmny65l_r0000gp.T.antsibull-changelogrmmpa_fx.collections.ansible_collections.netapp.azure.plugins.modules
+ version_added: 19.10.0
+ azure_rm_netapp_snapshot:
+ description: Manage NetApp Azure Files Snapshot
+ name: azure_rm_netapp_snapshot
+ namespace: private.var.folders.zv.gm9l2n2n30g2k5tdmny65l_r0000gp.T.antsibull-changelogrmmpa_fx.collections.ansible_collections.netapp.azure.plugins.modules
+ version_added: 19.10.0
+ azure_rm_netapp_volume:
+ description: Manage NetApp Azure Files Volume
+ name: azure_rm_netapp_volume
+ namespace: private.var.folders.zv.gm9l2n2n30g2k5tdmny65l_r0000gp.T.antsibull-changelogrmmpa_fx.collections.ansible_collections.netapp.azure.plugins.modules
+ version_added: 19.10.0
+ netconf: {}
+ shell: {}
+ strategy: {}
+ vars: {}
+version: 21.8.0
diff --git a/ansible_collections/netapp/azure/changelogs/changelog.yaml b/ansible_collections/netapp/azure/changelogs/changelog.yaml
new file mode 100644
index 000000000..71085dedf
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/changelog.yaml
@@ -0,0 +1,169 @@
+ancestor: null
+releases:
+ 19.10.0:
+ modules:
+ - description: Manage NetApp Azure Files Account
+ name: azure_rm_netapp_account
+ namespace: ''
+ - description: Manage NetApp Azure Files capacity pool
+ name: azure_rm_netapp_capacity_pool
+ namespace: ''
+ - description: Manage NetApp Azure Files Snapshot
+ name: azure_rm_netapp_snapshot
+ namespace: ''
+ - description: Manage NetApp Azure Files Volume
+ name: azure_rm_netapp_volume
+ namespace: ''
+ release_date: '2019-11-14'
+ 20.2.0:
+ changes:
+ bugfixes:
+ - galaxy.yml - fix path to github repository.
+ fragments:
+ - 20.2.0.yaml
+ release_date: '2020-02-05'
+ 20.4.0:
+ changes:
+ bugfixes:
+ - fix changes to azure-mgmt-netapp as per new release.
+ - removed ONTAP dependency import.
+ fragments:
+ - 20.4.0.yaml
+ release_date: '2020-04-21'
+ 20.5.0:
+ changes:
+ minor_changes:
+ - azure_rm_netapp_account - new option ``tags``.
+ - azure_rm_netapp_capacity_pool - new option ``service_level``.
+ - azure_rm_netapp_volume - new option ``size``.
+ - azure_rm_netapp_volume - new option ``vnet_resource_group_for_subnet``, resource
+ group for virtual_network and subnet_id to be used.
+ - azure_rm_netapp_volume - now returns mount_path of the volume specified.
+ fragments:
+ - 20.5.0.yaml
+ release_date: '2020-05-06'
+ 20.6.0:
+ changes:
+ minor_changes:
+ - azure_rm_netapp_capacity_pool - now allows modify for size.
+ - azure_rm_netapp_volume - now returns complete mount_path of the volume specified.
+ fragments:
+ - 20.6.0.yaml
+ release_date: '2020-06-03'
+ 20.7.0:
+ changes:
+ bugfixes:
+ - azure_rm_netapp_capacity_pool - fixed idempotency for delete operation.
+ fragments:
+ - 20.7.0.yaml
+ release_date: '2020-06-24'
+ 20.8.0:
+ changes:
+ minor_changes:
+ - azure_rm_netapp_capacity_pool - Updated ANF capacity pool modify function
+ for size parameter mandatory issue.
+ - use a three group format for version_added. So 2.7 becomes 2.7.0. Same thing
+ for 2.8 and 2.9.
+ fragments:
+ - 20.8.0.yaml
+ release_date: '2020-08-05'
+ 21.10.0:
+ changes:
+ minor_changes:
+ - PR1 - allow usage of Ansible module group defaults - for Ansible 2.12+.
+ fragments:
+ - DEVOPS-4416.yaml
+ release_date: '2021-11-03'
+ 21.2.0:
+ changes:
+ bugfixes:
+ - azure_rm_netapp_volume - fix 'Nonetype' object is not subscriptable exception
+ when mount target is not created.
+ minor_changes:
+ - azure_rm_netapp_account - new option ``active_directories`` to support SMB
+ volumes.
+ - azure_rm_netapp_volume - new option ``protocol_types`` to support SMB volumes.
+ - azure_rm_netapp_volume - new option ``subnet_name`` as subnet_id is ambiguous. subnet_id
+ is now aliased to subnet_name.
+ fragments:
+ - DEVOPS-3505.yaml
+ release_date: '2021-02-04'
+ 21.3.0:
+ changes:
+ bugfixes:
+ - azure_rm_netapp_account - wait for job completion for asynchroneous requests,
+ and report belated errors.
+ - support for azure-mgmt-netapp 1.0.0, while maintaining compatibility with
+ 0.10.0.
+ minor_changes:
+ - azure_rm_netapp_account - new option ``active_directories`` to support SMB
+ volumes.
+ - azure_rm_netapp_account - new suboptions ``ad_name``, ``kdc_ip``, ``service_root_ca_certificate```
+ for Active Directory.
+ - azure_rm_netapp_volume - new option ``protocol_types`` to support SMB volumes.
+ fragments:
+ - DEVOPS-3526.yaml
+ - DEVOPS-3663.yaml
+ - DEVOPS-3704.yaml
+ release_date: '2021-03-03'
+ 21.5.0:
+ changes:
+ minor_changes:
+ - azure_rm_netapp_volume - enable changes in volume size.
+ - azure_rm_netapp_volume - rename msg to mount_path, as documented in RETURN.
+ fragments:
+ - DEVOPS-3849.yaml
+ release_date: '2021-04-21'
+ 21.6.0:
+ changes:
+ minor_changes:
+ - azure_rm_netapp_account - support additional authentication schemes provided
+ by AzureRMModuleBase.
+ - azure_rm_netapp_capacity_pool - support additional authentication schemes
+ provided by AzureRMModuleBase, and tags.
+ - azure_rm_netapp_capacity_pool - wait for completion when creating, modifying,
+ or deleting a pool.
+ - azure_rm_netapp_snapshot - support additional authentication schemes provided
+ by AzureRMModuleBase.
+ - azure_rm_netapp_snapshot - wait for completion when creating, modifying, or
+ deleting a pool.
+ - azure_rm_netapp_volume - support additional authentication schemes provided
+ by AzureRMModuleBase, and tags.
+ fragments:
+ - DEVOPS-3935.yaml
+ - DEVOPS-3949.yaml
+ release_date: '2021-05-06'
+ 21.7.0:
+ changes:
+ bugfixes:
+ - fix CI pipeline to work with azcollection, and isolate UTs from azcollection.
+ fragments:
+ - DEVOPS-4001.yaml
+ release_date: '2021-06-03'
+ 21.8.0:
+ changes:
+ bugfixes:
+ - fix CI pipeline as azcollection does not support python 2.6.
+ - fix CI pipeline as ignores are not required with latest azcollection.
+ fragments:
+ - DEVOPS-4070.yaml
+ release_date: '2021-07-14'
+ 21.8.1:
+ changes:
+ bugfixes:
+ - Hub Automation cannot generate documentation (cannot use doc fragments from
+ another collection).
+ fragments:
+ - DEVOPS-4135.yaml
+ release_date: '2021-07-16'
+ 21.9.0:
+ changes:
+ bugfixes:
+ - azure_rm_netapp_volume - 'Change Ownership' is not permitted when creating
+ NFSv4.1 volume with latest azure-mgmt-netapp package (4.0.0).
+ minor_changes:
+ - azure_rm_netapp_volume - new option ``feature_flags`` to selectively enable/disable
+ a feature.
+ fragments:
+ - DEVOPS-4246.yaml
+ release_date: '2021-09-01'
diff --git a/ansible_collections/netapp/azure/changelogs/config.yaml b/ansible_collections/netapp/azure/changelogs/config.yaml
new file mode 100644
index 000000000..fcd0312f6
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/config.yaml
@@ -0,0 +1,32 @@
+changelog_filename_template: ../CHANGELOG.rst
+changelog_filename_version_depth: 0
+changes_file: changelog.yaml
+changes_format: combined
+ignore_other_fragment_extensions: true
+keep_fragments: true
+mention_ancestor: false
+new_plugins_after_name: removed_features
+notesdir: fragments
+prelude_section_name: release_summary
+prelude_section_title: Release Summary
+sanitize_changelog: true
+sections:
+- - major_changes
+ - Major Changes
+- - minor_changes
+ - Minor Changes
+- - breaking_changes
+ - Breaking Changes / Porting Guide
+- - deprecated_features
+ - Deprecated Features
+- - removed_features
+ - Removed Features (previously deprecated)
+- - security_fixes
+ - Security Fixes
+- - bugfixes
+ - Bugfixes
+- - known_issues
+ - Known Issues
+title: Azure NetApp Files (ANF) Collection
+trivial_section_name: trivial
+use_fqcn: true
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/20.2.0.yaml b/ansible_collections/netapp/azure/changelogs/fragments/20.2.0.yaml
new file mode 100644
index 000000000..3f764c1c9
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/20.2.0.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - galaxy.yml - fix path to github repository.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/20.4.0.yaml b/ansible_collections/netapp/azure/changelogs/fragments/20.4.0.yaml
new file mode 100644
index 000000000..044018d2c
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/20.4.0.yaml
@@ -0,0 +1,3 @@
+bugfixes:
+ - fix changes to azure-mgmt-netapp as per new release.
+ - removed ONTAP dependency import.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/20.5.0.yaml b/ansible_collections/netapp/azure/changelogs/fragments/20.5.0.yaml
new file mode 100644
index 000000000..a2f16d6b0
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/20.5.0.yaml
@@ -0,0 +1,6 @@
+minor_changes:
+ - azure_rm_netapp_account - new option ``tags``.
+ - azure_rm_netapp_capacity_pool - new option ``service_level``.
+ - azure_rm_netapp_volume - new option ``size``.
+ - azure_rm_netapp_volume - now returns mount_path of the volume specified.
+ - azure_rm_netapp_volume - new option ``vnet_resource_group_for_subnet``, resource group for virtual_network and subnet_id to be used.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/20.6.0.yaml b/ansible_collections/netapp/azure/changelogs/fragments/20.6.0.yaml
new file mode 100644
index 000000000..67b15df45
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/20.6.0.yaml
@@ -0,0 +1,3 @@
+minor_changes:
+ - azure_rm_netapp_capacity_pool - now allows modify for size.
+ - azure_rm_netapp_volume - now returns complete mount_path of the volume specified.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/20.7.0.yaml b/ansible_collections/netapp/azure/changelogs/fragments/20.7.0.yaml
new file mode 100644
index 000000000..e150ea10d
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/20.7.0.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - azure_rm_netapp_capacity_pool - fixed idempotency for delete operation.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/20.8.0.yaml b/ansible_collections/netapp/azure/changelogs/fragments/20.8.0.yaml
new file mode 100644
index 000000000..68e9d285d
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/20.8.0.yaml
@@ -0,0 +1,3 @@
+minor_changes:
+ - azure_rm_netapp_capacity_pool - Updated ANF capacity pool modify function for size parameter mandatory issue.
+ - use a three group format for version_added. So 2.7 becomes 2.7.0. Same thing for 2.8 and 2.9.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3505.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3505.yaml
new file mode 100644
index 000000000..87c49d052
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3505.yaml
@@ -0,0 +1,4 @@
+minor_changes:
+ - azure_rm_netapp_volume - new option ``subnet_name`` as subnet_id is ambiguous. subnet_id is now aliased to subnet_name.
+bugfixes:
+ - azure_rm_netapp_volume - fix 'Nonetype' object is not subscriptable exception when mount target is not created.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3526.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3526.yaml
new file mode 100644
index 000000000..720ce523d
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3526.yaml
@@ -0,0 +1,3 @@
+minor_changes:
+ - azure_rm_netapp_account - new option ``active_directories`` to support SMB volumes.
+ - azure_rm_netapp_volume - new option ``protocol_types`` to support SMB volumes.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3663.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3663.yaml
new file mode 100644
index 000000000..e9adbdb9b
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3663.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - support for azure-mgmt-netapp 1.0.0, while maintaining compatibility with 0.10.0.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3704.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3704.yaml
new file mode 100644
index 000000000..f0c1f6a38
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3704.yaml
@@ -0,0 +1,5 @@
+minor_changes:
+ - azure_rm_netapp_account - new suboptions ``ad_name``, ``kdc_ip``, ``service_root_ca_certificate``` for Active Directory.
+
+bugfixes:
+ - azure_rm_netapp_account - wait for job completion for asynchroneous requests, and report belated errors.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3849.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3849.yaml
new file mode 100644
index 000000000..7fc5d9fae
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3849.yaml
@@ -0,0 +1,3 @@
+minor_changes:
+ - azure_rm_netapp_volume - enable changes in volume size.
+ - azure_rm_netapp_volume - rename msg to mount_path, as documented in RETURN.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3935.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3935.yaml
new file mode 100644
index 000000000..c619dbcd9
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3935.yaml
@@ -0,0 +1,2 @@
+minor_changes:
+ - azure_rm_netapp_account - support additional authentication schemes provided by AzureRMModuleBase.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3949.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3949.yaml
new file mode 100644
index 000000000..2889546f8
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-3949.yaml
@@ -0,0 +1,6 @@
+minor_changes:
+ - azure_rm_netapp_capacity_pool - support additional authentication schemes provided by AzureRMModuleBase, and tags.
+ - azure_rm_netapp_capacity_pool - wait for completion when creating, modifying, or deleting a pool.
+ - azure_rm_netapp_snapshot - support additional authentication schemes provided by AzureRMModuleBase.
+ - azure_rm_netapp_snapshot - wait for completion when creating, modifying, or deleting a pool.
+ - azure_rm_netapp_volume - support additional authentication schemes provided by AzureRMModuleBase, and tags.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4001.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4001.yaml
new file mode 100644
index 000000000..2b09e21ce
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4001.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - fix CI pipeline to work with azcollection, and isolate UTs from azcollection.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4070.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4070.yaml
new file mode 100644
index 000000000..0342115bb
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4070.yaml
@@ -0,0 +1,3 @@
+bugfixes:
+ - fix CI pipeline as azcollection does not support python 2.6.
+ - fix CI pipeline as ignores are not required with latest azcollection.
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4135.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4135.yaml
new file mode 100644
index 000000000..50e2e7d36
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4135.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - Hub Automation cannot generate documentation (cannot use doc fragments from another collection).
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4246.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4246.yaml
new file mode 100644
index 000000000..781042d6f
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4246.yaml
@@ -0,0 +1,4 @@
+minor_changes:
+ - azure_rm_netapp_volume - new option ``feature_flags`` to selectively enable/disable a feature.
+bugfixes:
+ - azure_rm_netapp_volume - 'Change Ownership' is not permitted when creating NFSv4.1 volume with latest azure-mgmt-netapp package (4.0.0).
diff --git a/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4416.yaml b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4416.yaml
new file mode 100644
index 000000000..6b4b660a0
--- /dev/null
+++ b/ansible_collections/netapp/azure/changelogs/fragments/DEVOPS-4416.yaml
@@ -0,0 +1,2 @@
+minor_changes:
+ - PR1 - allow usage of Ansible module group defaults - for Ansible 2.12+.
diff --git a/ansible_collections/netapp/azure/meta/runtime.yml b/ansible_collections/netapp/azure/meta/runtime.yml
new file mode 100644
index 000000000..a6ed3542d
--- /dev/null
+++ b/ansible_collections/netapp/azure/meta/runtime.yml
@@ -0,0 +1,8 @@
+---
+requires_ansible: ">=2.9.10"
+action_groups:
+ netapp_azure:
+ - azure_rm_netapp_account
+ - azure_rm_netapp_capacity_pool
+ - azure_rm_netapp_snapshot
+ - azure_rm_netapp_volume
diff --git a/ansible_collections/netapp/azure/plugins/doc_fragments/azure.py b/ansible_collections/netapp/azure/plugins/doc_fragments/azure.py
new file mode 100644
index 000000000..49467db70
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/doc_fragments/azure.py
@@ -0,0 +1,129 @@
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016 Matt Davis, <mdavis@ansible.com>
+# Copyright: (c) 2016 Chris Houseknecht, <house@redhat.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+class ModuleDocFragment(object):
+
+ # Azure doc fragment
+ DOCUMENTATION = r'''
+
+options:
+ ad_user:
+ description:
+ - Active Directory username. Use when authenticating with an Active Directory user rather than service
+ principal.
+ type: str
+ password:
+ description:
+ - Active Directory user password. Use when authenticating with an Active Directory user rather than service
+ principal.
+ type: str
+ profile:
+ description:
+ - Security profile found in ~/.azure/credentials file.
+ type: str
+ subscription_id:
+ description:
+ - Your Azure subscription Id.
+ type: str
+ client_id:
+ description:
+ - Azure client ID. Use when authenticating with a Service Principal.
+ type: str
+ secret:
+ description:
+ - Azure client secret. Use when authenticating with a Service Principal.
+ type: str
+ tenant:
+ description:
+ - Azure tenant ID. Use when authenticating with a Service Principal.
+ type: str
+ cloud_environment:
+ description:
+ - For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, C(AzureChinaCloud),
+ C(AzureUSGovernment)), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or
+ the C(AZURE_CLOUD_ENVIRONMENT) environment variable.
+ type: str
+ default: AzureCloud
+ version_added: '0.0.1'
+ adfs_authority_url:
+ description:
+ - Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority.
+ type: str
+ version_added: '0.0.1'
+ cert_validation_mode:
+ description:
+ - Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but
+ when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing C(ignore). Can also be
+ set via credential file profile or the C(AZURE_CERT_VALIDATION) environment variable.
+ type: str
+ choices: [ ignore, validate ]
+ version_added: '0.0.1'
+ auth_source:
+ description:
+ - Controls the source of the credentials to use for authentication.
+ - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable.
+ - When set to C(auto) (the default) the precedence is module parameters -> C(env) -> C(credential_file) -> C(cli).
+ - When set to C(env), the credentials will be read from the environment variables
+ - When set to C(credential_file), it will read the profile from C(~/.azure/credentials).
+ - When set to C(cli), the credentials will be sources from the Azure CLI profile. C(subscription_id) or the environment variable
+ C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if more than one is present otherwise the default
+ az cli subscription is used.
+ - When set to C(msi), the host machine must be an azure resource with an enabled MSI extension. C(subscription_id) or the
+ environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if the resource is granted
+ access to more than one subscription, otherwise the first subscription is chosen.
+ - The C(msi) was added in Ansible 2.6.
+ type: str
+ default: auto
+ choices:
+ - auto
+ - cli
+ - credential_file
+ - env
+ - msi
+ version_added: '0.0.1'
+ api_profile:
+ description:
+ - Selects an API profile to use when communicating with Azure services. Default value of C(latest) is appropriate for public clouds;
+ future values will allow use with Azure Stack.
+ type: str
+ default: latest
+ version_added: '0.0.1'
+ log_path:
+ description:
+ - Parent argument.
+ type: str
+ log_mode:
+ description:
+ - Parent argument.
+ type: str
+requirements:
+ - python >= 2.7
+ - The host that executes this module must have the azure.azcollection collection installed via galaxy
+ - All python packages listed in collection's requirements-azure.txt must be installed via pip on the host that executes modules from azure.azcollection
+ - Full installation instructions may be found https://galaxy.ansible.com/azure/azcollection
+
+notes:
+ - For authentication with Azure you can pass parameters, set environment variables, use a profile stored
+ in ~/.azure/credentials, or log in before you run your tasks or playbook with C(az login).
+ - Authentication is also possible using a service principal or Active Directory user.
+ - To authenticate via service principal, pass subscription_id, client_id, secret and tenant or set environment
+ variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT.
+ - To authenticate via Active Directory user, pass ad_user and password, or set AZURE_AD_USER and
+ AZURE_PASSWORD in the environment.
+ - "Alternatively, credentials can be stored in ~/.azure/credentials. This is an ini file containing
+ a [default] section and the following keys: subscription_id, client_id, secret and tenant or
+ subscription_id, ad_user and password. It is also possible to add additional profiles. Specify the profile
+ by passing profile or setting AZURE_PROFILE in the environment."
+
+seealso:
+ - name: Sign in with Azure CLI
+ link: https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest
+ description: How to authenticate using the C(az login) command.
+ '''
diff --git a/ansible_collections/netapp/azure/plugins/doc_fragments/azure_tags.py b/ansible_collections/netapp/azure/plugins/doc_fragments/azure_tags.py
new file mode 100644
index 000000000..8edb80eed
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/doc_fragments/azure_tags.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2016, Matt Davis, <mdavis@ansible.com>
+# Copyright: (c) 2016, Chris Houseknecht, <house@redhat.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+
+class ModuleDocFragment(object):
+
+ # Azure doc fragment
+ DOCUMENTATION = r'''
+options:
+ tags:
+ description:
+ - Dictionary of string:string pairs to assign as metadata to the object.
+ - Metadata tags on the object will be updated with any provided values.
+ - To remove tags set append_tags option to false.
+ - Currently, Azure DNS zones and Traffic Manager services also don't allow the use of spaces in the tag.
+ - Azure Front Door doesn't support the use of # in the tag name.
+ - Azure Automation and Azure CDN only support 15 tags on resources.
+ type: dict
+ append_tags:
+ description:
+ - Use to control if tags field is canonical or just appends to existing tags.
+ - When canonical, any tags not found in the tags parameter will be removed from the object's metadata.
+ type: bool
+ default: yes
+ '''
diff --git a/ansible_collections/netapp/azure/plugins/doc_fragments/netapp.py b/ansible_collections/netapp/azure/plugins/doc_fragments/netapp.py
new file mode 100644
index 000000000..18e9cc2a2
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/doc_fragments/netapp.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2019, NetApp Ansible Team ng-ansibleteam@netapp.com
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+
+class ModuleDocFragment(object):
+
+ DOCUMENTATION = r'''
+options:
+ - See respective platform section for more details
+requirements:
+ - See respective platform section for more details
+notes:
+ - Ansible modules are available for the following NetApp Storage Platforms: E-Series, ONTAP, SolidFire
+'''
+
+ # Documentation fragment for Cloud Volume Services on Azure NetApp (azure_rm_netapp)
+ AZURE_RM_NETAPP = r'''
+options:
+ resource_group:
+ description:
+ - Name of the resource group.
+ required: true
+ type: str
+requirements:
+ - python >= 2.7
+ - azure >= 2.0.0
+ - Python azure-mgmt. Install using 'pip install azure-mgmt'
+ - Python azure-mgmt-netapp. Install using 'pip install azure-mgmt-netapp'
+ - For authentication with Azure NetApp log in before you run your tasks or playbook with C(az login).
+
+notes:
+ - The modules prefixed with azure_rm_netapp are built to support the Cloud Volume Services for Azure NetApp Files.
+
+seealso:
+ - name: Sign in with Azure CLI
+ link: https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest
+ description: How to authenticate using the C(az login) command.
+ '''
diff --git a/ansible_collections/netapp/azure/plugins/module_utils/azure_rm_netapp_common.py b/ansible_collections/netapp/azure/plugins/module_utils/azure_rm_netapp_common.py
new file mode 100644
index 000000000..716e4fb95
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/module_utils/azure_rm_netapp_common.py
@@ -0,0 +1,156 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+
+# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+'''
+azure_rm_netapp_common
+Wrapper around AzureRMModuleBase base class
+'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import sys
+
+HAS_AZURE_COLLECTION = True
+NEW_STYLE = None
+COLLECTION_VERSION = "21.10.0"
+IMPORT_ERRORS = []
+SDK_VERSION = "0.0.0"
+
+if 'pytest' in sys.modules:
+ from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import AzureRMModuleBaseMock as AzureRMModuleBase
+else:
+ try:
+ from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
+ except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+ HAS_AZURE_COLLECTION = False
+ except SyntaxError as exc:
+ # importing Azure collection fails with python 2.6
+ if sys.version_info < (2, 8):
+ IMPORT_ERRORS.append(str(exc))
+ from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import AzureRMModuleBaseMock as AzureRMModuleBase
+ HAS_AZURE_COLLECTION = False
+ else:
+ raise
+
+try:
+ from azure.mgmt.netapp import NetAppManagementClient # 1.0.0 or newer
+ NEW_STYLE = True
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+ try:
+ from azure.mgmt.netapp import AzureNetAppFilesManagementClient # 0.10.0 or older
+ NEW_STYLE = False
+ except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+try:
+ from azure.mgmt.netapp import VERSION as SDK_VERSION
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+
+class AzureRMNetAppModuleBase(AzureRMModuleBase):
+ ''' Wrapper around AzureRMModuleBase base class '''
+ def __init__(self, derived_arg_spec, required_if=None, supports_check_mode=False, supports_tags=True):
+ self._netapp_client = None
+ self._new_style = NEW_STYLE
+ self._sdk_version = SDK_VERSION
+ super(AzureRMNetAppModuleBase, self).__init__(derived_arg_spec=derived_arg_spec,
+ required_if=required_if,
+ supports_check_mode=supports_check_mode,
+ supports_tags=supports_tags)
+ if not HAS_AZURE_COLLECTION:
+ self.fail_when_import_errors(IMPORT_ERRORS)
+
+ def get_mgmt_svc_client(self, client_type, base_url=None, api_version=None):
+ if not self._new_style:
+ return super(AzureRMNetAppModuleBase, self).get_mgmt_svc_client(client_type, base_url, api_version)
+ self.log('Getting management service client NetApp {0}'.format(client_type.__name__))
+ self.check_client_version(client_type)
+
+ if not base_url:
+ # most things are resource_manager, don't make everyone specify
+ base_url = self.azure_auth._cloud_environment.endpoints.resource_manager
+
+ client_kwargs = dict(credential=self.azure_auth.azure_credentials, subscription_id=self.azure_auth.subscription_id, base_url=base_url)
+
+ return client_type(**client_kwargs)
+
+ @property
+ def netapp_client(self):
+ self.log('Getting netapp client')
+ if self._new_style is None:
+ # note that we always have at least one import error
+ self.fail_when_import_errors(IMPORT_ERRORS)
+ if self._netapp_client is None:
+ if self._new_style:
+ self._netapp_client = self.get_mgmt_svc_client(NetAppManagementClient)
+ else:
+ self._netapp_client = self.get_mgmt_svc_client(AzureNetAppFilesManagementClient,
+ base_url=self._cloud_environment.endpoints.resource_manager,
+ api_version='2018-05-01')
+ return self._netapp_client
+
+ @property
+ def new_style(self):
+ return self._new_style
+
+ @property
+ def sdk_version(self):
+ return self._sdk_version
+
+ def get_method(self, category, name):
+ try:
+ methods = getattr(self.netapp_client, category)
+ except AttributeError as exc:
+ self.module.fail_json('Error: category %s not found for netapp_client: %s' % (category, str(exc)))
+
+ if self._new_style:
+ name = 'begin_' + name
+ try:
+ method = getattr(methods, name)
+ except AttributeError as exc:
+ self.module.fail_json('Error: method %s not found for netapp_client category: %s - %s' % (name, category, str(exc)))
+ return method
+
+ def fail_when_import_errors(self, import_errors, has_azure_mgmt_netapp=True):
+ if has_azure_mgmt_netapp and not import_errors:
+ return
+ msg = ''
+ if not has_azure_mgmt_netapp:
+ msg = "The python azure-mgmt-netapp package is required. "
+ if hasattr(self, 'module'):
+ msg += 'Import errors: %s' % str(import_errors)
+ self.module.fail_json(msg=msg)
+ msg += str(import_errors)
+ raise ImportError(msg)
+
+ def has_feature(self, feature_name):
+ feature = self.get_feature(feature_name)
+ if isinstance(feature, bool):
+ return feature
+ self.module.fail_json(msg="Error: expected bool type for feature flag: %s" % feature_name)
+
+ def get_feature(self, feature_name):
+ ''' if the user has configured the feature, use it
+ otherwise, use our default
+ '''
+ default_flags = dict(
+ # TODO: review need for these
+ # trace_apis=False, # if true, append REST requests/responses to /tmp/azure_apis.log
+ # check_required_params_for_none=True,
+ # deprecation_warning=True,
+ # show_modified=True,
+ #
+ # preview features in ANF
+ ignore_change_ownership_mode=True
+ )
+
+ if self.parameters.get('feature_flags') is not None and feature_name in self.parameters['feature_flags']:
+ return self.parameters['feature_flags'][feature_name]
+ if feature_name in default_flags:
+ return default_flags[feature_name]
+ self.module.fail_json(msg="Internal error: unexpected feature flag: %s" % feature_name)
diff --git a/ansible_collections/netapp/azure/plugins/module_utils/netapp_module.py b/ansible_collections/netapp/azure/plugins/module_utils/netapp_module.py
new file mode 100644
index 000000000..9ee758c01
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/module_utils/netapp_module.py
@@ -0,0 +1,271 @@
+# This code is part of Ansible, but is an independent component.
+# This particular file snippet, and this file snippet only, is BSD licensed.
+# Modules you write using this snippet, which is embedded dynamically by Ansible
+# still belong to the author of the module, and may assign their own license
+# to the complete work.
+#
+# Copyright (c) 2018, Laurent Nicolas <laurentn@netapp.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+''' Support class for NetApp ansible modules '''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible.module_utils import basic
+
+
+class AzureRMModuleBaseMock():
+ ''' Mock for sanity tests when azcollection is not installed '''
+ def __init__(self, derived_arg_spec, required_if=None, supports_check_mode=False, supports_tags=True, **kwargs):
+ if supports_tags:
+ derived_arg_spec.update(dict(tags=dict()))
+ self.module = basic.AnsibleModule(
+ argument_spec=derived_arg_spec,
+ required_if=required_if,
+ supports_check_mode=supports_check_mode
+ )
+ self.module.warn('Running in Unit Test context!')
+ # the following is done in exec_module()
+ self.parameters = dict([item for item in self.module.params.items() if item[1] is not None])
+ # remove values with a default of None (not required)
+ self.module_arg_spec = dict([item for item in self.module_arg_spec.items() if item[0] in self.parameters])
+
+ def update_tags(self, tags):
+ self.module.log('update_tags called with:', tags)
+ return None, None
+
+
+def cmp(obj1, obj2):
+ """
+ Python 3 does not have a cmp function, this will do the cmp.
+ :param a: first object to check
+ :param b: second object to check
+ :return:
+ """
+ # convert to lower case for string comparison.
+ if obj1 is None:
+ return -1
+ if isinstance(obj1, str) and isinstance(obj2, str):
+ obj1 = obj1.lower()
+ obj2 = obj2.lower()
+ # if list has string element, convert string to lower case.
+ if isinstance(obj1, list) and isinstance(obj2, list):
+ obj1 = [x.lower() if isinstance(x, str) else x for x in obj1]
+ obj2 = [x.lower() if isinstance(x, str) else x for x in obj2]
+ obj1.sort()
+ obj2.sort()
+ if isinstance(obj1, dict) and isinstance(obj2, dict):
+ return 0 if obj1 == obj2 else 1
+ return (obj1 > obj2) - (obj1 < obj2)
+
+
+class NetAppModule():
+ '''
+ Common class for NetApp modules
+ set of support functions to derive actions based
+ on the current state of the system, and a desired state
+ '''
+
+ def __init__(self):
+ self.log = []
+ self.changed = False
+ self.parameters = {'name': 'not intialized'}
+ self.zapi_string_keys = dict()
+ self.zapi_bool_keys = dict()
+ self.zapi_list_keys = {}
+ self.zapi_int_keys = {}
+ self.zapi_required = {}
+
+ def set_parameters(self, ansible_params):
+ self.parameters = {}
+ for param in ansible_params:
+ if ansible_params[param] is not None:
+ self.parameters[param] = ansible_params[param]
+ return self.parameters
+
+ def get_cd_action(self, current, desired):
+ ''' takes a desired state and a current state, and return an action:
+ create, delete, None
+ eg:
+ is_present = 'absent'
+ some_object = self.get_object(source)
+ if some_object is not None:
+ is_present = 'present'
+ action = cd_action(current=is_present, desired = self.desired.state())
+ '''
+ desired_state = desired['state'] if 'state' in desired else 'present'
+ if current is None and desired_state == 'absent':
+ return None
+ if current is not None and desired_state == 'present':
+ return None
+ # change in state
+ self.changed = True
+ if current is not None:
+ return 'delete'
+ return 'create'
+
+ def compare_and_update_values(self, current, desired, keys_to_compare):
+ updated_values = {}
+ is_changed = False
+ for key in keys_to_compare:
+ if key in current:
+ if key in desired and desired[key] is not None:
+ if current[key] != desired[key]:
+ updated_values[key] = desired[key]
+ is_changed = True
+ else:
+ updated_values[key] = current[key]
+ else:
+ updated_values[key] = current[key]
+
+ return updated_values, is_changed
+
+ @staticmethod
+ def check_keys(current, desired):
+ ''' TODO: raise an error if keys do not match
+ with the exception of:
+ new_name, state in desired
+ '''
+
+ @staticmethod
+ def compare_lists(current, desired, get_list_diff):
+ ''' compares two lists and return a list of elements that are either the desired elements or elements that are
+ modified from the current state depending on the get_list_diff flag
+ :param: current: current item attribute in ONTAP
+ :param: desired: attributes from playbook
+ :param: get_list_diff: specifies whether to have a diff of desired list w.r.t current list for an attribute
+ :return: list of attributes to be modified
+ :rtype: list
+ '''
+ desired_diff_list = [item for item in desired if item not in current] # get what in desired and not in current
+ current_diff_list = [item for item in current if item not in desired] # get what in current but not in desired
+
+ if desired_diff_list or current_diff_list:
+ # there are changes
+ if get_list_diff:
+ return desired_diff_list
+ else:
+ return desired
+ else:
+ return []
+
+ def get_modified_attributes(self, current, desired, get_list_diff=False):
+ ''' takes two dicts of attributes and return a dict of attributes that are
+ not in the current state
+ It is expected that all attributes of interest are listed in current and
+ desired.
+ :param: current: current attributes in ONTAP
+ :param: desired: attributes from playbook
+ :param: get_list_diff: specifies whether to have a diff of desired list w.r.t current list for an attribute
+ :return: dict of attributes to be modified
+ :rtype: dict
+
+ NOTE: depending on the attribute, the caller may need to do a modify or a
+ different operation (eg move volume if the modified attribute is an
+ aggregate name)
+ '''
+ # if the object does not exist, we can't modify it
+ modified = {}
+ if current is None:
+ return modified
+
+ # error out if keys do not match
+ self.check_keys(current, desired)
+
+ # collect changed attributes
+ for key, value in current.items():
+ if key in desired and desired[key] is not None:
+ if isinstance(value, list):
+ modified_list = self.compare_lists(value, desired[key], get_list_diff) # get modified list from current and desired
+ if modified_list:
+ modified[key] = modified_list
+ elif cmp(value, desired[key]) != 0:
+ modified[key] = desired[key]
+ if modified:
+ self.changed = True
+ return modified
+
+ def is_rename_action(self, source, target):
+ ''' takes a source and target object, and returns True
+ if a rename is required
+ eg:
+ source = self.get_object(source_name)
+ target = self.get_object(target_name)
+ action = is_rename_action(source, target)
+ :return: None for error, True for rename action, False otherwise
+ '''
+ if source is None and target is None:
+ # error, do nothing
+ # cannot rename an non existent resource
+ # alternatively we could create B
+ return None
+ if source is not None and target is not None:
+ # error, do nothing
+ # idempotency (or) new_name_is_already_in_use
+ # alternatively we could delete B and rename A to B
+ return False
+ if source is None:
+ # do nothing, maybe the rename was already done
+ return False
+ # source is not None and target is None:
+ # rename is in order
+ self.changed = True
+ return True
+
+ def filter_out_none_entries(self, list_or_dict):
+ """take a dict or list as input and return a dict/list without keys/elements whose values are None
+ skip empty dicts or lists.
+ """
+
+ if isinstance(list_or_dict, dict):
+ result = {}
+ for key, value in list_or_dict.items():
+ if isinstance(value, (list, dict)):
+ sub = self.filter_out_none_entries(value)
+ if sub:
+ # skip empty dict or list
+ result[key] = sub
+ elif value is not None:
+ # skip None value
+ result[key] = value
+ return result
+
+ if isinstance(list_or_dict, list):
+ alist = []
+ for item in list_or_dict:
+ if isinstance(item, (list, dict)):
+ sub = self.filter_out_none_entries(item)
+ if sub:
+ # skip empty dict or list
+ alist.append(sub)
+ elif item is not None:
+ # skip None value
+ alist.append(item)
+ return alist
+
+ raise TypeError('unexpected type %s' % type(list_or_dict))
+
+ @staticmethod
+ def get_not_none_values_from_dict(parameters, keys):
+ # python 2.6 does not support dict comprehension using k: v
+ return dict((key, value) for key, value in parameters.items() if key in keys and value is not None)
diff --git a/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_account.py b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_account.py
new file mode 100644
index 000000000..c09ade0df
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_account.py
@@ -0,0 +1,404 @@
+#!/usr/bin/python
+#
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+
+# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+'''
+azure_rm_netapp_account
+'''
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+DOCUMENTATION = '''
+---
+module: azure_rm_netapp_account
+
+short_description: Manage NetApp Azure Files Account
+version_added: 19.10.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+
+description:
+ - Create and delete NetApp Azure account.
+ Provide the Resource group name for the NetApp account to be created.
+extends_documentation_fragment:
+ - netapp.azure.azure
+ - netapp.azure.azure_tags
+ - netapp.azure.netapp.azure_rm_netapp
+
+options:
+ name:
+ description:
+ - The name of the NetApp account.
+ required: true
+ type: str
+ location:
+ description:
+ - Resource location.
+ - Required for create.
+ type: str
+
+ active_directories:
+ description:
+ - list of active directory dictionaries.
+ - The list is currently limited to a single active directory (ANF or Azure limit of one AD per subscription).
+ type: list
+ elements: dict
+ version_added: 21.2.0
+ suboptions:
+ active_directory_id:
+ description: not used for create. Not needed for join.
+ type: str
+ dns:
+ description: list of DNS addresses. Required for create or join.
+ type: list
+ elements: str
+ domain:
+ description: Fully Qualified Active Directory DNS Domain Name. Required for create or join.
+ type: str
+ site:
+ description: The Active Directory site the service will limit Domain Controller discovery to.
+ type: str
+ smb_server_name:
+ description: Prefix for creating the SMB server's computer account name in the Active Directory domain. Required for create or join.
+ type: str
+ organizational_unit:
+ description: LDAP Path for the Organization Unit where SMB Server machine accounts will be created (i.e. OU=SecondLevel,OU=FirstLevel).
+ type: str
+ username:
+ description: Credentials that have permissions to create SMB server machine account in the AD domain. Required for create or join.
+ type: str
+ password:
+ description: see username. If password is present, the module is not idempotent, as we cannot check the current value. Required for create or join.
+ type: str
+ aes_encryption:
+ description: If enabled, AES encryption will be enabled for SMB communication.
+ type: bool
+ ldap_signing:
+ description: Specifies whether or not the LDAP traffic needs to be signed.
+ type: bool
+ ad_name:
+ description: Name of the active directory machine. Used only while creating kerberos volume.
+ type: str
+ version_added: 21.3.0
+ kdc_ip:
+ description: kdc server IP addresses for the active directory machine. Used only while creating kerberos volume.
+ type: str
+ version_added: 21.3.0
+ server_root_ca_certificate:
+ description:
+ - When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's
+ self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes.
+ type: str
+ version_added: 21.3.0
+ state:
+ description:
+ - State C(present) will check that the NetApp account exists with the requested configuration.
+ - State C(absent) will delete the NetApp account.
+ default: present
+ choices:
+ - absent
+ - present
+ type: str
+ debug:
+ description: output details about current account if it exists.
+ type: bool
+ default: false
+
+'''
+EXAMPLES = '''
+
+- name: Create NetApp Azure Account
+ netapp.azure.azure_rm_netapp_account:
+ resource_group: myResourceGroup
+ name: testaccount
+ location: eastus
+ tags: {'abc': 'xyz', 'cba': 'zyx'}
+
+- name: Modify Azure NetApp account (Join AD)
+ netapp.azure.azure_rm_netapp_account:
+ resource_group: myResourceGroup
+ name: testaccount
+ location: eastus
+ active_directories:
+ - site: ln
+ dns: 10.10.10.10
+ domain: domain.com
+ smb_server_name: dummy
+ password: xxxxxx
+ username: laurentn
+
+- name: Delete NetApp Azure Account
+ netapp.azure.azure_rm_netapp_account:
+ state: absent
+ resource_group: myResourceGroup
+ name: testaccount
+ location: eastus
+
+- name: Create Azure NetApp account (with AD)
+ netapp.azure.azure_rm_netapp_account:
+ resource_group: laurentngroupnodash
+ name: tests-netapp11
+ location: eastus
+ tags:
+ creator: laurentn
+ use: Ansible
+ active_directories:
+ - site: ln
+ dns: 10.10.10.10
+ domain: domain.com
+ smb_server_name: dummy
+ password: xxxxxx
+ username: laurentn
+'''
+
+RETURN = '''
+'''
+
+import traceback
+
+HAS_AZURE_MGMT_NETAPP = False
+IMPORT_ERRORS = list()
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.core.exceptions import AzureError, ResourceNotFoundError
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+try:
+ from azure.mgmt.netapp.models import NetAppAccount, NetAppAccountPatch, ActiveDirectory
+ HAS_AZURE_MGMT_NETAPP = True
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+from ansible.module_utils.basic import to_native
+from ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common import AzureRMNetAppModuleBase
+from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import NetAppModule
+
+
+class AzureRMNetAppAccount(AzureRMNetAppModuleBase):
+ ''' create, modify, delete account, including joining AD domain
+ '''
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ location=dict(type='str', required=False),
+ state=dict(choices=['present', 'absent'], default='present', type='str'),
+ active_directories=dict(type='list', elements='dict', options=dict(
+ active_directory_id=dict(type='str'),
+ dns=dict(type='list', elements='str'),
+ domain=dict(type='str'),
+ site=dict(type='str'),
+ smb_server_name=dict(type='str'),
+ organizational_unit=dict(type='str'),
+ username=dict(type='str'),
+ password=dict(type='str', no_log=True),
+ aes_encryption=dict(type='bool'),
+ ldap_signing=dict(type='bool'),
+ ad_name=dict(type='str'),
+ kdc_ip=dict(type='str'),
+ server_root_ca_certificate=dict(type='str', no_log=True),
+ )),
+ debug=dict(type='bool', default=False)
+ )
+
+ self.na_helper = NetAppModule()
+ self.parameters = dict()
+ self.debug = list()
+ self.warnings = list()
+
+ # import errors are handled in AzureRMModuleBase
+ super(AzureRMNetAppAccount, self).__init__(derived_arg_spec=self.module_arg_spec,
+ required_if=[('state', 'present', ['location'])],
+ supports_check_mode=True)
+
+ def get_azure_netapp_account(self):
+ """
+ Returns NetApp Account object for an existing account
+ Return None if account does not exist
+ """
+ try:
+ account_get = self.netapp_client.accounts.get(self.parameters['resource_group'], self.parameters['name'])
+ except (CloudError, ResourceNotFoundError): # account does not exist
+ return None
+ account = vars(account_get)
+ ads = None
+ if account.get('active_directories') is not None:
+ ads = list()
+ for each_ad in account.get('active_directories'):
+ ad_dict = vars(each_ad)
+ dns = ad_dict.get('dns')
+ if dns is not None:
+ ad_dict['dns'] = sorted(dns.split(','))
+ ads.append(ad_dict)
+ account['active_directories'] = ads
+ return account
+
+ def create_account_request_body(self, modify=None):
+ """
+ Create an Azure NetApp Account Request Body
+ :return: None
+ """
+ options = dict()
+ location = None
+ for attr in ('location', 'tags', 'active_directories'):
+ value = self.parameters.get(attr)
+ if attr == 'location' and modify is None:
+ location = value
+ continue
+ if value is not None:
+ if modify is None or attr in modify:
+ if attr == 'active_directories':
+ ads = list()
+ for ad_dict in value:
+ if ad_dict.get('dns') is not None:
+ # API expects a string of comma separated elements
+ ad_dict['dns'] = ','.join(ad_dict['dns'])
+ ads.append(ActiveDirectory(**self.na_helper.filter_out_none_entries(ad_dict)))
+ value = ads
+ options[attr] = value
+ if modify is None:
+ if location is None:
+ self.module.fail_json(msg="Error: 'location' is a required parameter")
+ return NetAppAccount(location=location, **options)
+ return NetAppAccountPatch(**options)
+
+ def create_azure_netapp_account(self):
+ """
+ Create an Azure NetApp Account
+ :return: None
+ """
+ account_body = self.create_account_request_body()
+ try:
+ response = self.get_method('accounts', 'create_or_update')(body=account_body,
+ resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['name'])
+ while response.done() is not True:
+ response.result(10)
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error creating Azure NetApp account %s: %s'
+ % (self.parameters['name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def update_azure_netapp_account(self, modify):
+ """
+ Create an Azure NetApp Account
+ :return: None
+ """
+ account_body = self.create_account_request_body(modify)
+ try:
+ response = self.get_method('accounts', 'update')(body=account_body,
+ resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['name'])
+ while response.done() is not True:
+ response.result(10)
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error creating Azure NetApp account %s: %s'
+ % (self.parameters['name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def delete_azure_netapp_account(self):
+ """
+ Delete an Azure NetApp Account
+ :return: None
+ """
+ try:
+ response = self.get_method('accounts', 'delete')(resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['name'])
+ while response.done() is not True:
+ response.result(10)
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error deleting Azure NetApp account %s: %s'
+ % (self.parameters['name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def get_changes_in_ads(self, current, desired):
+ c_ads = current.get('active_directories')
+ d_ads = desired.get('active_directories')
+ if not c_ads:
+ return desired.get('active_directories'), None
+ if not d_ads:
+ return None, current.get('active_directories')
+ if len(c_ads) > 1 or len(d_ads) > 1:
+ msg = 'Error checking for AD, currently only one AD is supported.'
+ if len(c_ads) > 1:
+ msg += ' Current: %s.' % str(c_ads)
+ if len(d_ads) > 1:
+ msg += ' Desired: %s.' % str(d_ads)
+ self.module.fail_json(msg='Error checking for AD, currently only one AD is supported')
+ changed = False
+ d_ad = d_ads[0]
+ c_ad = c_ads[0]
+ for key, value in c_ad.items():
+ if key == 'password':
+ if d_ad.get(key) is None:
+ continue
+ self.warnings.append("module is not idempotent if 'password:' is present")
+ if d_ad.get(key) is None:
+ d_ad[key] = value
+ elif d_ad.get(key) != value:
+ changed = True
+ self.debug.append("key: %s, value %s" % (key, value))
+ if changed:
+ return [d_ad], None
+ return None, None
+
+ def exec_module(self, **kwargs):
+
+ # unlikely
+ self.fail_when_import_errors(IMPORT_ERRORS, HAS_AZURE_MGMT_NETAPP)
+
+ # set up parameters according to our initial list
+ for key in list(self.module_arg_spec):
+ self.parameters[key] = kwargs[key]
+ # and common parameter
+ for key in ['tags']:
+ if key in kwargs:
+ self.parameters[key] = kwargs[key]
+
+ current = self.get_azure_netapp_account()
+ modify = None
+ cd_action = self.na_helper.get_cd_action(current, self.parameters)
+ self.debug.append('current: %s' % str(current))
+ if current is not None and cd_action is None:
+ ads_to_add, ads_to_delete = self.get_changes_in_ads(current, self.parameters)
+ self.parameters.pop('active_directories', None)
+ if ads_to_add:
+ self.parameters['active_directories'] = ads_to_add
+ if ads_to_delete:
+ self.module.fail_json(msg="Error: API does not support unjoining an AD", debug=self.debug)
+ modify = self.na_helper.get_modified_attributes(current, self.parameters)
+ if 'tags' in modify:
+ dummy, modify['tags'] = self.update_tags(current.get('tags'))
+
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ pass
+ else:
+ if cd_action == 'create':
+ self.create_azure_netapp_account()
+ elif cd_action == 'delete':
+ self.delete_azure_netapp_account()
+ elif modify:
+ self.update_azure_netapp_account(modify)
+ results = dict(
+ changed=self.na_helper.changed,
+ modify=modify
+ )
+ if self.warnings:
+ results['warnings'] = self.warnings
+ if self.parameters['debug']:
+ results['debug'] = self.debug
+ self.module.exit_json(**results)
+
+
+def main():
+ AzureRMNetAppAccount()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_capacity_pool.py b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_capacity_pool.py
new file mode 100644
index 000000000..9d099a03f
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_capacity_pool.py
@@ -0,0 +1,259 @@
+#!/usr/bin/python
+#
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+
+# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+"""
+azure_rm_netapp_capacity_pool
+"""
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+DOCUMENTATION = '''
+---
+module: azure_rm_netapp_capacity_pool
+
+short_description: Manage NetApp Azure Files capacity pool
+version_added: 19.10.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+
+description:
+ - Create and delete NetApp Azure capacity pool.
+ Provide the Resource group name for the capacity pool to be created.
+ - Resize NetApp Azure capacity pool
+extends_documentation_fragment:
+ - netapp.azure.azure
+ - netapp.azure.azure_tags
+ - netapp.azure.netapp.azure_rm_netapp
+
+options:
+ name:
+ description:
+ - The name of the capacity pool.
+ required: true
+ type: str
+ account_name:
+ description:
+ - The name of the NetApp account.
+ required: true
+ type: str
+ location:
+ description:
+ - Resource location.
+ - Required for create.
+ type: str
+ size:
+ description:
+ - Provisioned size of the pool (in chunks). Allowed values are in 4TiB chunks.
+ - Provide number to be multiplied to 4TiB.
+ - Required for create.
+ default: 1
+ type: int
+ service_level:
+ description:
+ - The service level of the file system.
+ - Required for create.
+ choices: ['Standard', 'Premium', 'Ultra']
+ type: str
+ version_added: "20.5.0"
+ state:
+ description:
+ - State C(present) will check that the capacity pool exists with the requested configuration.
+ - State C(absent) will delete the capacity pool.
+ default: present
+ choices: ['present', 'absent']
+ type: str
+
+'''
+EXAMPLES = '''
+
+- name: Create Azure NetApp capacity pool
+ netapp.azure.azure_rm_netapp_capacity_pool:
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ name: tests-pool
+ location: eastus
+ size: 2
+ service_level: Standard
+
+- name: Resize Azure NetApp capacity pool
+ netapp.azure.azure_rm_netapp_capacity_pool:
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ name: tests-pool
+ location: eastus
+ size: 3
+ service_level: Standard
+
+- name: Delete Azure NetApp capacity pool
+ netapp.azure.azure_rm_netapp_capacity_pool:
+ state: absent
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ name: tests-pool
+
+'''
+
+RETURN = '''
+'''
+
+import traceback
+
+AZURE_OBJECT_CLASS = 'NetAppAccount'
+HAS_AZURE_MGMT_NETAPP = False
+IMPORT_ERRORS = list()
+SIZE_POOL = 4398046511104
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.core.exceptions import AzureError, ResourceNotFoundError
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+try:
+ from azure.mgmt.netapp.models import CapacityPool
+ HAS_AZURE_MGMT_NETAPP = True
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+from ansible.module_utils.basic import to_native
+from ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common import AzureRMNetAppModuleBase
+from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import NetAppModule
+
+
+class AzureRMNetAppCapacityPool(AzureRMNetAppModuleBase):
+ """ create, modify, delete a capacity pool """
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ account_name=dict(type='str', required=True),
+ location=dict(type='str', required=False),
+ state=dict(choices=['present', 'absent'], default='present', type='str'),
+ size=dict(type='int', required=False, default=1),
+ service_level=dict(type='str', required=False, choices=['Standard', 'Premium', 'Ultra']),
+ )
+
+ self.na_helper = NetAppModule()
+ self.parameters = dict()
+
+ # import errors are handled in AzureRMModuleBase
+ super(AzureRMNetAppCapacityPool, self).__init__(derived_arg_spec=self.module_arg_spec,
+ required_if=[('state', 'present', ['location', 'service_level'])],
+ supports_check_mode=True)
+
+ def get_azure_netapp_capacity_pool(self):
+ """
+ Returns capacity pool object for an existing pool
+ Return None if capacity pool does not exist
+ """
+ try:
+ capacity_pool_get = self.netapp_client.pools.get(self.parameters['resource_group'],
+ self.parameters['account_name'], self.parameters['name'])
+ except (CloudError, ResourceNotFoundError): # capacity pool does not exist
+ return None
+ return capacity_pool_get
+
+ def create_azure_netapp_capacity_pool(self):
+ """
+ Create a capacity pool for the given Azure NetApp Account
+ :return: None
+ """
+ options = self.na_helper.get_not_none_values_from_dict(self.parameters, ['location', 'service_level', 'size', 'tags'])
+ capacity_pool_body = CapacityPool(**options)
+ try:
+ response = self.get_method('pools', 'create_or_update')(body=capacity_pool_body, resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['name'])
+ while response.done() is not True:
+ response.result(10)
+
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error creating capacity pool %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def modify_azure_netapp_capacity_pool(self, modify):
+ """
+ Modify a capacity pool for the given Azure NetApp Account
+ :return: None
+ """
+ options = self.na_helper.get_not_none_values_from_dict(self.parameters, ['location', 'service_level', 'size', 'tags'])
+ capacity_pool_body = CapacityPool(**options)
+ try:
+ response = self.get_method('pools', 'update')(body=capacity_pool_body, resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['name'])
+ while response.done() is not True:
+ response.result(10)
+
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error modifying capacity pool %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def delete_azure_netapp_capacity_pool(self):
+ """
+ Delete a capacity pool for the given Azure NetApp Account
+ :return: None
+ """
+ try:
+ response = self.get_method('pools', 'delete')(resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'], pool_name=self.parameters['name'])
+ while response.done() is not True:
+ response.result(10)
+
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error deleting capacity pool %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def exec_module(self, **kwargs):
+
+ # unlikely
+ self.fail_when_import_errors(IMPORT_ERRORS, HAS_AZURE_MGMT_NETAPP)
+
+ # set up parameters according to our initial list
+ for key in list(self.module_arg_spec):
+ self.parameters[key] = kwargs[key]
+ # and common parameter
+ for key in ['tags']:
+ if key in kwargs:
+ self.parameters[key] = kwargs[key]
+ if 'size' in self.parameters:
+ self.parameters['size'] *= SIZE_POOL
+
+ modify = {}
+ current = self.get_azure_netapp_capacity_pool()
+ cd_action = self.na_helper.get_cd_action(current, self.parameters)
+ if cd_action is None and self.parameters['state'] == 'present':
+ current = vars(current)
+ # get_azure_netapp_capacity_pool() returns pool name with account name appended in front of it like 'account/pool'
+ current['name'] = self.parameters['name']
+ modify = self.na_helper.get_modified_attributes(current, self.parameters)
+ if 'tags' in modify:
+ dummy, modify['tags'] = self.update_tags(current.get('tags'))
+
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ pass
+ else:
+ if cd_action == 'create':
+ self.create_azure_netapp_capacity_pool()
+ elif cd_action == 'delete':
+ self.delete_azure_netapp_capacity_pool()
+ elif modify:
+ self.modify_azure_netapp_capacity_pool(modify)
+
+ self.module.exit_json(changed=self.na_helper.changed, modify=modify)
+
+
+def main():
+ AzureRMNetAppCapacityPool()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_snapshot.py b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_snapshot.py
new file mode 100644
index 000000000..212f10861
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_snapshot.py
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+#
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+
+# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+"""
+azure_rm_netapp_snapshot
+"""
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+DOCUMENTATION = '''
+---
+module: azure_rm_netapp_snapshot
+
+short_description: Manage NetApp Azure Files Snapshot
+version_added: 19.10.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+
+description:
+ - Create and delete NetApp Azure Snapshot.
+extends_documentation_fragment:
+ - netapp.azure.azure
+ - netapp.azure.netapp.azure_rm_netapp
+
+options:
+ name:
+ description:
+ - The name of the snapshot.
+ required: true
+ type: str
+ volume_name:
+ description:
+ - The name of the volume.
+ required: true
+ type: str
+ pool_name:
+ description:
+ - The name of the capacity pool.
+ required: true
+ type: str
+ account_name:
+ description:
+ - The name of the NetApp account.
+ required: true
+ type: str
+ location:
+ description:
+ - Resource location.
+ - Required for create.
+ type: str
+ state:
+ description:
+ - State C(present) will check that the snapshot exists with the requested configuration.
+ - State C(absent) will delete the snapshot.
+ default: present
+ choices:
+ - absent
+ - present
+ type: str
+
+'''
+EXAMPLES = '''
+
+- name: Create Azure NetApp Snapshot
+ netapp.azure.azure_rm_netapp_snapshot:
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ pool_name: tests-pool
+ volume_name: tests-volume2
+ name: tests-snapshot
+ location: eastus
+
+- name: Delete Azure NetApp Snapshot
+ netapp.azure.azure_rm_netapp_snapshot:
+ state: absent
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ pool_name: tests-pool
+ volume_name: tests-volume2
+ name: tests-snapshot
+
+'''
+
+RETURN = '''
+'''
+
+import traceback
+
+AZURE_OBJECT_CLASS = 'NetAppAccount'
+HAS_AZURE_MGMT_NETAPP = False
+IMPORT_ERRORS = list()
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from azure.core.exceptions import AzureError, ResourceNotFoundError
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+try:
+ from azure.mgmt.netapp.models import Snapshot
+ HAS_AZURE_MGMT_NETAPP = True
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+from ansible.module_utils.basic import to_native
+from ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common import AzureRMNetAppModuleBase
+from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import NetAppModule
+
+
+class AzureRMNetAppSnapshot(AzureRMNetAppModuleBase):
+ """ crate or delete snapshots """
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ volume_name=dict(type='str', required=True),
+ pool_name=dict(type='str', required=True),
+ account_name=dict(type='str', required=True),
+ location=dict(type='str', required=False),
+ state=dict(choices=['present', 'absent'], default='present', type='str')
+ )
+ self.na_helper = NetAppModule()
+ self.parameters = dict()
+
+ # import errors are handled in AzureRMModuleBase
+ super(AzureRMNetAppSnapshot, self).__init__(derived_arg_spec=self.module_arg_spec,
+ required_if=[('state', 'present', ['location'])],
+ supports_check_mode=True,
+ supports_tags=False)
+
+ def get_azure_netapp_snapshot(self):
+ """
+ Returns snapshot object for an existing snapshot
+ Return None if snapshot does not exist
+ """
+ try:
+ snapshot_get = self.netapp_client.snapshots.get(self.parameters['resource_group'], self.parameters['account_name'],
+ self.parameters['pool_name'], self.parameters['volume_name'],
+ self.parameters['name'])
+ except (CloudError, ResourceNotFoundError): # snapshot does not exist
+ return None
+ return snapshot_get
+
+ def create_azure_netapp_snapshot(self):
+ """
+ Create a snapshot for the given Azure NetApp Account
+ :return: None
+ """
+ kw_args = dict(
+ resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['pool_name'],
+ volume_name=self.parameters['volume_name'],
+ snapshot_name=self.parameters['name']
+ )
+ if self.new_style:
+ kw_args['body'] = Snapshot(
+ location=self.parameters['location']
+ )
+ else:
+ kw_args['location'] = self.parameters['location']
+ try:
+ result = self.get_method('snapshots', 'create')(**kw_args)
+ # waiting till the status turns Succeeded
+ while result.done() is not True:
+ result.result(10)
+
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error creating snapshot %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def delete_azure_netapp_snapshot(self):
+ """
+ Delete a snapshot for the given Azure NetApp Account
+ :return: None
+ """
+ try:
+ result = self.get_method('snapshots', 'delete')(resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['pool_name'],
+ volume_name=self.parameters['volume_name'],
+ snapshot_name=self.parameters['name'])
+ # waiting till the status turns Succeeded
+ while result.done() is not True:
+ result.result(10)
+
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error deleting snapshot %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def exec_module(self, **kwargs):
+
+ # unlikely
+ self.fail_when_import_errors(IMPORT_ERRORS, HAS_AZURE_MGMT_NETAPP)
+
+ # set up parameters according to our initial list
+ for key in list(self.module_arg_spec):
+ self.parameters[key] = kwargs[key]
+
+ current = self.get_azure_netapp_snapshot()
+ cd_action = self.na_helper.get_cd_action(current, self.parameters)
+
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ pass
+ else:
+ if cd_action == 'create':
+ self.create_azure_netapp_snapshot()
+ elif cd_action == 'delete':
+ self.delete_azure_netapp_snapshot()
+
+ self.module.exit_json(changed=self.na_helper.changed)
+
+
+def main():
+ AzureRMNetAppSnapshot()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_volume.py b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_volume.py
new file mode 100644
index 000000000..487787ee7
--- /dev/null
+++ b/ansible_collections/netapp/azure/plugins/modules/azure_rm_netapp_volume.py
@@ -0,0 +1,399 @@
+#!/usr/bin/python
+#
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+
+# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+'''
+azure_rm_netapp_volume
+'''
+
+from __future__ import absolute_import, division, print_function
+__metaclass__ = type
+
+DOCUMENTATION = '''
+---
+module: azure_rm_netapp_volume
+
+short_description: Manage NetApp Azure Files Volume
+version_added: 19.10.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+
+description:
+ - Create and delete NetApp Azure volume.
+extends_documentation_fragment:
+ - netapp.azure.azure
+ - netapp.azure.azure_tags
+ - netapp.azure.netapp.azure_rm_netapp
+
+options:
+ name:
+ description:
+ - The name of the volume.
+ required: true
+ type: str
+ file_path:
+ description:
+ - A unique file path for the volume. Used when creating mount targets.
+ type: str
+ pool_name:
+ description:
+ - The name of the capacity pool.
+ required: true
+ type: str
+ account_name:
+ description:
+ - The name of the NetApp account.
+ required: true
+ type: str
+ location:
+ description:
+ - Resource location.
+ - Required for create.
+ type: str
+ subnet_name:
+ description:
+ - Azure resource name for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes.
+ - Provide name of the subnet ID.
+ - Required for create.
+ type: str
+ aliases: ['subnet_id']
+ version_added: 21.1.0
+ virtual_network:
+ description:
+ - The name of the virtual network required for the subnet to create a volume.
+ - Required for create.
+ type: str
+ service_level:
+ description:
+ - The service level of the file system.
+ - default is Premium.
+ type: str
+ choices: ['Premium', 'Standard', 'Ultra']
+ vnet_resource_group_for_subnet:
+ description:
+ - Only required if virtual_network to be used is of different resource_group.
+ - Name of the resource group for virtual_network and subnet_name to be used.
+ type: str
+ version_added: "20.5.0"
+ size:
+ description:
+ - Provisioned size of the volume (in GiB).
+ - Minimum size is 100 GiB. Upper limit is 100TiB
+ - default is 100GiB.
+ version_added: "20.5.0"
+ type: int
+ protocol_types:
+ description:
+ - Protocol types - NFSv3, NFSv4.1, CIFS (for SMB).
+ type: list
+ elements: str
+ version_added: 21.2.0
+ state:
+ description:
+ - State C(present) will check that the volume exists with the requested configuration.
+ - State C(absent) will delete the volume.
+ default: present
+ choices: ['present', 'absent']
+ type: str
+ feature_flags:
+ description:
+ - Enable or disable a new feature.
+ - This can be used to enable an experimental feature or disable a new feature that breaks backward compatibility.
+ - Supported keys and values are subject to change without notice. Unknown keys are ignored.
+ type: dict
+ version_added: 21.9.0
+notes:
+ - feature_flags is setting ignore_change_ownership_mode to true by default to bypass a 'change ownership mode' issue with azure-mgmt-netapp 4.0.0.
+'''
+EXAMPLES = '''
+
+- name: Create Azure NetApp volume
+ netapp.azure.azure_rm_netapp_volume:
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ pool_name: tests-pool
+ name: tests-volume2
+ location: eastus
+ file_path: tests-volume2
+ virtual_network: myVirtualNetwork
+ vnet_resource_group_for_subnet: myVirtualNetworkResourceGroup
+ subnet_name: test
+ service_level: Ultra
+ size: 100
+
+- name: Delete Azure NetApp volume
+ netapp.azure.azure_rm_netapp_volume:
+ state: absent
+ resource_group: myResourceGroup
+ account_name: tests-netapp
+ pool_name: tests-pool
+ name: tests-volume2
+
+'''
+
+RETURN = '''
+mount_path:
+ description: Returns mount_path of the Volume
+ returned: always
+ type: str
+
+'''
+
+import traceback
+
+AZURE_OBJECT_CLASS = 'NetAppAccount'
+HAS_AZURE_MGMT_NETAPP = False
+IMPORT_ERRORS = []
+ONE_GIB = 1073741824
+
+try:
+ from msrestazure.azure_exceptions import CloudError
+ from msrest.exceptions import ValidationError
+ from azure.core.exceptions import AzureError, ResourceNotFoundError
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+try:
+ from azure.mgmt.netapp.models import Volume, ExportPolicyRule, VolumePropertiesExportPolicy, VolumePatch
+ HAS_AZURE_MGMT_NETAPP = True
+except ImportError as exc:
+ IMPORT_ERRORS.append(str(exc))
+
+from ansible.module_utils.basic import to_native
+from ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common import AzureRMNetAppModuleBase
+from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import NetAppModule
+
+
+class AzureRMNetAppVolume(AzureRMNetAppModuleBase):
+ ''' create or delete a volume '''
+
+ def __init__(self):
+
+ self.module_arg_spec = dict(
+ resource_group=dict(type='str', required=True),
+ name=dict(type='str', required=True),
+ file_path=dict(type='str', required=False),
+ pool_name=dict(type='str', required=True),
+ account_name=dict(type='str', required=True),
+ location=dict(type='str', required=False),
+ state=dict(choices=['present', 'absent'], default='present', type='str'),
+ subnet_name=dict(type='str', required=False, aliases=['subnet_id']),
+ virtual_network=dict(type='str', required=False),
+ size=dict(type='int', required=False),
+ vnet_resource_group_for_subnet=dict(type='str', required=False),
+ service_level=dict(type='str', required=False, choices=['Premium', 'Standard', 'Ultra']),
+ protocol_types=dict(type='list', elements='str'),
+ feature_flags=dict(type='dict')
+ )
+ self.na_helper = NetAppModule()
+ self.parameters = {}
+
+ # import errors are handled in AzureRMModuleBase
+ super(AzureRMNetAppVolume, self).__init__(derived_arg_spec=self.module_arg_spec,
+ required_if=[('state', 'present', ['location', 'file_path', 'subnet_name', 'virtual_network']),
+ ],
+ supports_check_mode=True)
+
+ @staticmethod
+ def dict_from_volume_object(volume_object):
+
+ def replace_list_of_objects_with_list_of_dicts(adict, key):
+ if adict.get(key):
+ adict[key] = [vars(x) for x in adict[key]]
+
+ current_dict = vars(volume_object)
+ attr = 'subnet_id'
+ if attr in current_dict:
+ current_dict['subnet_name'] = current_dict.pop(attr).split('/')[-1]
+ attr = 'mount_targets'
+ replace_list_of_objects_with_list_of_dicts(current_dict, attr)
+ attr = 'export_policy'
+ if current_dict.get(attr):
+ attr_dict = vars(current_dict[attr])
+ replace_list_of_objects_with_list_of_dicts(attr_dict, 'rules')
+ current_dict[attr] = attr_dict
+ return current_dict
+
+ def get_azure_netapp_volume(self):
+ """
+ Returns volume object for an existing volume
+ Return None if volume does not exist
+ """
+ try:
+ volume_get = self.netapp_client.volumes.get(self.parameters['resource_group'], self.parameters['account_name'],
+ self.parameters['pool_name'], self.parameters['name'])
+ except (CloudError, ResourceNotFoundError): # volume does not exist
+ return None
+ return self.dict_from_volume_object(volume_get)
+
+ def get_export_policy_rules(self):
+ # ExportPolicyRule(rule_index: int=None, unix_read_only: bool=None, unix_read_write: bool=None,
+ # kerberos5_read_only: bool=False, kerberos5_read_write: bool=False, kerberos5i_read_only: bool=False,
+ # kerberos5i_read_write: bool=False, kerberos5p_read_only: bool=False, kerberos5p_read_write: bool=False,
+ # cifs: bool=None, nfsv3: bool=None, nfsv41: bool=None, allowed_clients: str=None, has_root_access: bool=True
+ ptypes = self.parameters.get('protocol_types')
+ if ptypes is None:
+ return None
+ ptypes = [x.lower() for x in ptypes]
+ if 'nfsv4.1' in ptypes:
+ ptypes.append('nfsv41')
+ # only create a policy when NFSv4 is used (for now)
+ if 'nfsv41' not in ptypes:
+ return None
+ options = dict(
+ rule_index=1,
+ allowed_clients='0.0.0.0/0',
+ unix_read_write=True)
+ if self.has_feature('ignore_change_ownership_mode') and self.sdk_version >= '4.0.0':
+ # https://github.com/Azure/azure-sdk-for-python/issues/20356
+ options['chown_mode'] = None
+ for protocol in ('cifs', 'nfsv3', 'nfsv41'):
+ options[protocol] = protocol in ptypes
+ return VolumePropertiesExportPolicy(rules=[ExportPolicyRule(**options)])
+
+ def create_azure_netapp_volume(self):
+ """
+ Create a volume for the given Azure NetApp Account
+ :return: None
+ """
+ options = self.na_helper.get_not_none_values_from_dict(self.parameters, ['protocol_types', 'service_level', 'tags', 'usage_threshold'])
+ rules = self.get_export_policy_rules()
+ if rules is not None:
+ # TODO: other options to expose ?
+ # options['throughput_mibps'] = 1.6
+ # options['encryption_key_source'] = 'Microsoft.NetApp'
+ # options['security_style'] = 'Unix'
+ # options['unix_permissions'] = '0770'
+ # required for NFSv4
+ options['export_policy'] = rules
+ subnet_id = '/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s/subnets/%s'\
+ % (self.azure_auth.subscription_id,
+ self.parameters['resource_group'] if self.parameters.get('vnet_resource_group_for_subnet') is None
+ else self.parameters['vnet_resource_group_for_subnet'],
+ self.parameters['virtual_network'],
+ self.parameters['subnet_name'])
+ volume_body = Volume(
+ location=self.parameters['location'],
+ creation_token=self.parameters['file_path'],
+ subnet_id=subnet_id,
+ **options
+ )
+ try:
+ result = self.get_method('volumes', 'create_or_update')(body=volume_body, resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['pool_name'], volume_name=self.parameters['name'])
+ # waiting till the status turns Succeeded
+ while result.done() is not True:
+ result.result(10)
+ except (CloudError, ValidationError, AzureError) as error:
+ self.module.fail_json(msg='Error creating volume %s for Azure NetApp account %s and subnet ID %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], subnet_id, to_native(error)),
+ exception=traceback.format_exc())
+
+ def modify_azure_netapp_volume(self):
+ """
+ Modify a volume for the given Azure NetApp Account
+ :return: None
+ """
+ options = self.na_helper.get_not_none_values_from_dict(self.parameters, ['tags', 'usage_threshold'])
+ volume_body = VolumePatch(
+ **options
+ )
+ try:
+ result = self.get_method('volumes', 'update')(body=volume_body, resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['pool_name'], volume_name=self.parameters['name'])
+ # waiting till the status turns Succeeded
+ while result.done() is not True:
+ result.result(10)
+ except (CloudError, ValidationError, AzureError) as error:
+ self.module.fail_json(msg='Error modifying volume %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def delete_azure_netapp_volume(self):
+ """
+ Delete a volume for the given Azure NetApp Account
+ :return: None
+ """
+ try:
+ result = self.get_method('volumes', 'delete')(resource_group_name=self.parameters['resource_group'],
+ account_name=self.parameters['account_name'],
+ pool_name=self.parameters['pool_name'], volume_name=self.parameters['name'])
+ # waiting till the status turns Succeeded
+ while result.done() is not True:
+ result.result(10)
+ except (CloudError, AzureError) as error:
+ self.module.fail_json(msg='Error deleting volume %s for Azure NetApp account %s: %s'
+ % (self.parameters['name'], self.parameters['account_name'], to_native(error)),
+ exception=traceback.format_exc())
+
+ def validate_modify(self, modify, current):
+ disallowed = dict(modify)
+ disallowed.pop('tags', None)
+ disallowed.pop('usage_threshold', None)
+ if disallowed:
+ self.module.fail_json(msg="Error: the following properties cannot be modified: %s. Current: %s" % (repr(disallowed), repr(current)))
+
+ def exec_module(self, **kwargs):
+
+ # unlikely
+ self.fail_when_import_errors(IMPORT_ERRORS, HAS_AZURE_MGMT_NETAPP)
+
+ # set up parameters according to our initial list
+ for key in list(self.module_arg_spec):
+ self.parameters[key] = kwargs[key]
+ # and common parameter
+ for key in ['tags']:
+ if key in kwargs:
+ self.parameters[key] = kwargs[key]
+
+ # API is using 'usage_threshold' for 'size', and the unit is bytes
+ if self.parameters.get('size') is not None:
+ self.parameters['usage_threshold'] = ONE_GIB * self.parameters.pop('size')
+
+ modify = None
+ current = self.get_azure_netapp_volume()
+ cd_action = self.na_helper.get_cd_action(current, self.parameters)
+ if cd_action is None and current:
+ # ignore change in name
+ name = current.pop('name', None)
+ modify = self.na_helper.get_modified_attributes(current, self.parameters)
+ if name is not None:
+ current['name'] = name
+ if 'tags' in modify:
+ dummy, modify['tags'] = self.update_tags(current.get('tags'))
+ self.validate_modify(modify, current)
+
+ if self.na_helper.changed and not self.module.check_mode:
+ if cd_action == 'create':
+ self.create_azure_netapp_volume()
+ elif cd_action == 'delete':
+ self.delete_azure_netapp_volume()
+ elif modify:
+ self.modify_azure_netapp_volume()
+
+ def get_mount_info(return_info):
+ if return_info is not None and return_info.get('mount_targets'):
+ return '%s:/%s' % (return_info['mount_targets'][0]['ip_address'], return_info['creation_token'])
+ return None
+
+ mount_info = ''
+ if self.parameters['state'] == 'present':
+ return_info = self.get_azure_netapp_volume()
+ if return_info is None and not self.module.check_mode:
+ self.module.fail_json(msg='Error: volume %s was created successfully, but cannot be found.' % self.parameters['name'])
+ mount_info = get_mount_info(return_info)
+ if mount_info is None and not self.module.check_mode:
+ self.module.fail_json(msg='Error: volume %s was created successfully, but mount target(s) cannot be found - volume details: %s.'
+ % (self.parameters['name'], str(return_info)))
+ self.module.exit_json(changed=self.na_helper.changed, mount_path=mount_info, modify=modify)
+
+
+def main():
+ AzureRMNetAppVolume()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/azure/requirements.txt b/ansible_collections/netapp/azure/requirements.txt
new file mode 100644
index 000000000..4badbc6ae
--- /dev/null
+++ b/ansible_collections/netapp/azure/requirements.txt
@@ -0,0 +1,3 @@
+azure-mgmt-netapp
+requests
+xmltodict \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/aliases b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/aliases
new file mode 100644
index 000000000..759eafa2d
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/aliases
@@ -0,0 +1,3 @@
+cloud/azure
+shippable/azure/group3
+destructive
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/meta/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/meta/main.yml
new file mode 100644
index 000000000..95e1952f9
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/tasks/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/tasks/main.yml
new file mode 100644
index 000000000..9fa627e48
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_account/tasks/main.yml
@@ -0,0 +1,41 @@
+- name: Create Azure NetApp account
+ azure_rm_netapp_account:
+ resource_group: laurentngroupnodash
+ name: tests-netapp1
+ location: eastus
+ tags: {'test1': 'tesssttt', 'abc': 'xyz'}
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Create Azure NetApp account (Idempotency)
+ azure_rm_netapp_account:
+ resource_group: laurentngroupnodash
+ name: tests-netapp1
+ location: eastus
+ tags: {'test1': 'tesssttt', 'abc': 'xyz'}
+ register: output
+
+- assert:
+ that: not output.changed
+
+- name: Delete Azure NetApp account
+ azure_rm_netapp_account:
+ state: absent
+ resource_group: laurentngroupnodash
+ name: tests-netapp1
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Delete Azure NetApp account (Idempotency)
+ azure_rm_netapp_account:
+ state: absent
+ resource_group: laurentngroupnodash
+ name: tests-netapp1
+ register: output
+
+- assert:
+ that: not output.changed
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/aliases b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/aliases
new file mode 100644
index 000000000..3a0c0dc68
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/aliases
@@ -0,0 +1,3 @@
+cloud/azure
+shippable/azure/group3
+destructive \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/meta/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/meta/main.yml
new file mode 100644
index 000000000..48f5726d8
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/tasks/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/tasks/main.yml
new file mode 100644
index 000000000..9bbae4ae7
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_capacity_pool/tasks/main.yml
@@ -0,0 +1,47 @@
+- name: Create Azure NetApp capacity pool
+ azure_rm_netapp_capacity_pool:
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ name: tests-poolsss
+ location: eastus
+ size: 2
+ service_level: Standard
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Create Azure NetApp capacity pool (Idempotency)
+ azure_rm_netapp_capacity_pool:
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ name: tests-poolsss
+ location: eastus
+ size: 2
+ service_level: Standard
+ register: output
+
+- assert:
+ that: not output.changed
+
+- name: Delete Azure NetApp capacity pool
+ azure_rm_netapp_capacity_pool:
+ state: absent
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ name: tests-poolsss
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Delete Azure NetApp capacity pool (Idempotency)
+ azure_rm_netapp_capacity_pool:
+ state: absent
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ name: tests-poolsss
+ register: output
+
+- assert:
+ that: not output.changed \ No newline at end of file
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/aliases b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/aliases
new file mode 100644
index 000000000..759eafa2d
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/aliases
@@ -0,0 +1,3 @@
+cloud/azure
+shippable/azure/group3
+destructive
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/meta/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/meta/main.yml
new file mode 100644
index 000000000..95e1952f9
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/tasks/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/tasks/main.yml
new file mode 100644
index 000000000..c1c1cf5c2
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_snapshot/tasks/main.yml
@@ -0,0 +1,51 @@
+- name: Create Azure NetApp snapshot
+ azure_rm_netapp_snapshot:
+ resource_group: laurentngroupnodash
+ account_name: tests-netapp
+ pool_name: test-pool
+ volume_name: tes
+ name: tests-snapshot
+ location: eastus
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Create Azure NetApp snapshot (Idempotency)
+ azure_rm_netapp_snapshot:
+ resource_group: laurentngroupnodash
+ account_name: tests-netapp
+ pool_name: test-pool
+ volume_name: tes
+ name: tests-snapshot
+ location: eastus
+ register: output
+
+- assert:
+ that: not output.changed
+
+- name: Delete Azure NetApp snapshot
+ azure_rm_netapp_snapshot:
+ state: absent
+ resource_group: laurentngroupnodash
+ account_name: tests-netapp
+ pool_name: test-pool
+ volume_name: tes
+ name: tests-snapshot
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Delete Azure NetApp snapshot (Idempotency)
+ azure_rm_netapp_snapshot:
+ state: absent
+ resource_group: laurentngroupnodash
+ account_name: tests-netapp
+ pool_name: test-pool
+ volume_name: tes
+ name: tests-snapshot
+ register: output
+
+- assert:
+ that: not output.changed
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/aliases b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/aliases
new file mode 100644
index 000000000..759eafa2d
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/aliases
@@ -0,0 +1,3 @@
+cloud/azure
+shippable/azure/group3
+destructive
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/meta/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/meta/main.yml
new file mode 100644
index 000000000..95e1952f9
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/meta/main.yml
@@ -0,0 +1,2 @@
+dependencies:
+ - setup_azure
diff --git a/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/tasks/main.yml b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/tasks/main.yml
new file mode 100644
index 000000000..c5b2a4262
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/integration/targets/azure_rm_netapp_volume/tasks/main.yml
@@ -0,0 +1,57 @@
+- name: Create Azure NetApp volume
+ azure_rm_netapp_volume:
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ pool_name: tests-pool
+ name: tests-volume2
+ location: eastus
+ size: 150
+ file_path: tests-volume2
+ virtual_network: azure_ansible
+ subnet_id: test
+ service_level: Standard
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Create Azure NetApp volume (Idempotency)
+ azure_rm_netapp_volume:
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ pool_name: tests-pool
+ name: tests-volume2
+ location: eastus
+ size: 150
+ file_path: tests-volume2
+ virtual_network: azure_ansible
+ subnet_id: test
+ service_level: Standard
+ register: output
+
+- assert:
+ that: not output.changed
+
+- name: Delete Azure NetApp volume
+ azure_rm_netapp_volume:
+ state: absent
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ pool_name: tests-pool
+ name: tests-volume2
+ register: output
+
+- assert:
+ that: output.changed
+
+- name: Delete Azure NetApp volume (Idempotency)
+ azure_rm_netapp_volume:
+ state: absent
+ resource_group: NetworkWatcherRG
+ account_name: ansibleazure
+ pool_name: tests-pool
+ name: tests-volume2
+ register: output
+
+- assert:
+ that: not output.changed
diff --git a/ansible_collections/netapp/azure/tests/runner/requirements/integration.cloud.azure.txt b/ansible_collections/netapp/azure/tests/runner/requirements/integration.cloud.azure.txt
new file mode 100644
index 000000000..e75cf1e2b
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/runner/requirements/integration.cloud.azure.txt
@@ -0,0 +1 @@
+azure-mgmt-netapp ; python_version >= '2.7'
diff --git a/ansible_collections/netapp/azure/tests/runner/requirements/requirements-azure.txt b/ansible_collections/netapp/azure/tests/runner/requirements/requirements-azure.txt
new file mode 100644
index 000000000..11852e2a5
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/runner/requirements/requirements-azure.txt
@@ -0,0 +1,9 @@
+azure-common==1.1.11
+azure-mgmt-compute==4.4.0
+azure-storage==0.35.1
+azure-mgmt-monitor==0.5.2
+azure-mgmt-network==2.3.0
+azure-mgmt-resource==2.1.0
+azure-mgmt-storage==3.1.0
+azure-mgmt-netapp ; python_version >= '2.7'
+azure-cli
diff --git a/ansible_collections/netapp/azure/tests/runner/requirements/unit.cloud.azure.txt b/ansible_collections/netapp/azure/tests/runner/requirements/unit.cloud.azure.txt
new file mode 100644
index 000000000..e75cf1e2b
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/runner/requirements/unit.cloud.azure.txt
@@ -0,0 +1 @@
+azure-mgmt-netapp ; python_version >= '2.7'
diff --git a/ansible_collections/netapp/azure/tests/runner/requirements/units.txt b/ansible_collections/netapp/azure/tests/runner/requirements/units.txt
new file mode 100644
index 000000000..e75cf1e2b
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/runner/requirements/units.txt
@@ -0,0 +1 @@
+azure-mgmt-netapp ; python_version >= '2.7'
diff --git a/ansible_collections/netapp/azure/tests/unit/compat/__init__.py b/ansible_collections/netapp/azure/tests/unit/compat/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/compat/__init__.py
diff --git a/ansible_collections/netapp/azure/tests/unit/compat/builtins.py b/ansible_collections/netapp/azure/tests/unit/compat/builtins.py
new file mode 100644
index 000000000..f60ee6782
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/compat/builtins.py
@@ -0,0 +1,33 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+#
+# Compat for python2.7
+#
+
+# One unittest needs to import builtins via __import__() so we need to have
+# the string that represents it
+try:
+ import __builtin__
+except ImportError:
+ BUILTINS = 'builtins'
+else:
+ BUILTINS = '__builtin__'
diff --git a/ansible_collections/netapp/azure/tests/unit/compat/mock.py b/ansible_collections/netapp/azure/tests/unit/compat/mock.py
new file mode 100644
index 000000000..0972cd2e8
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/compat/mock.py
@@ -0,0 +1,122 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+'''
+Compat module for Python3.x's unittest.mock module
+'''
+import sys
+
+# Python 2.7
+
+# Note: Could use the pypi mock library on python3.x as well as python2.x. It
+# is the same as the python3 stdlib mock library
+
+try:
+ # Allow wildcard import because we really do want to import all of mock's
+ # symbols into this compat shim
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ from unittest.mock import *
+except ImportError:
+ # Python 2
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ try:
+ from mock import *
+ except ImportError:
+ print('You need the mock library installed on python2.x to run tests')
+
+
+# Prior to 3.4.4, mock_open cannot handle binary read_data
+if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
+ file_spec = None
+
+ def _iterate_read_data(read_data):
+ # Helper for mock_open:
+ # Retrieve lines from read_data via a generator so that separate calls to
+ # readline, read, and readlines are properly interleaved
+ sep = b'\n' if isinstance(read_data, bytes) else '\n'
+ data_as_list = [l + sep for l in read_data.split(sep)]
+
+ if data_as_list[-1] == sep:
+ # If the last line ended in a newline, the list comprehension will have an
+ # extra entry that's just a newline. Remove this.
+ data_as_list = data_as_list[:-1]
+ else:
+ # If there wasn't an extra newline by itself, then the file being
+ # emulated doesn't have a newline to end the last line remove the
+ # newline that our naive format() added
+ data_as_list[-1] = data_as_list[-1][:-1]
+
+ for line in data_as_list:
+ yield line
+
+ def mock_open(mock=None, read_data=''):
+ """
+ A helper function to create a mock to replace the use of `open`. It works
+ for `open` called directly or used as a context manager.
+
+ The `mock` argument is the mock object to configure. If `None` (the
+ default) then a `MagicMock` will be created for you, with the API limited
+ to methods or attributes available on standard file handles.
+
+ `read_data` is a string for the `read` methoddline`, and `readlines` of the
+ file handle to return. This is an empty string by default.
+ """
+ def _readlines_side_effect(*args, **kwargs):
+ if handle.readlines.return_value is not None:
+ return handle.readlines.return_value
+ return list(_data)
+
+ def _read_side_effect(*args, **kwargs):
+ if handle.read.return_value is not None:
+ return handle.read.return_value
+ return type(read_data)().join(_data)
+
+ def _readline_side_effect():
+ if handle.readline.return_value is not None:
+ while True:
+ yield handle.readline.return_value
+ for line in _data:
+ yield line
+
+ global file_spec
+ if file_spec is None:
+ import _io
+ file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
+
+ if mock is None:
+ mock = MagicMock(name='open', spec=open)
+
+ handle = MagicMock(spec=file_spec)
+ handle.__enter__.return_value = handle
+
+ _data = _iterate_read_data(read_data)
+
+ handle.write.return_value = None
+ handle.read.return_value = None
+ handle.readline.return_value = None
+ handle.readlines.return_value = None
+
+ handle.read.side_effect = _read_side_effect
+ handle.readline.side_effect = _readline_side_effect()
+ handle.readlines.side_effect = _readlines_side_effect
+
+ mock.return_value = handle
+ return mock
diff --git a/ansible_collections/netapp/azure/tests/unit/compat/unittest.py b/ansible_collections/netapp/azure/tests/unit/compat/unittest.py
new file mode 100644
index 000000000..73a20cf8c
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/compat/unittest.py
@@ -0,0 +1,44 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+'''
+Compat module for Python2.7's unittest module
+'''
+
+import sys
+
+import pytest
+
+# Allow wildcard import because we really do want to import all of
+# unittests's symbols into this compat shim
+# pylint: disable=wildcard-import,unused-wildcard-import
+if sys.version_info < (2, 7):
+ try:
+ # Need unittest2 on python2.6
+ from unittest2 import *
+ except ImportError:
+ print('You need unittest2 installed on python2.6.x to run tests')
+
+ class TestCase:
+ """ skip everything """
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as unittest2 may not be available')
+else:
+ from unittest import *
diff --git a/ansible_collections/netapp/azure/tests/unit/plugins/module_utils/test_netapp_module.py b/ansible_collections/netapp/azure/tests/unit/plugins/module_utils/test_netapp_module.py
new file mode 100644
index 000000000..fb83c464e
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/plugins/module_utils/test_netapp_module.py
@@ -0,0 +1,149 @@
+# Copyright (c) 2018 NetApp
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests for module_utils netapp_module.py '''
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+from ansible_collections.netapp.azure.tests.unit.compat import unittest
+from ansible_collections.netapp.azure.plugins.module_utils.netapp_module import NetAppModule as na_helper
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def test_get_cd_action_create(self):
+ ''' validate cd_action for create '''
+ current = None
+ desired = {'state': 'present'}
+ my_obj = na_helper()
+ result = my_obj.get_cd_action(current, desired)
+ assert result == 'create'
+
+ def test_get_cd_action_delete(self):
+ ''' validate cd_action for delete '''
+ current = {'state': 'absent'}
+ desired = {'state': 'absent'}
+ my_obj = na_helper()
+ result = my_obj.get_cd_action(current, desired)
+ assert result == 'delete'
+
+ def test_get_cd_action(self):
+ ''' validate cd_action for returning None '''
+ current = None
+ desired = {'state': 'absent'}
+ my_obj = na_helper()
+ result = my_obj.get_cd_action(current, desired)
+ assert result is None
+
+ def test_get_modified_attributes_for_no_data(self):
+ ''' validate modified attributes when current is None '''
+ current = None
+ desired = {'name': 'test'}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired)
+ assert result == {}
+
+ def test_get_modified_attributes(self):
+ ''' validate modified attributes '''
+ current = {'name': ['test', 'abcd', 'xyz', 'pqr'], 'state': 'present'}
+ desired = {'name': ['abcd', 'abc', 'xyz', 'pqr'], 'state': 'absent'}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired)
+ assert result == desired
+
+ def test_get_modified_attributes_for_intersecting_mixed_list(self):
+ ''' validate modified attributes for list diff '''
+ current = {'name': [2, 'four', 'six', 8]}
+ desired = {'name': ['a', 8, 'ab', 'four', 'abcd']}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {'name': ['a', 'ab', 'abcd']}
+
+ def test_get_modified_attributes_for_intersecting_list(self):
+ ''' validate modified attributes for list diff '''
+ current = {'name': ['two', 'four', 'six', 'eight']}
+ desired = {'name': ['a', 'six', 'ab', 'four', 'abc']}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {'name': ['a', 'ab', 'abc']}
+
+ def test_get_modified_attributes_for_nonintersecting_list(self):
+ ''' validate modified attributes for list diff '''
+ current = {'name': ['two', 'four', 'six', 'eight']}
+ desired = {'name': ['a', 'ab', 'abd']}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {'name': ['a', 'ab', 'abd']}
+
+ def test_get_modified_attributes_for_list_of_dicts_no_data(self):
+ ''' validate modified attributes for list diff '''
+ current = None
+ desired = {'address_blocks': [{'start': '10.20.10.40', 'size': 5}]}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {}
+
+ def test_get_modified_attributes_for_intersecting_list_of_dicts(self):
+ ''' validate modified attributes for list diff '''
+ current = {'address_blocks': [{'start': '10.10.10.23', 'size': 5}, {'start': '10.10.10.30', 'size': 5}]}
+ desired = {'address_blocks': [{'start': '10.10.10.23', 'size': 5}, {'start': '10.10.10.30', 'size': 5}, {'start': '10.20.10.40', 'size': 5}]}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {'address_blocks': [{'start': '10.20.10.40', 'size': 5}]}
+
+ def test_get_modified_attributes_for_nonintersecting_list_of_dicts(self):
+ ''' validate modified attributes for list diff '''
+ current = {'address_blocks': [{'start': '10.10.10.23', 'size': 5}, {'start': '10.10.10.30', 'size': 5}]}
+ desired = {'address_blocks': [{'start': '10.20.10.23', 'size': 5}, {'start': '10.20.10.30', 'size': 5}, {'start': '10.20.10.40', 'size': 5}]}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {'address_blocks': [{'start': '10.20.10.23', 'size': 5}, {'start': '10.20.10.30', 'size': 5}, {'start': '10.20.10.40', 'size': 5}]}
+
+ def test_get_modified_attributes_for_list_diff(self):
+ ''' validate modified attributes for list diff '''
+ current = {'name': ['test', 'abcd'], 'state': 'present'}
+ desired = {'name': ['abcd', 'abc'], 'state': 'present'}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired, True)
+ assert result == {'name': ['abc']}
+
+ def test_get_modified_attributes_for_no_change(self):
+ ''' validate modified attributes for same data in current and desired '''
+ current = {'name': 'test'}
+ desired = {'name': 'test'}
+ my_obj = na_helper()
+ result = my_obj.get_modified_attributes(current, desired)
+ assert result == {}
+
+ def test_is_rename_action_for_empty_input(self):
+ ''' validate rename action for input None '''
+ source = None
+ target = None
+ my_obj = na_helper()
+ result = my_obj.is_rename_action(source, target)
+ assert result == source
+
+ def test_is_rename_action_for_no_source(self):
+ ''' validate rename action when source is None '''
+ source = None
+ target = 'test2'
+ my_obj = na_helper()
+ result = my_obj.is_rename_action(source, target)
+ assert result is False
+
+ def test_is_rename_action_for_no_target(self):
+ ''' validate rename action when target is None '''
+ source = 'test2'
+ target = None
+ my_obj = na_helper()
+ result = my_obj.is_rename_action(source, target)
+ assert result is True
+
+ def test_is_rename_action(self):
+ ''' validate rename action '''
+ source = 'test'
+ target = 'test2'
+ my_obj = na_helper()
+ result = my_obj.is_rename_action(source, target)
+ assert result is False
diff --git a/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_account.py b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_account.py
new file mode 100644
index 000000000..0d140b4a0
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_account.py
@@ -0,0 +1,173 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests ONTAP Ansible module: azure_rm_netapp_account'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import sys
+
+import pytest
+try:
+ from requests import Response
+except ImportError:
+ if sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.azure.tests.unit.compat import unittest
+from ansible_collections.netapp.azure.tests.unit.compat.mock import patch, Mock
+
+HAS_AZURE_RMNETAPP_IMPORT = True
+try:
+ # At this point, python believes the module is already loaded, so the import inside azure_rm_netapp_volume will be skipped.
+ from ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_account \
+ import AzureRMNetAppAccount as account_module
+except ImportError:
+ HAS_AZURE_RMNETAPP_IMPORT = False
+
+HAS_AZURE_CLOUD_ERROR_IMPORT = True
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ HAS_AZURE_CLOUD_ERROR_IMPORT = False
+
+if not HAS_AZURE_CLOUD_ERROR_IMPORT and sys.version_info < (3, 5):
+ pytestmark = pytest.mark.skip('skipping as missing required azure_exceptions on 2.6 and 2.7')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class MockAzureClient(object):
+ ''' mock server connection to ONTAP host '''
+ def __init__(self):
+ ''' save arguments '''
+ self.valid_accounts = ['test1', 'test2']
+
+ def get(self, resource_group, account_name): # pylint: disable=unused-argument
+ if account_name not in self.valid_accounts:
+ invalid = Response()
+ invalid.status_code = 404
+ raise CloudError(response=invalid)
+ return Mock(name=account_name)
+
+ def create_or_update(self, body, resource_group, account_name): # pylint: disable=unused-argument,no-self-use
+ return None
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+ self.netapp_client = Mock()
+ self.netapp_client.accounts = MockAzureClient()
+ self._netapp_client = None
+
+ def set_default_args(self):
+ resource_group = 'azure'
+ name = 'test1'
+ location = 'abc'
+ return dict({
+ 'resource_group': resource_group,
+ 'name': name,
+ 'location': location
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args({})
+ account_module()
+ print('Info: %s' % exc.value.args[0]['msg'])
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_get_called_valid_account(self, client_f):
+ set_module_args(self.set_default_args())
+ client_f.return_value = Mock()
+ client_f.side_effect = Mock()
+ my_obj = account_module()
+ my_obj.netapp_client.accounts = self.netapp_client.accounts
+ assert my_obj.get_azure_netapp_account() is not None
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_get_called_non_existing_account(self, client_f):
+ data = self.set_default_args()
+ data['name'] = 'invalid'
+ set_module_args(data)
+ client_f.return_value = Mock()
+ client_f.side_effect = Mock()
+ my_obj = account_module()
+ my_obj.netapp_client.accounts = self.netapp_client.accounts
+ assert my_obj.get_azure_netapp_account() is None
+
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_account.AzureRMNetAppAccount.get_azure_netapp_account')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_account.AzureRMNetAppAccount.create_azure_netapp_account')
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_create_called(self, client_f, mock_create, mock_get):
+ data = dict(self.set_default_args())
+ data['name'] = 'create'
+ data['tags'] = {'ttt': 'tesssttt', 'abc': 'xyz'}
+ set_module_args(data)
+ mock_get.return_value = None
+ client_f.return_value = Mock()
+ client_f.side_effect = Mock()
+ my_obj = account_module()
+ my_obj.netapp_client.accounts = self.netapp_client.accounts
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_create.assert_called_with()
+
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_account.AzureRMNetAppAccount.get_azure_netapp_account')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_account.AzureRMNetAppAccount.delete_azure_netapp_account')
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_delete_called(self, client_f, mock_delete, mock_get):
+ data = dict(self.set_default_args())
+ data['state'] = 'absent'
+ set_module_args(data)
+ mock_get.return_value = Mock()
+ client_f.return_value = Mock()
+ client_f.side_effect = Mock()
+ my_obj = account_module()
+ my_obj.netapp_client.accounts = self.netapp_client.accounts
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_delete.assert_called_with()
diff --git a/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_capacity_pool.py b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_capacity_pool.py
new file mode 100644
index 000000000..91c8eefd6
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_capacity_pool.py
@@ -0,0 +1,197 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests ONTAP Ansible module: azure_rm_netapp_capacity_pool'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import sys
+
+import pytest
+try:
+ from requests import Response
+except ImportError:
+ if sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.azure.tests.unit.compat import unittest
+from ansible_collections.netapp.azure.tests.unit.compat.mock import patch, Mock
+
+HAS_AZURE_RMNETAPP_IMPORT = True
+try:
+ # At this point, python believes the module is already loaded, so the import inside azure_rm_netapp_volume will be skipped.
+ from ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool \
+ import AzureRMNetAppCapacityPool as capacity_pool_module
+except ImportError:
+ HAS_AZURE_RMNETAPP_IMPORT = False
+
+HAS_AZURE_CLOUD_ERROR_IMPORT = True
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ HAS_AZURE_CLOUD_ERROR_IMPORT = False
+
+if not HAS_AZURE_CLOUD_ERROR_IMPORT and sys.version_info < (3, 5):
+ pytestmark = pytest.mark.skip('skipping as missing required azure_exceptions on 2.6 and 2.7')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class MockAzureClient(object):
+ ''' mock server connection to ONTAP host '''
+ def __init__(self):
+ ''' save arguments '''
+ self.valid_pools = ['test1', 'test2']
+
+ def get(self, resource_group, account_name, pool_name): # pylint: disable=unused-argument
+ if pool_name not in self.valid_pools:
+ invalid = Response()
+ invalid.status_code = 404
+ raise CloudError(response=invalid)
+ else:
+ return Mock(name=pool_name)
+
+ def create_or_update(self, body, resource_group, account_name, pool_name): # pylint: disable=unused-argument
+ return None
+
+ def update(self, body, resource_group, account_name, pool_name): # pylint: disable=unused-argument
+ return None
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+ self.netapp_client = Mock()
+ self.netapp_client.pools = MockAzureClient()
+ self._netapp_client = None
+
+ def set_default_args(self):
+ resource_group = 'azure'
+ account_name = 'azure'
+ name = 'test1'
+ location = 'abc'
+ size = 1
+ service_level = 'Standard'
+ return dict({
+ 'resource_group': resource_group,
+ 'account_name': account_name,
+ 'name': name,
+ 'location': location,
+ 'size': size,
+ 'service_level': service_level
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args({})
+ capacity_pool_module()
+ print('Info: %s' % exc.value.args[0]['msg'])
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_get_called_valid_capacity_pool(self, client_f):
+ set_module_args(self.set_default_args())
+ client_f.return_value = Mock()
+ my_obj = capacity_pool_module()
+ my_obj.netapp_client.pools = self.netapp_client.pools
+ assert my_obj.get_azure_netapp_capacity_pool() is not None
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_get_called_non_existing_capacity_pool(self, client_f):
+ data = self.set_default_args()
+ data['name'] = 'invalid'
+ set_module_args(data)
+ client_f.return_value = Mock()
+ my_obj = capacity_pool_module()
+ my_obj.netapp_client.pools = self.netapp_client.pools
+ assert my_obj.get_azure_netapp_capacity_pool() is None
+
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool.AzureRMNetAppCapacityPool.get_azure_netapp_capacity_pool')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool.AzureRMNetAppCapacityPool.create_azure_netapp_capacity_pool')
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_create_called(self, client_f, mock_create, mock_get):
+ data = dict(self.set_default_args())
+ data['name'] = 'create'
+ set_module_args(data)
+ mock_get.return_value = None
+ client_f.return_value = Mock()
+ my_obj = capacity_pool_module()
+ my_obj.netapp_client.pools = self.netapp_client.pools
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_create.assert_called_with()
+
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool.AzureRMNetAppCapacityPool.get_azure_netapp_capacity_pool')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool.AzureRMNetAppCapacityPool.create_azure_netapp_capacity_pool')
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_modify_called(self, client_f, mock_modify, mock_get):
+ data = dict(self.set_default_args())
+ data['name'] = 'create'
+ data['size'] = 3
+ set_module_args(data)
+ mock_get.return_value = None
+ client_f.return_value = Mock()
+ my_obj = capacity_pool_module()
+ my_obj.netapp_client.pools = self.netapp_client.pools
+ with pytest.raises(AnsibleExitJson) as exc:
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_modify.assert_called_with()
+
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool.AzureRMNetAppCapacityPool.get_azure_netapp_capacity_pool')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_capacity_pool.AzureRMNetAppCapacityPool.delete_azure_netapp_capacity_pool')
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_delete_called(self, client_f, mock_delete, mock_get):
+ data = self.set_default_args()
+ data['state'] = 'absent'
+ set_module_args(data)
+ mock_get.return_value = Mock()
+ client_f.return_value = Mock()
+ my_obj = capacity_pool_module()
+ my_obj.netapp_client.pools = self.netapp_client.pools
+ with pytest.raises(AnsibleExitJson) as exc:
+ data['state'] = 'absent'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_delete.assert_called_with()
diff --git a/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_snapshot.py b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_snapshot.py
new file mode 100644
index 000000000..0415a4039
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_snapshot.py
@@ -0,0 +1,165 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests ONTAP Ansible module: azure_rm_netapp_snapshot'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import sys
+
+import pytest
+try:
+ from requests import Response
+except ImportError:
+ if sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.azure.tests.unit.compat import unittest
+from ansible_collections.netapp.azure.tests.unit.compat.mock import patch, Mock
+
+HAS_AZURE_RMNETAPP_IMPORT = True
+try:
+ # At this point, python believes the module is already loaded, so the import inside azure_rm_netapp_volume will be skipped.
+ from ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_snapshot \
+ import AzureRMNetAppSnapshot as snapshot_module
+except ImportError:
+ HAS_AZURE_RMNETAPP_IMPORT = False
+
+HAS_AZURE_CLOUD_ERROR_IMPORT = True
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ HAS_AZURE_CLOUD_ERROR_IMPORT = False
+
+if not HAS_AZURE_CLOUD_ERROR_IMPORT and sys.version_info < (3, 5):
+ pytestmark = pytest.mark.skip('skipping as missing required azure_exceptions on 2.6 and 2.7')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class MockAzureClient(object):
+ ''' mock server connection to ONTAP host '''
+ def __init__(self):
+ ''' save arguments '''
+ self.valid_snapshots = ['test1', 'test2']
+
+ def get(self, resource_group, account_name, pool_name, volume_name, snapshot_name): # pylint: disable=unused-argument
+ if snapshot_name not in self.valid_snapshots:
+ invalid = Response()
+ invalid.status_code = 404
+ raise CloudError(response=invalid)
+ else:
+ return Mock(name=snapshot_name)
+
+ def create(self, body, resource_group, account_name, pool_name, volume_name, snapshot_name): # pylint: disable=unused-argument
+ return None
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+ self.netapp_client = Mock()
+ self.netapp_client.pools = MockAzureClient()
+ self._netapp_client = None
+
+ def set_default_args(self):
+ resource_group = 'azure'
+ account_name = 'azure'
+ pool_name = 'azure'
+ volume_name = 'azure'
+ name = 'test1'
+ location = 'abc'
+ return dict({
+ 'resource_group': resource_group,
+ 'account_name': account_name,
+ 'pool_name': pool_name,
+ 'volume_name': volume_name,
+ 'name': name,
+ 'location': location
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args({})
+ snapshot_module()
+ print('Info: %s' % exc.value.args[0]['msg'])
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ def test_ensure_get_called_valid_snapshot(self, client_f):
+ set_module_args(self.set_default_args())
+ client_f.return_value = Mock()
+ my_obj = snapshot_module()
+ my_obj.netapp_client.snapshots = self.netapp_client.snapshots
+ assert my_obj.get_azure_netapp_snapshot() is not None
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_snapshot.AzureRMNetAppSnapshot.get_azure_netapp_snapshot')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_snapshot.AzureRMNetAppSnapshot.create_azure_netapp_snapshot')
+ def test_ensure_create_called(self, mock_create, mock_get, client_f):
+ data = dict(self.set_default_args())
+ data['name'] = 'create'
+ set_module_args(data)
+ mock_get.return_value = None
+ client_f.return_value = Mock()
+ my_obj = snapshot_module()
+ my_obj.netapp_client.snapshots = self.netapp_client.snapshots
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_create.assert_called_with()
+
+ @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_snapshot.AzureRMNetAppSnapshot.get_azure_netapp_snapshot')
+ @patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_snapshot.AzureRMNetAppSnapshot.delete_azure_netapp_snapshot')
+ def test_ensure_delete_called(self, mock_delete, mock_get, client_f):
+ data = dict(self.set_default_args())
+ data['state'] = 'absent'
+ set_module_args(data)
+ client_f.return_value = Mock()
+ mock_get.return_value = Mock()
+ my_obj = snapshot_module()
+ my_obj.netapp_client.snapshots = self.netapp_client.snapshots
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_delete.assert_called_with()
diff --git a/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume.py b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume.py
new file mode 100644
index 000000000..83c7f812e
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume.py
@@ -0,0 +1,501 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests ONTAP Ansible module: azure_rm_netapp_volume'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import sys
+
+import pytest
+try:
+ from requests import Response
+except ImportError:
+ if sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.azure.tests.unit.compat.mock import patch, Mock
+
+HAS_AZURE_RMNETAPP_IMPORT = True
+try:
+ # At this point, python believes the module is already loaded, so the import inside azure_rm_netapp_volume will be skipped.
+ from ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume \
+ import AzureRMNetAppVolume as volume_module
+except ImportError:
+ HAS_AZURE_RMNETAPP_IMPORT = False
+
+HAS_AZURE_CLOUD_ERROR_IMPORT = True
+try:
+ from msrestazure.azure_exceptions import CloudError
+except ImportError:
+ HAS_AZURE_CLOUD_ERROR_IMPORT = False
+
+if not HAS_AZURE_CLOUD_ERROR_IMPORT and sys.version_info < (3, 5):
+ pytestmark = pytest.mark.skip('skipping as missing required azure_exceptions on 2.6 and 2.7')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class MockAzureClient(object):
+ ''' mock server connection to ONTAP host '''
+ def __init__(self):
+ ''' save arguments '''
+ self.valid_volumes = ['test1', 'test2']
+
+ def get(self, resource_group, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ if volume_name in self.valid_volumes:
+ return Mock(name=volume_name,
+ subnet_id='/resid/whatever/subnet_name',
+ mount_targets=[Mock(ip_address='1.2.3.4')]
+ )
+
+ invalid = Response()
+ invalid.status_code = 404
+ raise CloudError(response=invalid)
+
+ def create_or_update(self, body, resource_group, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ return None
+
+ def begin_create_or_update(self, body, resource_group_name, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ return Mock(done=Mock(side_effect=[False, True]))
+
+ def begin_update(self, body, resource_group_name, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ return Mock(done=Mock(side_effect=[False, True]))
+
+ def begin_delete(self, resource_group_name, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ return Mock(done=Mock(side_effect=[False, True]))
+
+
+class MockAzureClientRaise(MockAzureClient):
+ ''' mock server connection to ONTAP host '''
+ response = Mock(status_code=400, context=None, headers=[], text=lambda: 'Forced exception')
+
+ def begin_create_or_update(self, body, resource_group_name, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ raise CloudError(MockAzureClientRaise.response)
+
+ def begin_update(self, body, resource_group_name, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ raise CloudError(MockAzureClientRaise.response)
+
+ def begin_delete(self, resource_group_name, account_name, pool_name, volume_name): # pylint: disable=unused-argument
+ raise CloudError(MockAzureClientRaise.response)
+
+
+# using pytest natively, without unittest.TestCase
+@pytest.fixture(name="patch_ansible")
+def fixture_patch_ansible():
+ with patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json) as mocks:
+ yield mocks
+
+
+def set_default_args():
+ resource_group = 'azure'
+ account_name = 'azure'
+ pool_name = 'azure'
+ name = 'test1'
+ location = 'abc'
+ file_path = 'azure'
+ subnet_id = 'azure'
+ virtual_network = 'azure'
+ size = 100
+ return dict({
+ 'resource_group': resource_group,
+ 'account_name': account_name,
+ 'pool_name': pool_name,
+ 'name': name,
+ 'location': location,
+ 'file_path': file_path,
+ 'subnet_name': subnet_id,
+ 'virtual_network': virtual_network,
+ 'size': size,
+ 'protocol_types': 'nfs',
+ 'tags': {'owner': 'laurentn'}
+ })
+
+
+def test_module_fail_when_required_args_missing(patch_ansible): # pylint: disable=unused-argument
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args({})
+ volume_module()
+ print('Info: %s' % exc.value.args[0]['msg'])
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+def test_ensure_get_called_valid_volume(client_f):
+ set_module_args(set_default_args())
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ assert my_obj.get_azure_netapp_volume() is not None
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+def test_ensure_get_called_non_existing_volume(client_f):
+ data = dict(set_default_args())
+ data['name'] = 'invalid'
+ set_module_args(data)
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ assert my_obj.get_azure_netapp_volume() is None
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.create_azure_netapp_volume')
+def test_ensure_create_called(mock_create, mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'create'
+ set_module_args(data)
+ mock_get.side_effect = [
+ None, # first get
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # get after create
+ creation_token='abcd')
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ expected_mount_path = '11.22.33.44:/abcd'
+ assert exc.value.args[0]['mount_path'] == expected_mount_path
+ mock_create.assert_called_with()
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_create(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'create'
+ data['protocol_types'] = ['nfsv4.1']
+ set_module_args(data)
+ mock_get.side_effect = [
+ None, # first get
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # get after create
+ creation_token='abcd')
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ expected_mount_path = '11.22.33.44:/abcd'
+ assert exc.value.args[0]['mount_path'] == expected_mount_path
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_create_exception(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'create'
+ data['protocol_types'] = 'nfsv4.1'
+ set_module_args(data)
+ mock_get.side_effect = [
+ None, # first get
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # get after create
+ creation_token='abcd')
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClientRaise()
+ with pytest.raises(AnsibleFailJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ expected_msg = 'Error creating volume'
+ assert expected_msg in exc.value.args[0]['msg']
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.create_azure_netapp_volume')
+def test_ensure_create_called_but_fail_on_get(mock_create, mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'create'
+ set_module_args(data)
+ mock_get.side_effect = [
+ None, # first get
+ dict(mount_targets=None, # get after create
+ creation_token='abcd')
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleFailJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ error = 'Error: volume create was created successfully, but mount target(s) cannot be found - volume details:'
+ assert exc.value.args[0]['msg'].startswith(error)
+ mock_create.assert_called_with()
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.create_azure_netapp_volume')
+def test_ensure_create_called_but_fail_on_mount_target(mock_create, mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'create'
+ set_module_args(data)
+ mock_get.return_value = None
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleFailJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ error = 'Error: volume create was created successfully, but cannot be found.'
+ assert exc.value.args[0]['msg'] == error
+ mock_create.assert_called_with()
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.delete_azure_netapp_volume')
+def test_ensure_delete_called(mock_delete, mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['state'] = 'absent'
+ set_module_args(data)
+ client_f.return_value = Mock()
+ mock_get.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ mock_delete.assert_called_with()
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_delete(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'delete'
+ data['state'] = 'absent'
+ set_module_args(data)
+ mock_get.side_effect = [
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # first get
+ creation_token='abcd')
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ expected_mount_path = ''
+ assert exc.value.args[0]['mount_path'] == expected_mount_path
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_delete_exception(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'delete'
+ data['state'] = 'absent'
+ set_module_args(data)
+ mock_get.side_effect = [
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # first get
+ creation_token='abcd')
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClientRaise()
+ with pytest.raises(AnsibleFailJson) as exc:
+ # add default args for exec_module
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ expected_msg = 'Error deleting volume'
+ assert expected_msg in exc.value.args[0]['msg']
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_modify(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'modify'
+ data['size'] = 200
+ data['tags'] = {'added_tag': 'new_tag'}
+ set_module_args(data)
+ mock_get.side_effect = [
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # first get
+ creation_token='abcd',
+ tags={},
+ usage_threshold=0),
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # get after modify
+ creation_token='abcd',
+ usage_threshold=10000000)
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleExitJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ assert exc.value.args[0]['changed']
+ print('modify', exc.value.args[0])
+ expected_mount_path = '11.22.33.44:/abcd'
+ assert exc.value.args[0]['mount_path'] == expected_mount_path
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_modify_exception(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'modify'
+ data['size'] = 200
+ set_module_args(data)
+ mock_get.side_effect = [
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # first get
+ creation_token='abcd',
+ usage_threshold=0),
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # get after modify
+ creation_token='abcd',
+ usage_threshold=10000000)
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClientRaise()
+ with pytest.raises(AnsibleFailJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ expected_msg = 'Error modifying volume'
+ assert expected_msg in exc.value.args[0]['msg']
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+@patch('ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume.AzureRMNetAppVolume.get_azure_netapp_volume')
+def test_modify_not_supported(mock_get, client_f, patch_ansible): # pylint: disable=unused-argument
+ data = dict(set_default_args())
+ data['name'] = 'modify'
+ data['location'] = 'east'
+ set_module_args(data)
+ mock_get.side_effect = [
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # first get
+ creation_token='abcd',
+ usage_threshold=0,
+ location='west',
+ name='old_name'),
+ dict(mount_targets=[dict(ip_address='11.22.33.44')], # get after modify
+ creation_token='abcd',
+ usage_threshold=10000000)
+ ]
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.azure_auth = Mock(subscription_id='1234')
+ my_obj._new_style = True
+ my_obj.netapp_client.volumes = MockAzureClient()
+ with pytest.raises(AnsibleFailJson) as exc:
+ # add default args for exec_module
+ data['state'] = 'present'
+ data['debug'] = False
+ my_obj.exec_module(**data)
+ expected_msg = "Error: the following properties cannot be modified: {'location': 'east'}"
+ assert expected_msg in exc.value.args[0]['msg']
+
+
+@patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.netapp_client')
+def test_get_export_policy_rules(client_f, patch_ansible):
+ set_module_args(set_default_args())
+ client_f.return_value = Mock()
+ my_obj = volume_module()
+ my_obj.netapp_client.volumes = MockAzureClient()
+ rules = my_obj.get_export_policy_rules()
+ assert rules is None
+ del my_obj.parameters['protocol_types']
+ rules = my_obj.get_export_policy_rules()
+ assert rules is None
+ my_obj.parameters['protocol_types'] = ['nFsv4.1']
+ rules = my_obj.get_export_policy_rules()
+ assert rules is not None
+ rules = vars(rules)
+ assert 'rules' in rules
+ rules = rules['rules']
+ assert rules
+ rule = vars(rules[0])
+ assert rule['nfsv41']
+ assert not rule['cifs']
+
+
+def test_dict_from_object():
+ set_module_args(set_default_args())
+ my_obj = volume_module()
+ # just for fun
+ module_dict = my_obj.dict_from_volume_object(my_obj)
+ print('Module dict', module_dict)
+
+ rule_object = Mock()
+ rule_object.ip_address = '10.10.10.10'
+ export_policy_object = Mock()
+ export_policy_object.rules = [rule_object]
+ volume_object = Mock()
+ volume_object.export_policy = export_policy_object
+ volume_dict = my_obj.dict_from_volume_object(volume_object)
+ print('Volume dict', volume_dict)
+ assert 'export_policy' in volume_dict
+ assert 'rules' in volume_dict['export_policy']
+ assert isinstance(volume_dict['export_policy']['rules'], list)
+ assert len(volume_dict['export_policy']['rules']) == 1
+ assert 'ip_address' in volume_dict['export_policy']['rules'][0]
diff --git a/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume_import.py b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume_import.py
new file mode 100644
index 000000000..13d3bba29
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/plugins/modules/test_azure_rm_netapp_volume_import.py
@@ -0,0 +1,74 @@
+# (c) 2021, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests ONTAP Ansible module: azure_rm_netapp_volume'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import sys
+
+import pytest
+# from typing import Collection
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.azure.tests.unit.compat.mock import patch
+
+
+if sys.version_info < (3, 5):
+ pytestmark = pytest.mark.skip('skipping as missing imports on 2.6 and 2.7')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+@pytest.fixture(name="patch_ansible")
+def fixture_patch_ansible():
+ with patch.multiple(basic.AnsibleModule,
+ fail_json=fail_json) as mocks:
+ yield mocks
+
+
+# @patch('ansible_collections.netapp.azure.plugins.module_utils.azure_rm_netapp_common.AzureRMNetAppModuleBase.__init__')
+def test_import_error():
+ orig_import = __import__
+
+ def import_mock(name, *args):
+ print('importing: %s' % name)
+ if name.startswith('ansible_collections.netapp.azure.plugins.modules'):
+ # force a relead to go through secondary imports
+ sys.modules.pop(name, None)
+ if name in ('azure.core.exceptions', 'azure.mgmt.netapp.models'):
+ raise ImportError('forced error on %s' % name)
+ return orig_import(name, *args)
+
+ # mock_base.return_value = Mock()
+ data = dict()
+ set_module_args(data)
+ with patch('builtins.__import__', side_effect=import_mock):
+ from ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume import IMPORT_ERRORS
+ assert any('azure.core.exceptions' in error for error in IMPORT_ERRORS)
+ assert any('azure.mgmt.netapp.models' in error for error in IMPORT_ERRORS)
+
+
+def test_main(patch_ansible): # pylint: disable=unused-argument
+ data = dict()
+ set_module_args(data)
+ from ansible_collections.netapp.azure.plugins.modules.azure_rm_netapp_volume import main
+ with pytest.raises(AnsibleFailJson) as exc:
+ main()
+ expected_msg = "missing required arguments:"
+ assert expected_msg in exc.value.args[0]['msg']
diff --git a/ansible_collections/netapp/azure/tests/unit/requirements.txt b/ansible_collections/netapp/azure/tests/unit/requirements.txt
new file mode 100644
index 000000000..0b89f6365
--- /dev/null
+++ b/ansible_collections/netapp/azure/tests/unit/requirements.txt
@@ -0,0 +1,3 @@
+azure-mgmt-netapp ; python_version >= '2.7'
+msrestazure ; python_version >= '3.5'
+requests ; python_version >= '2.7'