From a453ac31f3428614cceb99027f8efbdb9258a40b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 14 May 2024 22:03:01 +0200 Subject: Adding upstream version 2.10.7+merged+base+2.10.8+dfsg. Signed-off-by: Daniel Baumann --- .../infinidat/infinibox/.gitignore | 107 +++++ .../infinidat/infinibox/.gitlab-ci.yml | 43 ++ .../infinidat/infinibox/FILES.json | 313 ++++++++++++ .../infinidat/infinibox/LICENSE | 202 ++++++++ .../infinidat/infinibox/MANIFEST.json | 43 ++ .../infinidat/infinibox/Makefile | 84 ++++ .../infinidat/infinibox/README.md | 65 +++ .../infinibox/bin/check_collection_files.sh | 60 +++ .../infinibox/bin/install_modules_for_hacking.sh | 97 ++++ .../infinidat/infinibox/bin/test_summarize.sh | 58 +++ .../infinidat/infinibox/docs/DEV_README.md | 153 ++++++ .../infinidat/infinibox/ibox_vars/iboxCICD.yaml | 10 + .../infinibox/ibox_vars/iboxNNNN_example.yaml | 12 + .../infinidat/infinibox/playbooks/ansible.cfg | 6 + .../infinibox/playbooks/test_create_resources.yml | 535 +++++++++++++++++++++ .../infinibox/playbooks/test_remove_resources.yml | 206 ++++++++ .../infinibox/plugins/doc_fragments/infinibox.py | 38 ++ .../infinibox/plugins/filters/psus_filters.py | 28 ++ .../infinibox/plugins/module_utils/infinibox.py | 216 +++++++++ .../plugins/modules/.ropeproject/config.py | 114 +++++ .../plugins/modules/.ropeproject/globalnames | Bin 0 -> 6 bytes .../infinibox/plugins/modules/.ropeproject/history | Bin 0 -> 14 bytes .../plugins/modules/.ropeproject/objectdb | Bin 0 -> 6 bytes .../infinibox/plugins/modules/__init__.py | 0 .../infinibox/plugins/modules/infini_cluster.py | 264 ++++++++++ .../infinibox/plugins/modules/infini_export.py | 264 ++++++++++ .../plugins/modules/infini_export_client.py | 263 ++++++++++ .../infinibox/plugins/modules/infini_fs.py | 203 ++++++++ .../infinibox/plugins/modules/infini_host.py | 185 +++++++ .../infinibox/plugins/modules/infini_map.py | 355 ++++++++++++++ .../infinibox/plugins/modules/infini_pool.py | 287 +++++++++++ .../infinibox/plugins/modules/infini_port.py | 376 +++++++++++++++ .../infinibox/plugins/modules/infini_user.py | 332 +++++++++++++ .../infinibox/plugins/modules/infini_vol.py | 466 ++++++++++++++++++ .../infinidat/infinibox/requirements.txt | 63 +++ 35 files changed, 5448 insertions(+) create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/.gitignore create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/.gitlab-ci.yml create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/FILES.json create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/LICENSE create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/MANIFEST.json create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/Makefile create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/README.md create mode 100755 collections-debian-merged/ansible_collections/infinidat/infinibox/bin/check_collection_files.sh create mode 100755 collections-debian-merged/ansible_collections/infinidat/infinibox/bin/install_modules_for_hacking.sh create mode 100755 collections-debian-merged/ansible_collections/infinidat/infinibox/bin/test_summarize.sh create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/docs/DEV_README.md create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxCICD.yaml create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxNNNN_example.yaml create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/ansible.cfg create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/doc_fragments/infinibox.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/filters/psus_filters.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/module_utils/infinibox.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/config.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/globalnames create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/history create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/objectdb create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/__init__.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_cluster.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export_client.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_fs.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_host.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_map.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_pool.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_port.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_user.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_vol.py create mode 100644 collections-debian-merged/ansible_collections/infinidat/infinibox/requirements.txt (limited to 'collections-debian-merged/ansible_collections/infinidat') diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/.gitignore b/collections-debian-merged/ansible_collections/infinidat/infinibox/.gitignore new file mode 100644 index 00000000..5229ecff --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/.gitignore @@ -0,0 +1,107 @@ +# build products... +*.py[co] +build +AUTHORS.TXT +# Emacs backup and autosave files... +*~ +.\#* +\#* +# RPM stuff... +MANIFEST +dist +rpm-build +# Eclipse/PyDev stuff... +.project +.pydevproject +# PyCharm stuff... +.idea +#IntelliJ IDEA stuff.. +*.iml +#VSCode stuff.. +.vscode/ +# Mac OS X stuff... +.DS_Store +# manpage build stuff... +docs/man/man1/ansible*.1 +docs/man/man1/ansible*.1.asciidoc.in +docs/man/man3/* +# Sublime stuff +*.sublime-project +*.sublime-workspace +# docsite stuff... +docs/docsite/_build +docs/docsite/*.html +docs/docsite/htmlout +docs/docsite/rst/cli/ansible-*.rst +docs/docsite/rst/cli/ansible.rst +docs/docsite/rst/dev_guide/collections_galaxy_meta.rst +docs/docsite/rst/dev_guide/testing/sanity/index.rst.new +docs/docsite/rst/modules/*.rst +docs/docsite/rst/playbooks_directives.rst +docs/docsite/rst/plugins_by_category.rst +docs/docsite/rst/plugins/*/*.rst +docs/docsite/rst/reference_appendices/config.rst +docs/docsite/rst/reference_appendices/playbooks_keywords.rst +docs/docsite/rst_warnings + without Ansibledocs/docsite/searchindex.js +docs/docsite/_static/*.gif +docs/docsite/_static/*.png +docs/docsite/_static/websupport.js +# deb building stuff... +/debian/ +deb-build +# Vim swap files +*.swp +*.swo +credentials.yml +# test output +*.retry +*.out +*.gz +.pytest_cache/ +.tox +.cache +.pytest_cache +results.xml +coverage.xml +/test/units/cover-html +/test/integration/targets/*/backup/ +/test/cache/* +# Development +/test/develop +venv +Vagrantfile +.vagrant +ansible.egg-info/ +/shippable/ +/test/integration/cloud-config-*.* +!/test/integration/cloud-config-*.*.template +.python-version +# Release directory +packaging/release/ansible_release +/.cache/ +/test/results/ +/test/integration/cloud-config-aws.yml +/test/integration/inventory.networking +/test/integration/inventory.winrm +/test/integration/cloud-config-aws.yml +/test/integration/cloud-config-cs.ini +# python 'rope' stuff +.ropeproject +# local 'ack' config files +.ackrc +# default 'coverage html' results +htmlcov/ +# default 'coverage' tool data +.coverage +# ansible-test coverage results +test/units/.coverage.* +/test/integration/cloud-config-azure.yml +/SYMLINK_CACHE.json +changelogs/.plugin-cache.yaml +.ansible-test-timeout.json +# ansible-test temporary metadata file for use with delgation +/metadata-*.json +# secrets +ibox_vars/*.yaml +collections/ diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/.gitlab-ci.yml b/collections-debian-merged/ansible_collections/infinidat/infinibox/.gitlab-ci.yml new file mode 100644 index 00000000..500ac6ef --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/.gitlab-ci.yml @@ -0,0 +1,43 @@ +--- +# Ref: https://docs.gitlab.com/ce/ci/yaml/README.html + +# CICD environment variables: +# - VAULT_PASSWORD_FILE +# - Type: File +# - Key: VAULT_PASSWORD_FILE +# - Value: +# - i.e. The password that allows one to view the file using "ansible-vault view " + +image: psusdev/gitlab-cicd:v0.8 + +playbook_testing: + stage: test + script: + - python3 -m venv venv + - . ./venv/bin/activate + - export PIP_REQUIRE_VIRTUALENV=true + - pip install -r requirements.txt + - echo "Tested ansible version -> $(ansible --version)" + + # Build and install ansible collection. Find collection version from yml, strip quotes. + - coll_version=$(spruce json galaxy.yml | jq '.version' | sed 's?"??g') + - coll_namespace=$(spruce json galaxy.yml | jq '.namespace' | sed 's?"??g') + - coll_name=$(spruce json galaxy.yml | jq '.name' | sed 's?"??g') + - echo "Collection version -> ${coll_version}" # gitlab's cilint does not like a colon here + - ansible-galaxy collection build + - ansible-galaxy collection install "${coll_namespace}-${coll_name}-${coll_version}.tar.gz" -p ./test_collection -vvv + + # Run testing playbooks + - git_project="ansible-infinidat-collection" + - echo "$git_project commit -> $(git log --max-count=1 --oneline)" + - pushd ./playbooks > /dev/null + - export ANSIBLE_CONFIG="/builds/PSUS/$git_project/playbooks/ansible.cfg" + - export ANSIBLE_FORCE_COLOR=true + - ibox_extra_vars="@../ibox_vars/iboxCICD.yaml" + - verbosity="-vvv" + - ansible-playbook --extra-vars "$ibox_extra_vars" --vault-password-file "$VAULT_PASSWORD_FILE" test_create_resources.yml "${verbosity}" + - ansible-playbook --extra-vars "$ibox_extra_vars" --vault-password-file "$VAULT_PASSWORD_FILE" test_remove_resources.yml "${verbosity}" + - popd > /dev/null + + # Show summery of execution tasks + - ./bin/test_summarize.sh diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/FILES.json b/collections-debian-merged/ansible_collections/infinidat/infinibox/FILES.json new file mode 100644 index 00000000..ad42c03c --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/FILES.json @@ -0,0 +1,313 @@ +{ + "files": [ + { + "format": 1, + "ftype": "dir", + "chksum_sha256": null, + "name": ".", + "chksum_type": null + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "docs", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "67ef89737dc8549aee94287627eb5c3aa24c59548163b4c81df529b7cbaaaf33", + "name": "docs/DEV_README.md", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "bin", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "64c3975eef7e87c3ff7d89dff443921d5c26da52319e7e67e454dbb4d30e01d0", + "name": "bin/check_collection_files.sh", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "b02c4b069ec3f9795f773b3e2f1118b51270692514b3fb0b879c7501f1c94c19", + "name": "bin/test_summarize.sh", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "67ac74b50011063e231274a7f24e2e41decc1a729a981763121fcf73da17df9d", + "name": "bin/install_modules_for_hacking.sh", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "b9bc7cac95fbe63cbb058e8b1c9cb9bff6b3519bf051101c69313c1c59c4937d", + "name": "Makefile", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "d510ba2d701c914381cdcff552b62c3977fb93dbead1be408884557500634f12", + "name": "README.md", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "db58883d98cc91191e7fcc2fd17c8a32e0f56a6317bd50e0e7b60811d3573518", + "name": ".gitlab-ci.yml", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "ibox_vars", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "c5e5ea378ed20e66e96c3fafee6c53845ed534c27804ee82ccdeca7edb23d8e5", + "name": "ibox_vars/iboxCICD.yaml", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "97812c7706f088a4b0f926a7fee966c20ed788fa5ec42814e4f94d2ba66404f8", + "name": "ibox_vars/iboxNNNN_example.yaml", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "playbooks", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "63a7599bea6cdaf464080d620be592bda8202a9d31f8fde2738bbbc91fac5bb5", + "name": "playbooks/test_create_resources.yml", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "6946120d2926bdde34018f3507e119c2e5f7d08e74ab25fe42e9ab61c7d07e62", + "name": "playbooks/ansible.cfg", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "3e94927378358f57ad8fd27a6120f593bc602832b41372d3a54a936d7f060d71", + "name": "playbooks/test_remove_resources.yml", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "plugins", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "plugins/modules", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "cca6147317ffd73ad8ce40cf410dade16af571693fae2087a92cf0607c890d6e", + "name": "plugins/modules/infini_fs.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "ceb2cf6a7efc3b393fe77d21eaabbf4ed576bfd51847ea9730824d3968f493de", + "name": "plugins/modules/infini_port.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "109325825094bc61f244dd5f05befd67da3a3763e10ca3bec05069eba2a943da", + "name": "plugins/modules/infini_map.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "3b201c8241eec87fbc63915edfee0f532d05bb5b2220bd0966706552dd7d2acf", + "name": "plugins/modules/infini_vol.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "plugins/modules/.ropeproject", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "eac2cdce1df329905fc7f6dbd93edde3045f9542baece2b174d83829730e579b", + "name": "plugins/modules/.ropeproject/config.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "ad2598304a8af697d0c335a50a3e5a1ba06c82d9b63ef5f9d3e730b54cf9148a", + "name": "plugins/modules/.ropeproject/objectdb", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "35752d7fbb9aa05b7bdcb16f3e7403b22fc809b90915dbe1a84689f262950cd2", + "name": "plugins/modules/.ropeproject/history", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "ad2598304a8af697d0c335a50a3e5a1ba06c82d9b63ef5f9d3e730b54cf9148a", + "name": "plugins/modules/.ropeproject/globalnames", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "9753c49ead1a0b784b7d2c15c0ad3201d48531a9ed9303273997f72e13583c74", + "name": "plugins/modules/infini_export_client.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "6df7fb62e7a59797f568904a5c9a5e7c29b9e3d533bab4be4647e80f3ec7e8a0", + "name": "plugins/modules/infini_pool.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "d88fabc0863abd87ab7d800cb2eb9a80a413bb33c9579408bc1e5f68c31931f4", + "name": "plugins/modules/infini_cluster.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "b02b678c8a160c99dc8c77963b1f5beb223646a71803276d5f66cb1564d131ad", + "name": "plugins/modules/infini_host.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "aaa4c75ceb6975cd757746165d734ead5296278ed9717c757d9b2df3cead84b4", + "name": "plugins/modules/infini_export.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "46efb4bf13e870e6191afe4f54c40053edb91c255958cc189516d457456b66c5", + "name": "plugins/modules/infini_user.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "name": "plugins/modules/__init__.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "plugins/doc_fragments", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "9d2e6bbc3df326bddbf8bd6045c60d7d112584399cae411788ed8c1ffc8038f9", + "name": "plugins/doc_fragments/infinibox.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "plugins/module_utils", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "e02ce53e618ee30f4d626a412f1da72a99c260d37164de793f4eb59f6fa7f726", + "name": "plugins/module_utils/infinibox.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "dir", + "chksum_sha256": null, + "name": "plugins/filters", + "chksum_type": null, + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "4e9006a26672449bf6dfe9036aace9808335f1ed630a44545e9c3d784dee8dbc", + "name": "plugins/filters/psus_filters.py", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "0a6e1cf2338b2ff279c21561c53f22447e072fb8cbf27861787cd27f640bba25", + "name": "requirements.txt", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "83d7482549a7be497dab08601723471d3205c9ad027fe126d1726e5c4aeddb01", + "name": ".gitignore", + "chksum_type": "sha256", + "format": 1 + }, + { + "ftype": "file", + "chksum_sha256": "e77edcc69dd86480e3392a71e6be429cb9576ed59e49bbb2e9dac4a44b28068f", + "name": "LICENSE", + "chksum_type": "sha256", + "format": 1 + } + ], + "format": 1 +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/LICENSE b/collections-debian-merged/ansible_collections/infinidat/infinibox/LICENSE new file mode 100644 index 00000000..097fffa8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/LICENSE @@ -0,0 +1,202 @@ +Copyright 2020 Infinidat, Inc. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. + +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. + + +Copyright (C) + +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 . + +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: + + Copyright (C) +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 . + +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 . diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/MANIFEST.json b/collections-debian-merged/ansible_collections/infinidat/infinibox/MANIFEST.json new file mode 100644 index 00000000..36640967 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/MANIFEST.json @@ -0,0 +1,43 @@ +{ + "collection_info": { + "description": "A set of Ansible modules that allow simple, but powerful, idempotent interactions with Infinidat InfiniBoxes.", + "repository": "https://www.github.com/infinidat/ansible-infinidat-collection", + "tags": [ + "cloud", + "ibox", + "infinibox", + "infinidat", + "infinisdk", + "nas", + "san", + "storage", + "storage_array", + "storagearray" + ], + "dependencies": {}, + "authors": [ + "Infinidat ", + "David Ohlemacher", + "Gregory Shulov" + ], + "issues": "https://www.github.com/infinidat/ansible-infinidat-collection/issues", + "name": "infinibox", + "license": [ + "GPL-3.0-or-later" + ], + "documentation": null, + "namespace": "infinidat", + "version": "1.2.4", + "readme": "README.md", + "license_file": null, + "homepage": null + }, + "file_manifest_file": { + "format": 1, + "ftype": "file", + "chksum_sha256": "0a3f1a5fcb2a4ebaff166fd6a2ab12708bb5cbaafbe87376f739202a31489e66", + "name": "FILES.json", + "chksum_type": "sha256" + }, + "format": 1 +} \ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/Makefile b/collections-debian-merged/ansible_collections/infinidat/infinibox/Makefile new file mode 100644 index 00000000..b3137d72 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/Makefile @@ -0,0 +1,84 @@ +# A Makefile for creating, running and testing Infindat's Ansible collection. + +### Dependencies ### +# - jq: https://stedolan.github.io/jq/ +# - spruce: https://github.com/geofffranks/spruce + +### environment ### +# Include an env file with secrets. This exposes the secrets +# as envvars only for the life of make. It does not +# pollute the environment persistently. +# Format: +# API_KEY=someAnsibleGalaxyApiKey +# The key only needs to be valid to use target galaxy-colletion-publish. +_env = ~/.ssh/ansible-galaxy.sh +include $(_env) +export $(shell sed 's/=.*//' $(_env)) + +### Vars ### +_version = $(shell spruce json galaxy.yml | jq '.version' | sed 's?"??g') +_namespace = $(shell spruce json galaxy.yml | jq '.namespace' | sed 's?"??g') +_name = $(shell spruce json galaxy.yml | jq '.name' | sed 's?"??g') +_install_path = ~/.ansible/collections +_install_path_local = ./collections + +### General ### +check-vars: +ifeq ($(strip $(API_KEY)),) + @echo "API_KEY variable is unset" && false +endif + +env-show: check-vars + @echo "API_KEY=[ set but redacted ]" + +versions: check-vars + @ansible --version + +### Galaxy ### +_strip_build_dir: + @# Temporarily mv dirs for the build so that it is not included in collection. + mv collections ../collections_tmp || true # Missing is not an error + mv venv ../venv_tmp + @# Check that tmp or hidden files will not be in collection. + @./bin/check_collection_files.sh + +_unstrip_build_dir: + @# Restore dirs + mv ../collections_tmp ./collections || true # Missing is not an error + mv ../venv_tmp ./venv + +galaxy-collection-build: _strip_build_dir + @# Build the collection. + rm -rf collections/ + ansible-galaxy collection build + @make _unstrip_build_dir + +galaxy-collection-build-force: _strip_build_dir + @# Force build the collection. Overwrite an existing collection file. + ansible-galaxy collection build --force + @make _unstrip_build_dir + +galaxy-collection-publish: check-vars + @# Publish the collection to https://galaxy.ansible.com/ using the API key provided. + ansible-galaxy collection publish --api-key $(API_KEY) ./$(_namespace)-$(_name)-$(_version).tar.gz -vvv + +galaxy-collection-install: + @# Download and install from galaxy.ansible.com. + ansible-galaxy collection install $(_namespace).$(_name) --collections-path $(_install_path) --force + +galaxy-collection-install-locally: + @# Download and install from local tar file. + ansible-galaxy collection install $(_namespace)-$(_name)-$(_version).tar.gz --collections-path $(_install_path_local) + +### Playbooks ### +test-create-resources: + @# Run test_create_resources.yml as described in DEV_README.md + cd playbooks && \ + ../venv/bin/ansible-playbook --extra-vars "@../ibox_vars/iboxCICD.yaml" \ + --ask-vault-pass test_create_resources.yml + +test-remove-resources: + @# Run test_remove_resources.yml as described in DEV_README.md + cd playbooks && \ + ../venv/bin/ansible-playbook --extra-vars "@../ibox_vars/iboxCICD.yaml" \ + --ask-vault-pass test_remove_resources.yml diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/README.md b/collections-debian-merged/ansible_collections/infinidat/infinibox/README.md new file mode 100644 index 00000000..348cceb8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/README.md @@ -0,0 +1,65 @@ +# Infinidat's Ansible Collection + +## Platforms Supported +All Infindat InfiniBoxes are supported. + +## Prerequisites +- Ansible 2.9 or newer +- InfiniSDK 151.1.1 or newer. It is likely that earlier versions will also work. + +## Modules +- infini_cluster: Creates, deletes or modifies host clusters. +- infini_export_client: Creates, deletes or modifys NFS client(s) for existing exports. +- infini_export: Creates, deletes or modifies NFS exports. +- infini_fs: Creates, deletes or modifies filesystems. +- infini_host: Creates, deletes or modifies hosts. +- infini_map: Creates or deletes mappings of volumes to hosts. +- infini_pool: Creates, deletes or modifies pools. +- infini_port: Adds or deletes fiber channel or iSCSI ports to hosts. +- infini_user: Creates, deletes or modifies an InfiniBox user. +- infini_vol: Creates, deletes or modifies a volume. + +Most modules also implement a "stat" state. This is used to gather information, aka status, for the resource without making any changes to it. + +## Installation +Install the Infinidat Ansible collection on hosts or within containers using: +`ansible-galaxy collection install infinidat.infi -p ~/.ansible/collections` + +Complete instructions for installing collections is available at https://docs.ansible.com/ansible/latest/user_guide/collections_using.html. + +Ansible 2.9 or newer is required to install as a collection. That said, the collection is a tarball. Modules may be extracted and installed manually if use of an older version of Ansible is required. Adjust values in playbooks/ansible.cfg as required. + +## Usage +Two example playbooks are included in the collection: + +- test_create_resources.yml: A playbook that creates many resources. It also creates resources again to test idempotency. +- test_remove_resources.yml: A playbook that in the end removes the resources created in the test_create_resources playbook. It too will test idempotency by removing resources again. + +These two playbooks serve as a reference to the use of the modules. These exercise all modules demonstrating normal usage, idempotency and error conditions. Individual module documentation is available via `ansible-doc`. + +### Example Usage +Install the collection and cd into the collection's infi/ directory. Create an ibox yaml file in ibox_vars/. Use the example yaml file as a reference. + +The `--ask-vault-pass` options below are only required if the ibox_vars/iboxNNNN.yaml file is encrypted using ansible-vault. +``` +python3.8 -m venv venv +source venv/bin/activate +python -m pip install -U pip +python -m pip install -r requirements.txt +cd playbooks/ +../venv/bin/ansible-playbook --extra-vars "@../ibox_vars/iboxNNNN.yaml" --ask-vault-pass test_create_resources.yml +../venv/bin/ansible-playbook --extra-vars "@../ibox_vars/iboxNNNN.yaml" --ask-vault-pass test_remove_resources.yml +deactivate +``` + +## Removal +To remove the collection, delete the collection from the path specified in the -p option during installation. + +## Copyrights and Licenses +- Copyright: (c) 2020, Infinidat +- GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +## Authors +The initial set of Infindat Ansible modules were written by Gregory Shulov in 2016. + +Infinidat's Professional Services (USA) team extended and improved the modules in 2019. Several modules were added. Idempotency was improved. diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/check_collection_files.sh b/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/check_collection_files.sh new file mode 100755 index 00000000..9cf26aaa --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/check_collection_files.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +set -o nounset +set -o pipefail +set -o noclobber +#set -o errexit + +# To enable info and die functions logging to syslog, set to true. +declare -r enable_syslogging="false" + +# Report error with $leader prepended and die. +# Override leader with an optional replacement. +# Optionally send to logger. +function die { + local msg="$1" + local leader="${2:-Fatal:}" + (>&2 printf "$leader $msg\n") # Subshell avoids interactions with other redirections + if [ "$enable_syslogging" == "true" ]; then + logger -p user.error -t "$(basename $0)" "$leader $msg" + fi + kill -SIGPIPE "$$" # Die with exit code 141 +} + +# Report msg with $leader prepended. +# Override leader with an optional replacement. +# Optionally send to logger. +function info { + local msg="$1" + local leader="${2:-Info:}" + (printf "$leader $msg\n") # Subshell avoids interactions with other redirections + if [ "$enable_syslogging" == "true" ]; then + logger -p user.notice -t "$(basename $0)" "$leader $msg" + fi +} + +# Search for a file glob. +function check_glob { + local -r fglob="$1" + #info "$fglob" "\nTesting" + result="$(find . -name "$fglob")" + if [ -n "$result" ]; then + echo -n "$result\n" + fi +} + +# MAIN +declare found="" +declare foundone="" +declare -ar fglobs=("*.gz" ".*.un~" ".*.swp" ".*.swo" "*.pyc" "venv") + +for fg in "${fglobs[@]}"; do + foundone=$(check_glob "$fg") + if [ -n "$foundone" ]; then + found="${found}${foundone}" + fi +done + +if [ -n "${found}" ]; then + die "Found files that should not be included in collections:\n$found" +fi diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/install_modules_for_hacking.sh b/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/install_modules_for_hacking.sh new file mode 100755 index 00000000..f6868811 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/install_modules_for_hacking.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +##### +# A utility script to copy collection resources into a clone of ansible source code. +# This is useful if using ansible hacking to execute modules without use of playbooks. +# +# Script uses "git rev-parse --show-toplevel" to find the top of the tree in this collection. +# It will fail if this is not a git clone. +##### + +set -o nounset +set -o pipefail +#set -o errexit + +# To enable info and die functions logging to syslog, set to true. +declare -r enable_syslogging="false" + +# Report error with $leader prepended and die. +# Override leader with an optional replacement. +# Optionally send to logger. +function die { + local msg="$1" + local leader="${2:-Fatal:}" + (>&2 printf "$leader $msg\n") # Subshell avoids interactions with other redirections + if [ "$enable_syslogging" == "true" ]; then + logger -p user.error -t "$(basename $0)" "$leader $msg" + fi + kill -SIGPIPE "$$" # Die with exit code 141 +} + +# Report msg with $leader prepended. +# Override leader with an optional replacement. +# Optionally send to logger. +function info { + local msg="$1" + local leader="${2:-Info:}" + (printf "$leader $msg\n") # Subshell avoids interactions with other redirections + if [ "$enable_syslogging" == "true" ]; then + logger -p user.notice -t "$(basename $0)" "$leader $msg" + fi +} + +function get_git_toplevel { + local -r git_toplevel="$(git rev-parse --show-toplevel)" + printf "$git_toplevel" +} + +function install_infindat_modules { + local -r ansible_path="$1" + local -r src="$(get_git_toplevel)/plugins/modules" + local -r dest="$ansible_path/lib/ansible/modules/storage/infinidat/" + info "Copying modules from $src to $dest" "$info_leader" + cp "$src/infini_"*".py" "$dest" \ + || die "Cannot copy modules from $src to $dest" +} + +function install_infindat_module_utils { + local -r ansible_path="$1" + local -r src="$(get_git_toplevel)/plugins/module_utils" + local -r dest="$ansible_path/lib/ansible/module_utils/" + info "Copying module_utils from $src to $dest" "$info_leader" + cp "$src/infinibox.py" "$dest" \ + || die "Cannot copy module_utils from $src to $dest" +} + +function install_infindat_doc_fragments { + local -r ansible_path="$1" + local -r src="$(get_git_toplevel)/plugins/doc_fragments" + local -r dest="$ansible_path/lib/ansible/plugins/doc_fragments/" + info "Copying doc_fragments from $src to $dest" "$info_leader" + cp "$src/infinibox.py" "$dest" \ + || die "Cannot copy doc_fragments from $src to $dest" +} + +function sanity { + local -r ansible_path="$1" + local -r ansible_dir="lib/ansible" + local -r check_this="$ansible_path/$ansible_dir" + + if ! [[ -a "$check_this" ]]; then + die "Cannot find Ansible source at \"$check_this\". Check path to Ansible source clone." + fi +} + +# Main +declare -r info_leader=" " +declare -r ansible_working_copy_path="${1:-}" +if [ -z "${ansible_working_copy_path}" ]; then + die "Provide the path to an Ansible source clone. Example: $0 \"\"" +fi + +info "Copying Infinidat resources to $ansible_working_copy_path" "==" +sanity "$ansible_working_copy_path" +install_infindat_modules "$ansible_working_copy_path" +install_infindat_module_utils "$ansible_working_copy_path" +install_infindat_doc_fragments "$ansible_working_copy_path" +info "Completed copying Infinidat resources to $ansible_working_copy_path" "==" diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/test_summarize.sh b/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/test_summarize.sh new file mode 100755 index 00000000..b40020ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/bin/test_summarize.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +set -o nounset +set -o pipefail +#set -o errexit + +# To enable info and die functions logging to syslog, set to true. +declare -r enable_syslogging="false" + +# Report error with $leader prepended and die. +# Override leader with an optional replacement. +# Optionally send to logger. +function die { + local msg="$1" + local leader="${2:-Fatal:}" + (>&2 printf "$leader $msg\n") # Subshell avoids interactions with other redirections + if [ "$enable_syslogging" == "true" ]; then + logger -p user.error -t "$(basename $0)" "$leader $msg" + fi + kill -SIGPIPE "$$" # Die with exit code 141 +} + +# Report msg with $leader prepended. +# Override leader with an optional replacement. +# Optionally send to logger. +function info { + local msg="$1" + local leader="${2:-Info:}" + (printf "$leader $msg\n") # Subshell avoids interactions with other redirections + if [ "$enable_syslogging" == "true" ]; then + logger -p user.notice -t "$(basename $0)" "$leader $msg" + fi +} + +function summarize { + local -a arr=("./playbooks/test_create_resources.yml" "./playbooks/test_remove_resources.yml") + + for f in "${arr[@]}"; do + info "Test Summary for $f:" "===" + # Replace ansible variable with value + # Strip task name + # Align POSITIVE and NEGATIVE test with IDEMPOTENT test + printf "$(grep "^ - name:" $f \ + | sed \ + -e 's?- name: ??' \ + -e 's?{{ auto_prefix }}?PSUS_ANSIBLE_?g' \ + -e 's?POSITIVE test -> \(.*$\)?\\e[32mPOSITIVE test ---> \1\\e[0m?g' \ + -e 's?NEGATIVE test -> \(.*$\)?\\e[33mNEGATIVE test ---> \1\\e[0m?g' \ + -e 's?IDEMPOTENT test -> \(.*$\)?\\e[35mIDEMPOTENT test -> \1\\e[0m?g' \ + -e 's?ASSERT test -> \(.*$\)?\\e[36mASSERT test -----> \1\\e[0m?g' \ + -e 's?DEBUG test -> \(.*$\)?\\e[37mDEBUG test ------> \1\\e[0m?g' \ + )" + printf "\n\n" + done +} + +# Main +summarize diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/docs/DEV_README.md b/collections-debian-merged/ansible_collections/infinidat/infinibox/docs/DEV_README.md new file mode 100644 index 00000000..2583e58b --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/docs/DEV_README.md @@ -0,0 +1,153 @@ +# Testing of Infinidat's Ansible Modules + +## Conventions +We use "yaml" as the extention for configuration files and "yml" for playbooks and role main.yml files. + +## Set up +- Clone ansible-infinidat-collection from one of: + - https://github.com/infinidat/ansible-infinidat-collection (external) + - https://git.infinidat.com/PSUS/ansible-infinidat-collection (internal) +- Create a Python virtualenv: + - `cd ansible-infinidat-collection` + - `python3 -m venv venv` + - `source venv/bin/activate` + - `sudo apt install libpython3.8-dev libffi-dev` + - `pip install -r requirements.txt` + +## Creating playbook extra-var files +Extra-var files define some Ansible variable necessary for running playbooks. There is an example ./ibox_vars/iboxNNNN_example.yaml. The auto_prefix value is used in the test playbooks within the names of most resources created on the Infinibox. + +Example: +``` + auto_prefix: "PSUS_ANSIBLE_" + user: "user" + password: "passwd" + system: "ibox2233" +``` + +Extra-var files containing secrets should be encrypted using ansible-vault: +- `ansible-vault [encrypt,view,edit] ` + +## Creating a collection +Ansible collections require Ansible 2.9+. Complete instructions for creating and using collections is available from Ansible at https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html. + +A collection is a tarball with a specified set of files and directories that meet Ansible's collection requirements. + +## Creating resources +- `cd ./projects/playbooks` +- The ask-vault-pass option is required if the extra-var file is encrypted. +- `../venv/bin/ansible-playbook --extra-vars "@../ibox_vars/iboxNNNN.yaml" --ask-vault-pass test_create_resources.yml` + - Idempotency: Running playbooks repeatedly work correctly with all tasks showing "ok" (green). + +## Removing resources +- `cd ./projects/playbooks` +- `../venv/bin/ansible-playbook --extra-vars "@../ibox_vars/iboxNNNN.yaml" --ask-vault-pass test_remove_resources.yml` + - Running this repeatedly should work correctly with all tasks showing "ok" (green). + +## Hacking +Hacking lets one execute a module as a normal python script without Ansible. This allows use of print() and pdb for debugging. When executing modules using ansible-playbook, within a task, print statement output from the module are not displayed. + +Modules expect a JSON data file to be provided to them. This represents the equivalent JSON that Ansible would provide the module if the module is called from an Ansible task. The modules also return results to stdout in JSON form. + +### Creating hacking JSON files +Keys within JSON files must define values that match the requirements of the module to be tested. They are exactly equivalent to the fields defined in a task using the same module. + +You may find the requirements of a module using `ansible-doc`. +- Example: + - `ansible-doc infini_vol` + - See the `library` variable in the ansible.cfg file. + - `ansible-doc --module-path=~/ansible/lib/ansible/modules/storage/infinidat infini_export_client` + - This less useful example shows using the module-path option if not defined in your ansible.cfg file. In this case it is providing documentation from a github clone of the Ansible project and the older Infinidat modules Ansible comes with. + +#### Example JSON files: +- `test_logout.json`: + ``` + { + "ANSIBLE_MODULE_ARGS": { + "name": "PSUS_ANSIBLE_logout_pool", + "size": "1TB", + "vsize": "1TB", + "state": "present", + "user": "user", + "password": "passwd", + "system": "ibox1339.lab.gdc.il.infinidat.com" + } + } + ``` +- `test_export_fs.json`: + ``` + { + "ANSIBLE_MODULE_ARGS": { + "name": "/PSUS_ANSIBLE_export", + "filesystem": "PSUS_ANSIBLE_fs", + "client_list": [ + { + "client": "*", + "access": "RO", + "no_root_squash": true + } + ], + "state": "present", + "user": "user", + "password": "passwd", + "system": "ibox1339.lab.gdc.il.infinidat.com" + } + } + ``` +- `test_cluster.json`: + ``` + { + "ANSIBLE_MODULE_ARGS": { + "name": "PSUS_ANSIBLE_cluster", + "cluster_hosts": [ + { + "host_name": "PSUS_ANSIBLE_host", + "host_cluster_state": "present" + } + ], + "state": "present", + "user": "admin", + "password": "passwd", + "system": "ibox1339.lab.gdc.il.infinidat.com" + } + } + ``` + +### Executing modules without playbooks (hacking) +To run Ansible modules directly with Python and without using ansible-playbook, extra steps are required. These are documented by [Ansible module development](https://docs.ansible.com/ansible/2.9/dev_guide/developing_modules_general.html). + +Once your hacking environment is set up, you must copy ansible-infinidat-collection modules, etc. into the appropriate places within your Ansible clone. The virtualenv described above should be used. Source `hacking/env-setup` after activating the virtualenv. +``` +export ansible_clone="" +cd ansible-infinidat-collection/ +cp plugins/modules/infini*.py "$ansible_clone/lib/ansible/modules/storage/infinidat/" +cp plugins/module_utils/infinibox.py "$ansible_clone/lib/ansible/module_utils/" +cp plugins/doc_fragments/infinibox.py "$ansible_clone/lib/ansible/plugins/doc_fragments/" +``` + +`bin/install_modules_for_hacking.sh` may be used to copy the files described above. If executed from anywhere with in the ansible-infinidat-collection working copy, it will find the proper files and copy them into the specified Ansible source clone. The existing files in the clone will be overwritten. +``` +./bin/install_modules_for_hacking.sh +``` + +Run/hack a module: +``` +export test_jsons="" +python -m ansible.modules.storage.infinidat.infini_host "$test_jsons/test_host.json" +python -m ansible.modules.storage.infinidat.infini_host "$test_jsons/test_host.json" 2>&1 | grep -v Insecure +python -m ansible.modules.storage.infinidat.infini_host "$test_jsons/test_host.json" 2>&1 | grep -v Insecure | jq --sort-keys '.' +``` + +### Set colors for those who are color challenged (optional) +Use of jq and pygmentize is not required, but we've found it useful. Use pygmentize to colorize JSON data using the autumn theme. Pymentize may be installed via pip. + +Use jq to pretty print JSON. See https://stedolan.github.io/jq/ +- -c: Optionally, use compact output. This displays JSON in a much shorter form, but may be harder to read. +- --sort-keys: Sort keys. +- The period is the simplest jq filter. It is a null filter showing all input. + +``` +pyg_style="autumn" +jqpyg="pygmentize -O style=$pyg_style -l json" +python -m ansible.modules.storage.infinidat.infini_port test_ports_port.json 2>&1 | grep -v Insecure | jq --sort-keys -c . | eval $jqpyg +``` diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxCICD.yaml b/collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxCICD.yaml new file mode 100644 index 00000000..476b19b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxCICD.yaml @@ -0,0 +1,10 @@ +$ANSIBLE_VAULT;1.1;AES256 +66343034363232313933643233373938303539343932613065656639303736666261396638333565 +6430326563653366353435663339616638396164316633370a303964386364356365663064613766 +36616565626561396434303535663133656562646632383139393866393334383331623133393030 +3838663637366337310a333462633161316239663964653835336534636662393730313731666433 +66646237393738323330383465396437666365626636316162373964653737383034353530306633 +33643337373164376664643465646437316530623363643634323835303030333935346637613236 +61666331366661336234666436656665663464353664363761393866653263356434313232363564 +65346630386262633962386537376234646666326161343738303962306537323162306362636634 +66643231636466646539386137363037346434363962653834353139386434643464 diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxNNNN_example.yaml b/collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxNNNN_example.yaml new file mode 100644 index 00000000..f802b163 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/ibox_vars/iboxNNNN_example.yaml @@ -0,0 +1,12 @@ +# This an example file for setting variables for playbooks like test_create_resources.yml. +# +# It is recommended that these files be encrypted: +# - $ ansible-vault encrypt +# +# Any value for auto_prefix may be used. auto_prefix is used in every resource created by +# the example playbooks, making resources easy to find. + +auto_prefix: "PSUS_ANSIBLE_" +user: "user" +password: "password" +system: "iboxNNNN" diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/ansible.cfg b/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/ansible.cfg new file mode 100644 index 00000000..2024423d --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/ansible.cfg @@ -0,0 +1,6 @@ +[defaults] +doc_fragment_plugins = ../doc_fragments +filter_plugins = ../plugins/filters +library = ../plugins/modules +module_utils = ../plugins/module_utils +roles_path = ../roles diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml b/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml new file mode 100644 index 00000000..ce08238f --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_create_resources.yml @@ -0,0 +1,535 @@ +--- +- hosts: localhost + gather_facts: yes # Required for ansible_date_time + tasks: + + - name: NEGATIVE test -> Create file system named {{ auto_prefix }}fs under a pool that does not exist + infini_fs: + name: "{{ auto_prefix }}fs" + size: 1GB + pool: "{{ auto_prefix }}pool_missing" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "'pool_missing' not in result.msg" + when: not ansible_check_mode + + - name: POSITIVE test -> Create pool {{ auto_prefix }}pool + infini_pool: + name: "{{ auto_prefix }}pool" + size: 1TB + vsize: 1TB + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat pool {{ auto_prefix }}pool + infini_pool: + name: "{{ auto_prefix }}pool" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool + infini_fs: + name: "{{ auto_prefix }}fs" + size: 1GB + pool: "{{ auto_prefix }}pool" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool + infini_fs: + name: "{{ auto_prefix }}fs" + pool: "{{ auto_prefix }}pool" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Export file system {{ auto_prefix }}fs + infini_export: + name: "/{{ auto_prefix }}export" + filesystem: "{{ auto_prefix }}fs" + client_list: + - client: "*" + access: "RO" + no_root_squash: True + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat file system export {{ auto_prefix }}export + infini_export: + name: "/{{ auto_prefix }}export" + filesystem: "{{ auto_prefix }}fs" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: NEGATIVE test -> Export file system {{ auto_prefix }}fs that does not exist + infini_export: + name: "/{{ auto_prefix }}export_missing" + filesystem: "{{ auto_prefix }}fs_missing" + client_list: + - client: "*" + access: "RO" + no_root_squash: True + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "not result.msg | regex_search('File system.*not found')" + when: not ansible_check_mode + + - name: POSITIVE test -> Create export client for export /{{ auto_prefix }}export + infini_export_client: + export: "/{{ auto_prefix }}export" + client: "20.20.20.20" + state: present + access_mode: "RO" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + # TODO - stat export client + + - name: NEGATIVE test -> Create export client for export that does not exist + infini_export_client: + export: "/{{ auto_prefix }}export_missing" + client: 20.20.20.20 + state: present + access_mode: "RO" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "not result.msg | regex_search('Export.*not found')" + when: not ansible_check_mode + + - name: NEGATIVE test -> Create volume {{ auto_prefix }}vol_in_pool_missing under pool that does not exist + infini_vol: + name: "{{ auto_prefix }}vol_in_pool_missing" + size: 1GB + pool: "{{ auto_prefix }}pool_missing" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "'Pool not found' not in result.msg" + # failed_when: "'pool_missing' not in result.msg" + when: not ansible_check_mode + + - name: POSITIVE test -> Create thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool + infini_vol: + name: "{{ auto_prefix }}vol" + size: 1GB + pool: "{{ auto_prefix }}pool" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create thick volume {{ auto_prefix }}vol_thick under pool {{ auto_prefix }}pool + infini_vol: + name: "{{ auto_prefix }}vol_thick" + size: 1GB + pool: "{{ auto_prefix }}pool" + thin_provision: false + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool + infini_vol: + name: "{{ auto_prefix }}vol" + pool: "{{ auto_prefix }}pool" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create snapshot {{ auto_prefix }}vol_snap from volume {{ auto_prefix }}vol + infini_vol: + name: "{{ auto_prefix }}vol_snap" + state: present + volume_type: snapshot + parent_volume_name: "{{ auto_prefix }}vol" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: DEBUG test -> Find the current date-time (WARNING - Time marks when the playbook gathered facts) + debug: + var=ansible_date_time.iso8601_micro + + - name: POSITIVE test -> Create and lock for 2 minutes snapshot {{ auto_prefix }}vol_snap_locked from volume {{ auto_prefix }}vol + infini_vol: + name: "{{ auto_prefix }}vol_snap_locked" + state: present + volume_type: snapshot + parent_volume_name: "{{ auto_prefix }}vol" + snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | delta_time(minutes=2) }}" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + vars: + fmt: "%Y-%m-%dT%H:%M:%S.%fZ" + + - name: POSITIVE test -> Extend lock to 3 minutes for {{ auto_prefix }}vol_snap_locked without refresh + infini_vol: + name: "{{ auto_prefix }}vol_snap_locked" + state: present + volume_type: snapshot + parent_volume_name: "{{ auto_prefix }}vol" + snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | delta_time(minutes=3) }}" + snapshot_lock_only: true + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + vars: + fmt: "%Y-%m-%dT%H:%M:%S.%fZ" + + - name: NEGATIVE test -> Attempt to extend lock without refresh on a snapshot that does not exist. + infini_vol: + name: "{{ auto_prefix }}vol_snap_locked_missing" + state: present + volume_type: snapshot + parent_volume_name: "{{ auto_prefix }}vol" + snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | delta_time(minutes=3) }}" + snapshot_lock_only: true + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "not result.msg | regex_search('Snapshot does not exist. Cannot comply')" + vars: + fmt: "%Y-%m-%dT%H:%M:%S.%fZ" + + - name: NEGATIVE test -> Attempt to create snapshot locked for 31 days, 31 days exceeds 30 day maximum lock time enforced by infini_vol module (not api) + infini_vol: + name: "{{ auto_prefix }}vol_snap_locked_too_long" + state: present + volume_type: snapshot + parent_volume_name: "{{ auto_prefix }}vol" + snapshot_lock_expires_at: "{{ ansible_date_time.iso8601_micro | to_datetime(fmt) | delta_time(days=31) }}" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "not result.msg | regex_search('snapshot_lock_expires_at exceeds.*days in the future')" + vars: + fmt: "%Y-%m-%dT%H:%M:%S.%fZ" + + - name: NEGATIVE test -> Attempt to remove locked snapshot {{ auto_prefix }}vol_snap_locked + infini_vol: + name: "{{ auto_prefix }}vol_snap_locked" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "'Cannot delete snapshot. Locked' not in result.msg" + + - name: POSITIVE test -> Wait for lock on {{ auto_prefix }}vol_snap_locked to expire + pause: + seconds: 181 + prompt: Waiting for {{ auto_prefix }}vol_snap_locked to expire + + - name: POSITIVE test -> Remove snapshot {{ auto_prefix }}vol_snap_locked with expired lock + infini_vol: + name: "{{ auto_prefix }}vol_snap_locked" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create host {{ auto_prefix }}host + infini_host: + name: "{{ auto_prefix }}host" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + # Second host used for testing infini_cluster + - name: POSITIVE test -> Create host {{ auto_prefix }}host2 + infini_host: + name: "{{ auto_prefix }}host2" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat host {{ auto_prefix }}host + infini_host: + name: "{{ auto_prefix }}host" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Add one wwns port to {{ auto_prefix }}host + infini_port: + host: PSUS_ANSIBLE_host + state: present + wwns: + - "21:00:00:24:ff:78:69:e4" + # iqns: [] + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Add a second wwn port plus two iscsi ports to {{ auto_prefix }}host + infini_port: + host: PSUS_ANSIBLE_host + state: present + wwns: + - "21:00:00:24:ff:78:69:e5" + iqns: + - "iqn.1998-01.com.vmware:5d2f90f6-1987-c06c-4d2f-246e9602d5e0-aaaaaaaa" + - "iqn.1998-01.com.vmware:5d2f90f6-1987-c06c-4d2f-246e9602d5e0-bbbbbbbb" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat ports on {{ auto_prefix }}host + infini_port: + host: PSUS_ANSIBLE_host + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat host {{ auto_prefix }}host after ports added + infini_host: + name: "{{ auto_prefix }}host" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: NEGATIVE test -> Map volume {{ auto_prefix }}vol to host that does not exist + infini_map: + host: "{{ auto_prefix }}host_missing" + volume: "{{ auto_prefix }}vol" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "not result.msg | regex_search('Host.*not found')" + when: not ansible_check_mode + + - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host + infini_map: + host: "{{ auto_prefix }}host" + volume: "{{ auto_prefix }}vol" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host + infini_map: + host: "{{ auto_prefix }}host" + volume: "{{ auto_prefix }}vol" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host + infini_map: + host: "{{auto_prefix }}host" + volume: "{{auto_prefix }}vol" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Map volume {{ auto_prefix }}vol to host {{ auto_prefix }}host using lun 0 + infini_map: + host: "{{ auto_prefix }}host" + volume: "{{ auto_prefix }}vol" + lun: 0 + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat map of volume {{ auto_prefix }}vol to host {{ auto_prefix }}host using lun 0 + infini_map: + host: "{{ auto_prefix }}host" + volume: "{{ auto_prefix }}vol" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: check_lun + tags: + - dev + + - name: ASSERT test -> Check lun 0 set + assert: + that: + - check_lun.volume_lun == 0 + tags: + - dev + + - name: POSITIVE test -> Create user {{ auto_prefix }}pool_admin_user with pool_admin role managing pool {{ auto_prefix }}pool + infini_user: + user_name: "{{ auto_prefix }}pool_admin_user" + user_email: "{{ auto_prefix }}pool_admin_user@example.com" + user_password: "secret1" + user_role: "pool_admin" + user_enabled: "true" + user_pool: "{{ auto_prefix }}pool" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Disable user {{ auto_prefix }}pool_admin_user + infini_user: + user_name: "{{ auto_prefix }}pool_admin_user" + user_email: "{{ auto_prefix }}pool_admin_user@example.com" + user_password: "secret1" + user_role: "pool_admin" + user_enabled: "false" + user_pool: "{{ auto_prefix }}pool" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Stat user {{ auto_prefix }}pool_admin_user + infini_user: + user_name: "{{ auto_prefix }}pool_admin_user" + state: stat + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Reset password for user {{ auto_prefix }}pool_admin_user + infini_user: + user_name: "{{ auto_prefix }}pool_admin_user" + user_password: "secret_new" + state: reset_password + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create user {{ auto_prefix }}admin_user with admin role + infini_user: + user_name: "{{ auto_prefix }}admin_user" + user_email: "{{ auto_prefix }}admin_user@example.com" + user_password: "secret2" + user_role: "admin" + user_enabled: "true" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create user {{ auto_prefix }}read_only_user with read_only role + infini_user: + user_name: "{{ auto_prefix }}read_only_user" + user_email: "{{ auto_prefix }}read_only_user@example.com" + user_password: "secret3" + user_role: "read_only" + user_enabled: "true" + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Create cluster {{ auto_prefix }}cluster with two hosts + infini_cluster: + name: "{{ auto_prefix }}cluster" + cluster_hosts: + - host_name: "{{ auto_prefix }}host" + host_cluster_state: present + - host_name: "{{ auto_prefix }}host2" + host_cluster_state: present + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove {{ auto_prefix }}host from cluster {{ auto_prefix }}cluster. Leave {{ auto_prefix }}host2. + infini_cluster: + name: "{{ auto_prefix }}cluster" + cluster_hosts: + - host_name: "{{ auto_prefix }}host" + host_cluster_state: absent + - host_name: "{{ auto_prefix }}host2" + host_cluster_state: present + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Re-add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster. Remove {{ auto_prefix }}host2. + infini_cluster: + name: "{{ auto_prefix }}cluster" + cluster_hosts: + - host_name: "{{ auto_prefix }}host" + host_cluster_state: present + - host_name: "{{ auto_prefix }}host2" + host_cluster_state: absent + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Re-add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster again. Remove {{ auto_prefix }}host2 again. + infini_cluster: + name: "{{ auto_prefix }}cluster" + cluster_hosts: + - host_name: "{{ auto_prefix }}host" + host_cluster_state: present + - host_name: "{{ auto_prefix }}host2" + host_cluster_state: absent + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: NEGATIVE test -> Attempt to add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster with missing host_cluster_state key:value + infini_cluster: + name: "{{ auto_prefix }}cluster" + cluster_hosts: + - host_name: "{{ auto_prefix }}host" + # host_cluster_state: present + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "'require host_name and host_cluster_state' not in result.msg" + + - name: NEGATIVE test -> Attempt to add {{ auto_prefix }}host to cluster {{ auto_prefix }}cluster with an unsupported key:value + infini_cluster: + name: "{{ auto_prefix }}cluster" + cluster_hosts: + - host_name: "{{ auto_prefix }}host" + host_cluster_state: present + host_unknown_key: unknown_value + state: present + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + register: result + failed_when: "'require host_name and host_cluster_state' not in result.msg" diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml b/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml new file mode 100644 index 00000000..12b8cfac --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/playbooks/test_remove_resources.yml @@ -0,0 +1,206 @@ +--- +- hosts: localhost + gather_facts: no + tasks: + - name: POSITIVE test -> Remove cluster {{ auto_prefix }}cluster + infini_cluster: + name: "{{ auto_prefix }}cluster" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove cluster {{ auto_prefix }}cluster again + infini_cluster: + name: "{{ auto_prefix }}cluster" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host + infini_map: + host: "{{auto_prefix }}host" + volume: "{{auto_prefix }}vol" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove mapping of volume {{ auto_prefix }}vol from host {{ auto_prefix }}host again + infini_map: + host: "{{auto_prefix }}host" + volume: "{{auto_prefix }}vol" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove host {{ auto_prefix }}host + infini_host: + name: "{{auto_prefix }}host" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove host {{ auto_prefix }}host2 + infini_host: + name: "{{auto_prefix }}host2" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove host {{ auto_prefix }}host again + infini_host: + name: "{{auto_prefix }}host" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove export client for export /{{ auto_prefix }}export + infini_export_client: + client: 20.20.20.20 + state: absent + access_mode: "RO" + export: "/{{ auto_prefix }}export" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove export client for export /{{ auto_prefix }}export again + infini_export_client: + client: 20.20.20.20 + state: absent + access_mode: "RO" + export: "/{{ auto_prefix }}export" + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove export {{ auto_prefix }}export of file system {{ auto_prefix }}fs + infini_export: + name: "/{{ auto_prefix }}export" + filesystem: "{{ auto_prefix }}fs" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove export {{ auto_prefix }}export of file system {{ auto_prefix }}fs again + infini_export: + name: "/{{ auto_prefix }}export" + filesystem: "{{ auto_prefix }}fs" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool + infini_fs: + name: "{{ auto_prefix }}fs" + size: 1GB + pool: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove file system named {{ auto_prefix }}fs under pool {{ auto_prefix }}pool again + infini_fs: + name: "{{ auto_prefix }}fs" + size: 1GB + pool: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove thin volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool + infini_vol: + name: "{{ auto_prefix }}vol" + pool: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove thick volume {{ auto_prefix }}vol_thick under pool {{ auto_prefix }}pool + infini_vol: + name: "{{ auto_prefix }}vol_thick" + pool: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove volume {{ auto_prefix }}vol under pool {{ auto_prefix }}pool again + infini_vol: + name: "{{ auto_prefix }}vol" + pool: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove pool {{ auto_prefix }}pool + infini_pool: + name: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove snapshot {{ auto_prefix }}vol_snap + infini_vol: + name: "{{ auto_prefix }}vol_snap" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove file system named {{ auto_prefix }}fs again from now missing pool {{ auto_prefix }}pool + infini_fs: + name: "{{ auto_prefix }}fs" + size: 1GB + pool: "{{ auto_prefix }}pool" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove user {{ auto_prefix }}read_only_user + infini_user: + user_name: "{{ auto_prefix }}read_only_user" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove user {{ auto_prefix }}admin_user + infini_user: + user_name: "{{ auto_prefix }}admin_user" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: POSITIVE test -> Remove user {{ auto_prefix }}pool_admin_user + infini_user: + user_name: "{{ auto_prefix }}pool_admin_user" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + - name: IDEMPOTENT test -> Remove user {{ auto_prefix }}pool_admin_user again + infini_user: + user_name: "{{ auto_prefix }}pool_admin_user" + state: absent + user: "{{ user }}" + password: "{{ password }}" + system: "{{ system }}" + + diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/doc_fragments/infinibox.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/doc_fragments/infinibox.py new file mode 100644 index 00000000..e0939395 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/doc_fragments/infinibox.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +class ModuleDocFragment(object): + + # Standard Infinibox documentation fragment + DOCUMENTATION = r''' +options: + system: + description: + - Infinibox Hostname or IPv4 Address. + type: str + required: true + user: + description: + - Infinibox User username with sufficient priveledges ( see notes ). + required: false + password: + description: + - Infinibox User password. + type: str +notes: + - This module requires infinisdk python library + - You must set INFINIBOX_USER and INFINIBOX_PASSWORD environment variables + if user and password arguments are not passed to the module directly + - Ansible uses the infinisdk configuration file C(~/.infinidat/infinisdk.ini) if no credentials are provided. + See U(http://infinisdk.readthedocs.io/en/latest/getting_started.html) + - All Infinidat modules support check mode (--check). However, a dryrun that creates + resources may fail if the resource dependencies are not met for a task. + For example, consider a task that creates a volume in a pool. + If the pool does not exist, the volume creation task will fail. + It will fail even if there was a previous task in the playbook that would have created the pool but + did not because the pool creation was also part of the dry run. +requirements: + - python2 >= 2.7 or python3 >= 3.6 + - infinisdk (https://infinisdk.readthedocs.io/en/latest/) +''' diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/filters/psus_filters.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/filters/psus_filters.py new file mode 100644 index 00000000..adcefbe1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/filters/psus_filters.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +from ansible.errors import AnsibleError +import datetime + +def delta_time(dt, **kwargs): + """ + Add to the time. + Ref: https://docs.python.org/3.6/library/datetime.html#timedelta-objects + """ + return dt + datetime.timedelta(**kwargs) + +class FilterModule(object): + """ + A filter look up class for custom filter plugins. + Ref: https://www.dasblinkenlichten.com/creating-ansible-filter-plugins/ + """ + def filters(self): + """ + Lookup the filter function by name and execute it. + """ + return self.filter_map + + filter_map = { + 'delta_time': delta_time, + } diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/module_utils/infinibox.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/module_utils/infinibox.py new file mode 100644 index 00000000..2ec4bb1e --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/module_utils/infinibox.py @@ -0,0 +1,216 @@ +# -*- coding: utf-8 -*- +# 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) 2020, Infinidat +# 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. + + + +HAS_INFINISDK = True +try: + from infinisdk import InfiniBox, core +except ImportError: + HAS_INFINISDK = False + +from functools import wraps +from os import environ +from os import path +from datetime import datetime +from infinisdk.core.exceptions import ObjectNotFound + + +def unixMillisecondsToDate(unix_ms): + return (datetime.utcfromtimestamp(unix_ms/1000.), 'UTC') + + +def api_wrapper(func): + """ Catch API Errors Decorator""" + @wraps(func) + def __wrapper(*args, **kwargs): + module = args[0] + try: + return func(*args, **kwargs) + except core.exceptions.APICommandException as e: + module.fail_json(msg=e.message) + except core.exceptions.SystemNotFoundException as e: + module.fail_json(msg=e.message) + except Exception: + raise + return __wrapper + + +@api_wrapper +def get_system(module): + """Return System Object or Fail""" + box = module.params['system'] + user = module.params.get('user', None) + password = module.params.get('password', None) + + if user and password: + system = InfiniBox(box, auth=(user, password), use_ssl=True) + elif environ.get('INFINIBOX_USER') and environ.get('INFINIBOX_PASSWORD'): + system = InfiniBox(box, \ + auth=(environ.get('INFINIBOX_USER'), \ + environ.get('INFINIBOX_PASSWORD')), \ + use_ssl=True) + elif path.isfile(path.expanduser('~') + '/.infinidat/infinisdk.ini'): + system = InfiniBox(box, use_ssl=True) + else: + module.fail_json(msg="You must set INFINIBOX_USER and INFINIBOX_PASSWORD environment variables or set username/password module arguments") + + try: + system.login() + except Exception: + module.fail_json(msg="Infinibox authentication failed. Check your credentials") + return system + + +def infinibox_argument_spec(): + """Return standard base dictionary used for the argument_spec argument in AnsibleModule""" + return dict( + system=dict(required=True), + user=dict(), + password=dict(no_log=True), + ) + + +def infinibox_required_together(): + """Return the default list used for the required_together argument to AnsibleModule""" + return [['user', 'password']] + + +def merge_two_dicts(dict1, dict2): + """ + Merge two dicts into one and return. + result = {**dict1, **dict2} only works in py3.5+. + """ + result = dict1.copy() + result.update(dict2) + return result + + +@api_wrapper +def get_pool(module, system): + """ + Return Pool. Try key look up using 'pool', or if that fails, 'name'. + If the pool is not found, return None. + """ + try: + try: + name = module.params['pool'] + except KeyError: + name = module.params['name'] + return system.pools.get(name=name) + except Exception: + return None + + +@api_wrapper +def get_filesystem(module, system): + """Return Filesystem or None""" + try: + try: + filesystem = system.filesystems.get(name=module.params['filesystem']) + except KeyError: + filesystem = system.filesystems.get(name=module.params['name']) + return filesystem + except Exception: + return None + + +@api_wrapper +def get_export(module, system): + """Return export if found or None if not found""" + try: + try: + export_name = module.params['export'] + except KeyError: + export_name = module.params['name'] + + export = system.exports.get(export_path=export_name) + except ObjectNotFound as err: + return None + + return export + + +@api_wrapper +def get_volume(module, system): + """Return Volume or None""" + try: + try: + volume = system.volumes.get(name=module.params['name']) + except KeyError: + volume = system.volumes.get(name=module.params['volume']) + return volume + except Exception: + return None + + +@api_wrapper +def get_host(module, system): + """Find a host by the name specified in the module""" + host = None + + for a_host in system.hosts.to_list(): + a_host_name = a_host.get_name() + try: + host_param = module.params['name'] + except KeyError: + host_param = module.params['host'] + + if a_host_name == host_param: + host = a_host + break + return host + + +@api_wrapper +def get_cluster(module, system): + """Find a cluster by the name specified in the module""" + cluster = None + #print("dir:", dir(system)) + + for a_cluster in system.host_clusters.to_list(): + a_cluster_name = a_cluster.get_name() + cluster_param = module.params['name'] + + if a_cluster_name == cluster_param: + cluster = a_cluster + break + return cluster + + +@api_wrapper +def get_user(module, system): + """Find a user by the user_name specified in the module""" + user = None + user_name = module.params['user_name'] + try: + user = system.users.get(name=user_name) + except ObjectNotFound: + pass + return user diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/config.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/config.py new file mode 100644 index 00000000..dee2d1ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/config.py @@ -0,0 +1,114 @@ +# The default ``config.py`` +# flake8: noqa + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject', + '.hg', '.svn', '_svn', '.git', '.tox'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + # prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + # prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + # prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will insert new module imports as + # `from import ` by default. + prefs['prefer_module_from_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will remove all top-level import statements and + # reinsert them at the top of the module when making changes. + prefs['pull_imports_to_top'] = True + + # If `True`, rope will sort imports alphabetically by module name instead + # of alphabetically by import statement, with from imports after normal + # imports. + prefs['sort_imports_alphabetically'] = False + + # Location of implementation of + # rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general + # case, you don't have to change this value, unless you're an rope expert. + # Change this value to inject you own implementations of interfaces + # listed in module rope.base.oi.type_hinting.providers.interfaces + # For example, you can add you own providers for Django Models, or disable + # the search type-hinting in a class hierarchy, etc. + prefs['type_hinting_factory'] = ( + 'rope.base.oi.type_hinting.factory.default_type_hinting_factory') + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/globalnames b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/globalnames new file mode 100644 index 00000000..0a47446c Binary files /dev/null and b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/globalnames differ diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/history b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/history new file mode 100644 index 00000000..4490a5d9 Binary files /dev/null and b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/history differ diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/objectdb b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/objectdb new file mode 100644 index 00000000..0a47446c Binary files /dev/null and b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/.ropeproject/objectdb differ diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/__init__.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_cluster.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_cluster.py new file mode 100644 index 00000000..1b7e363b --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_cluster.py @@ -0,0 +1,264 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 +from infi.dtypes.iqn import make_iscsi_name + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_cluster +version_added: 2.9 +short_description: Create, Delete and Modify Host Cluster on Infinibox +description: + - This module creates, deletes or modifies host clusters on Infinibox. +author: David Ohlemacher (@ohlemacher) +options: + name: + description: + - Cluster Name + required: true + state: + description: + - Creates/Modifies Cluster when present, removes when absent, or provides + details of a cluster when stat. + required: false + default: present + choices: [ "stat", "present", "absent" ] +extends_documentation_fragment: + - infinibox +''' + +EXAMPLES = r''' +- name: Create new cluster + infini_cluster: + name: foo_cluster + user: admin + password: secret + system: ibox001 +''' + +# RETURN = r''' # ''' + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_system, get_cluster, unixMillisecondsToDate, merge_two_dicts + + +@api_wrapper +def get_host_by_name(system, host_name): + """Find a host by the name specified in the module""" + host = None + + for a_host in system.hosts.to_list(): + a_host_name = a_host.get_name() + if a_host_name == host_name: + host = a_host + break + return host + + +@api_wrapper +def create_cluster(module, system): + print("create cluster") + changed = True + if not module.check_mode: + cluster = system.host_clusters.create(name=module.params['name']) + cluster_hosts = module.params['cluster_hosts'] + for cluster_host in cluster_hosts: + if cluster_host['host_cluster_state'] == 'present': + host = get_host_by_name(system, cluster_host['host_name']) + cluster.add_host(host) + print("Added host {0} to cluster {1}".format(host.get_name, cluster.get_name())) + else: + print("Skipped adding (absent) host {0} to cluster {1}".format(host.get_name, cluster.get_name())) + return changed + + +@api_wrapper +def update_cluster(module, system, cluster): + print("update cluster") + changed = False + + # e.g. of one host dict found in the module.params['cluster_hosts'] list: + # {host_name: <'some_name'>, host_cluster_state: <'present' or 'absent'>} + module_cluster_hosts = module.params['cluster_hosts'] + current_cluster_hosts_names = [host.get_name() for host in cluster.get_field('hosts')] + print("current_cluster_hosts_names:", current_cluster_hosts_names) + for module_cluster_host in module_cluster_hosts: + module_cluster_host_name = module_cluster_host['host_name'] + print("module_cluster_host_name:", module_cluster_host_name) + # Need to add host to cluster? + if module_cluster_host_name not in current_cluster_hosts_names: + if module_cluster_host['host_cluster_state'] == 'present': + host = get_host_by_name(system, module_cluster_host_name) + if not host: + msg = 'Cannot find host {0} to add to cluster {1}'.format( + module_cluster_host_name, + cluster.get_name(), + ) + module.fail_json(msg=msg) + cluster.add_host(host) + print("Added host {0} to cluster {1}".format(host.get_name(), cluster.get_name())) + changed = True + # Need to remove host from cluster? + elif module_cluster_host_name in current_cluster_hosts_names: + if module_cluster_host['host_cluster_state'] == 'absent': + host = get_host_by_name(system, module_cluster_host_name) + if not host: + msg = 'Cannot find host {0} to add to cluster {1}'.format( + module_cluster_host_name, + cluster.get_name(), + ) + module.fail_json(msg=msg) + cluster.remove_host(host) + print("Removed host {0} from cluster {1}".format(host.get_name(), cluster.get_name())) + changed = True + return changed + + +@api_wrapper +def delete_cluster(module, cluster): + assert cluster, "Cluster not found" + changed = True + if not module.check_mode: + cluster.delete() + return changed + + +def get_sys_cluster(module): + system = get_system(module) + cluster = get_cluster(module, system) + return (system, cluster) + + +def get_cluster_fields(cluster): + fields = cluster.get_fields(from_cache=True, raw_value=True) + created_at, created_at_timezone = unixMillisecondsToDate(fields.get('created_at', None)) + field_dict = dict( + hosts=[], + id=cluster.id, + created_at=created_at, + created_at_timezone=created_at_timezone, + ) + hosts = cluster.get_hosts() + for host in hosts: + host_dict = { + 'host_id': host.id, + 'host_name': host.get_name(), + } + field_dict['hosts'].append(host_dict) + return field_dict + + +def handle_stat(module): + system, cluster = get_sys_cluster(module) + cluster_name = module.params["name"] + if not cluster: + module.fail_json(msg='Cluster {0} not found'.format(cluster_name)) + field_dict = get_cluster_fields(cluster) + result = dict( + changed=False, + msg='Cluster stat found' + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + system, cluster = get_sys_cluster(module) + cluster_name = module.params["name"] + if not cluster: + changed = create_cluster(module, system) + msg='Cluster {0} created'.format(cluster_name) + module.exit_json(changed=changed, msg=msg) + else: + changed = update_cluster(module, system, cluster) + if changed: + msg='Cluster {0} updated'.format(cluster_name) + else: + msg='Cluster {0} required no changes'.format(cluster_name) + module.exit_json(changed=changed, msg=msg) + + +def handle_absent(module): + system, cluster = get_sys_cluster(module) + cluster_name = module.params["name"] + if not cluster: + changed = False + msg="Cluster {0} already absent".format(cluster_name) + else: + changed = delete_cluster(module, cluster) + msg="Cluster {0} removed".format(cluster_name) + module.exit_json(changed=changed, msg=msg) + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def check_options(module): + state = module.params['state'] + if state == 'present': + if module.params['cluster_hosts'] is None: + module.fail_json(msg='Option cluster_hosts, a list, must be provided') + + cluster_hosts = module.params['cluster_hosts'] + for host in cluster_hosts: + try: + # Check host has required keys + valid_keys = ['host_name', 'host_cluster_state'] + for valid_key in valid_keys: + _ = host[valid_key] + # Check host has no unknown keys + if len(host.keys()) != len(valid_keys): + raise KeyError + except KeyError: + msg = 'With state present, all cluster_hosts ' \ + + 'require host_name and host_cluster_state key:values ' \ + + 'and no others' + module.fail_json(msg=msg) + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + name=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + cluster_hosts=dict(required=False, type=list), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + + check_options(module) + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export.py new file mode 100644 index 00000000..641242a0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export.py @@ -0,0 +1,264 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat(info@infinidat.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 + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_export +version_added: 2.3 +short_description: Create, Delete or Modify NFS Exports on Infinibox +description: + - This module creates, deletes or modifies NFS exports on Infinibox. +author: Gregory Shulov (@GR360RY) +options: + name: + description: + - Export name. Must start with a forward slash, e.g. name=/data. + required: true + state: + description: + - Creates/Modifies export when present, removes when absent, or provides + export details with stat. + required: false + default: "present" + choices: [ "stat", "present", "absent" ] + client_list: + description: + - List of dictionaries with client entries. See examples. + Check infini_export_client module to modify individual NFS client entries for export. + default: "All Hosts(*), RW, no_root_squash: True" + required: false + filesystem: + description: + - Name of exported file system. + required: true +extends_documentation_fragment: + - infinibox +requirements: + - munch +''' + +EXAMPLES = r''' +- name: Export bar filesystem under foo pool as /data + infini_export: + name: /data01 + filesystem: foo + state: present # Default + user: admin + password: secret + system: ibox001 + +- name: Get status of export bar filesystem under foo pool as /data + infini_export: + name: /data01 + filesystem: foo + state: stat + user: admin + password: secret + system: ibox001 + +- name: Remove export bar filesystem under foo pool as /data + infini_export: + name: /data01 + filesystem: foo + state: absent + user: admin + password: secret + system: ibox001 + +- name: Export and specify client list explicitly + infini_export: + name: /data02 + filesystem: foo + client_list: + - client: 192.168.0.2 + access: RW + no_root_squash: True + - client: 192.168.0.100 + access: RO + no_root_squash: False + - client: 192.168.0.10-192.168.0.20 + access: RO + no_root_squash: False + system: ibox001 + user: admin + password: secret +''' + +# RETURN = r''' # ''' +import traceback + +MUNCH_IMP_ERR = None +try: + from munch import unmunchify + HAS_MUNCH = True +except ImportError: + MUNCH_IMP_ERR = traceback.format_exc() + HAS_MUNCH = False + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_system, get_filesystem, get_export, merge_two_dicts + + +def transform(d): + return frozenset(d.items()) + + +def create_export(module, export, filesystem, system): + """ Create new filesystem or update existing one""" + assert not export + changed = False + + name = module.params['name'] + client_list = module.params['client_list'] + + if not module.check_mode: + export = system.exports.create(export_path=name, filesystem=filesystem) + if client_list: + export.update_permissions(client_list) + changed = True + return changed + + +@api_wrapper +def update_export(module, export, filesystem, system): + """ Create new filesystem or update existing one""" + assert export + changed = False + + name = module.params['name'] + client_list = module.params['client_list'] + + if client_list: + if set(map(transform, unmunchify(export.get_permissions()))) \ + != set(map(transform, client_list)): + if not module.check_mode: + export.update_permissions(client_list) + changed = True + return changed + + +@api_wrapper +def delete_export(module, export): + """ Delete file system""" + if not module.check_mode: + export.delete() + changed = True + return changed + + +def get_sys_exp_fs(module): + system = get_system(module) + filesystem = get_filesystem(module, system) + export = get_export(module, system) + return (system, export, filesystem) + + +def get_export_fields(export): + fields = export.get_fields() #from_cache=True, raw_value=True) + export_id = fields.get('id', None) + permissions = fields.get('permissions', None) + enabled = fields.get('enabled', None) + field_dict = dict( + id=export_id, + permissions=permissions, + enabled=enabled, + ) + return field_dict + + +def handle_stat(module): + """ + Gather stats on export and return. Changed is always False. + """ + system, export, filesystem = get_sys_exp_fs(module) + if not export: + module.fail_json(msg='Export "{}" of file system "{}" not found'.format( + module.params['name'], + module.params['filesystem'], + )) + + field_dict = get_export_fields(export) + result = dict( + changed=False, + msg='File system stat found' + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + system, export, filesystem = get_sys_exp_fs(module) + if not filesystem: + module.fail_json(msg='File system {0} not found'.format(module.params['filesystem'])) + elif not export: + changed = create_export(module, export, filesystem, system) + module.exit_json(changed=changed, msg="File system export created") + else: + changed = update_export(module, export, filesystem, system) + module.exit_json(changed=changed, msg="File system export updated") + + +def handle_absent(module): + system, export, filesystem = get_sys_exp_fs(module) + if not export: + changed = False + msg="Export of {0} already absent".format(module.params['filesystem']) + module.exit_json(changed=changed, msg=msg) + else: + changed = delete_export(module, export) + msg="Export of {0} deleted".format(module.params['filesystem']) + module.exit_json(changed=changed, msg=msg) + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + name=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + filesystem=dict(required=True), + client_list=dict(type='list') + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + if not HAS_MUNCH: + module.fail_json(msg=missing_required_lib('munch'), exception=MUNCH_IMP_ERR) + + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export_client.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export_client.py new file mode 100644 index 00000000..fa2d7a5e --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_export_client.py @@ -0,0 +1,263 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_export_client +version_added: 2.3 +short_description: Create, Delete or Modify NFS Client(s) for existing exports on Infinibox +description: + - This module creates, deletes or modifys NFS client(s) for existing exports on Infinibox. +author: Gregory Shulov (@GR360RY) +options: + client: + description: + - Client IP or Range. Ranges can be defined as follows + 192.168.0.1-192.168.0.254. + aliases: ['name'] + required: true + state: + description: + - Creates/Modifies client when present and removes when absent. + required: false + default: "present" + choices: [ "present", "absent" ] + access_mode: + description: + - Read Write or Read Only Access. + choices: [ "RW", "RO" ] + default: RW + required: false + no_root_squash: + description: + - Don't squash root user to anonymous. Will be set to "no" on creation if not specified explicitly. + type: bool + default: no + required: false + export: + description: + - Name of the export. + required: true +extends_documentation_fragment: + - infinibox +requirements: + - munch +''' + +EXAMPLES = r''' +- name: Make sure nfs client 10.0.0.1 is configured for export. Allow root access + infini_export_client: + client: 10.0.0.1 + access_mode: RW + no_root_squash: yes + export: /data + state: present # Default + user: admin + password: secret + system: ibox001 + +- name: Add multiple clients with RO access. Squash root privileges + infini_export_client: + client: "{{ item }}" + access_mode: RO + no_root_squash: no + export: /data + user: admin + password: secret + system: ibox001 + with_items: + - 10.0.0.2 + - 10.0.0.3 +''' + +# RETURN = r''' # ''' + +import traceback + +MUNCH_IMP_ERR = None +try: + from munch import Munch, unmunchify + HAS_MUNCH = True +except ImportError: + MUNCH_IMP_ERR = traceback.format_exc() + HAS_MUNCH = False + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_system, get_export, merge_two_dicts + + +@api_wrapper +def update_client(module, export): + """ + Update export client list. Note that this will replace existing clients. + """ + + changed = False + + client = module.params['client'] + access_mode = module.params['access_mode'] + no_root_squash = module.params['no_root_squash'] + + client_list = export.get_permissions() + client_not_in_list = True + + for item in client_list: + if item.client == client: # Update client + client_not_in_list = False + if item.access != access_mode: + item.access = access_mode + changed = True + if item.no_root_squash is not no_root_squash: + item.no_root_squash = no_root_squash + changed = True + + # If access_mode and/or no_root_squash not passed as arguments to the module, + # use access_mode with RW value and set no_root_squash to False + if client_not_in_list: # Create client + changed = True + client_list.append(Munch(client=client, access=access_mode, no_root_squash=no_root_squash)) + + if changed: + for index, item in enumerate(client_list): + client_list[index] = unmunchify(item) + if not module.check_mode: + export.update_permissions(client_list) + + return changed + +@api_wrapper +def delete_client(module, export): + """Update export client list""" + if export is None and module.params['state'] == 'absent': + module.exit_json(changed=False) + + changed = False + + client = module.params['client'] + client_list = export.get_permissions() + + for index, item in enumerate(client_list): + if item.client == client: + changed = True + del client_list[index] + + if changed: + for index, item in enumerate(client_list): + client_list[index] = unmunchify(item) + if not module.check_mode: + export.update_permissions(client_list) + + return changed + + +def get_sys_exp(module): + system = get_system(module) + export = get_export(module, system) + return (system, export) + + +def get_export_client_fields(export, client_name): + fields = export.get_fields() #from_cache=True, raw_value=True) + permissions = fields.get('permissions', None) + #field_dict = {} + for munched_perm in permissions: + perm = unmunchify(munched_perm) + if perm['client'] == client_name: # Found client + field_dict = dict( + access_mode=perm['access'], + no_root_squash=perm['no_root_squash'], + ) + return field_dict + assert False, "No client match to exports found" + + +def handle_stat(module): + system, export = get_sys_exp(module) + if not export: + module.fail_json(msg='Export {0} not found'.format(module.params['export'])) + client_name = module.params['client'] + field_dict = get_export_client_fields(export, client_name) + result = dict( + changed=False, + msg='Export client stat found' + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + system, export = get_sys_exp(module) + if not export: + msg='Export {0} not found'.format(module.params['export']) + module.fail_json(msg=msg) + + changed = update_client(module, export) + msg="Export client updated" + module.exit_json(changed=changed, msg=msg) + + +def handle_absent(module): + system, export = get_sys_exp(module) + if not export: + changed = False + msg="Export client already absent" + module.exit_json(changed=False, msg=msg) + else: + changed = delete_client(module, export) + msg="Export client removed" + module.exit_json(changed=changed, msg=msg) + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + client=dict(required=True), + access_mode=dict(choices=['RO', 'RW'], default='RW'), + no_root_squash=dict(type='bool', default='no'), + state=dict(default='present', choices=['stat', 'present', 'absent']), + export=dict(required=True) + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + if not HAS_MUNCH: + module.fail_json(msg=missing_required_lib('munch'), exception=MUNCH_IMP_ERR) + + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_fs.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_fs.py new file mode 100644 index 00000000..0c365fce --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_fs.py @@ -0,0 +1,203 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_fs +version_added: 2.3 +short_description: Create, Delete or Modify filesystems on Infinibox +description: + - This module creates, deletes or modifies filesystems on Infinibox. +author: Gregory Shulov (@GR360RY) +options: + name: + description: + - File system name. + required: true + state: + description: + - Creates/Modifies file system when present or removes when absent. + required: false + default: present + choices: [ "present", "absent" ] + size: + description: + - File system size in MB, GB or TB units. See examples. + required: false + pool: + description: + - Pool that will host file system. + required: true +extends_documentation_fragment: + - infinibox +requirements: + - capacity +''' + +EXAMPLES = r''' +- name: Create new file system named foo under pool named bar + infini_fs: + name: foo + size: 1TB + pool: bar + state: present + user: admin + password: secret + system: ibox001 +''' + +# RETURN = r''' # ''' + +import traceback + +CAPACITY_IMP_ERR = None +try: + from capacity import KiB, Capacity + HAS_CAPACITY = True +except ImportError: + CAPACITY_IMP_ERR = traceback.format_exc() + HAS_CAPACITY = False + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_pool, get_system, get_filesystem + + +@api_wrapper +def create_filesystem(module, system): + """Create Filesystem""" + changed = True + if not module.check_mode: + filesystem = system.filesystems.create(name=module.params['name'], pool=get_pool(module, system)) + if module.params['size']: + size = Capacity(module.params['size']).roundup(64 * KiB) + filesystem.update_size(size) + return changed + + +@api_wrapper +def update_filesystem(module, filesystem): + """Update Filesystem""" + changed = False + if module.params['size']: + size = Capacity(module.params['size']).roundup(64 * KiB) + if filesystem.get_size() != size: + if not module.check_mode: + filesystem.update_size(size) + changed = True + return changed + + +@api_wrapper +def delete_filesystem(module, filesystem): + """ Delete Filesystem""" + if not module.check_mode: + filesystem.delete() + module.exit_json(changed=True) + + +def get_sys_pool_fs(module): + system = get_system(module) + pool = get_pool(module, system) + filesystem = get_filesystem(module, system) + return (system, pool, filesystem) + + +def handle_stat(module): + system, pool, filesystem = get_sys_pool_fs(module) + if not pool: + module.fail_json(msg='Pool {0} not found'.format(module.params['pool'])) + if not filesystem: + module.fail_json(msg='File system {0} not found'.format(module.params['name'])) + fields = filesystem.get_fields() #from_cache=True, raw_value=True) + used = fields.get('used_size', None) + filesystem_id = fields.get('id', None) + + result = dict( + changed=False, + size=str(filesystem.get_size()), + used=str(used), + id=filesystem_id, + msg='File system stat found' + ) + module.exit_json(**result) + + +def handle_present(module): + system, pool, filesystem = get_sys_pool_fs(module) + if not pool: + module.fail_json(msg='Pool {0} not found'.format(module.params['pool'])) + if not filesystem: + changed = create_filesystem(module, system) + module.exit_json(changed=changed, msg="File system created") + else: + changed = update_filesystem(module, filesystem) + module.exit_json(changed=changed, msg="File system updated") + + +def handle_absent(module): + system, pool, filesystem = get_sys_pool_fs(module) + if not pool or not filesystem: + module.exit_json(changed=False, msg="File system already absent") + else: + changed = delete_filesystem(module, filesystem) + module.exit_json(changed=changed, msg="File system removed") + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + name=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + pool=dict(required=True), + size=dict() + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + if not HAS_CAPACITY: + module.fail_json(msg=missing_required_lib('capacity'), exception=CAPACITY_IMP_ERR) + + if module.params['size']: + try: + Capacity(module.params['size']) + except Exception: + module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units') + + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_host.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_host.py new file mode 100644 index 00000000..d17c78ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_host.py @@ -0,0 +1,185 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 +from infi.dtypes.iqn import make_iscsi_name + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_host +version_added: 2.3 +short_description: Create, Delete and Modify Hosts on Infinibox +description: + - This module creates, deletes or modifies hosts on Infinibox. +author: Gregory Shulov (@GR360RY) +options: + name: + description: + - Host Name + required: true + state: + description: + - Creates/Modifies Host when present or removes when absent + required: false + default: present + choices: [ "stat", "present", "absent" ] +extends_documentation_fragment: + - infinibox +''' + +EXAMPLES = r''' +- name: Create new host + infini_host: + name: foo.example.com + user: admin + password: secret + system: ibox001 +''' + +# RETURN = r''' # ''' + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_system, get_host, unixMillisecondsToDate, merge_two_dicts + + +@api_wrapper +def create_host(module, system): + + changed = True + + if not module.check_mode: + host = system.hosts.create(name=module.params['name']) + return changed + +@api_wrapper +def update_host(module, host): + changed = False + return changed + +@api_wrapper +def delete_host(module, host): + changed = True + if not module.check_mode: + # May raise APICommandFailed if mapped, etc. + host.delete() + return changed + + +def get_sys_host(module): + system = get_system(module) + host = get_host(module, system) + return (system, host) + + +def get_host_fields(host): + fields = host.get_fields(from_cache=True, raw_value=True) + created_at, created_at_timezone = unixMillisecondsToDate(fields.get('created_at', None)) + field_dict = dict( + created_at=created_at, + created_at_timezone=created_at_timezone, + id=host.id, + iqns=[], + luns=[], + ports=[], + wwns=[], + ) + luns = host.get_luns() + for lun in luns: + field_dict['luns'].append({'lun_id': lun.id, + 'lun_volume_id': lun.volume.id, + 'lun_volume_name': lun.volume.get_name(), + }) + ports = host.get_ports() + for port in ports: + if str(type(port)) == "": + field_dict['wwns'].append(str(port)) + if str(type(port)) == "": + field_dict['iqns'].append(str(port)) + return field_dict + + +def handle_stat(module): + system, host = get_sys_host(module) + host_name = module.params["name"] + if not host: + module.fail_json(msg='Host {0} not found'.format(host_name)) + field_dict = get_host_fields(host) + result = dict( + changed=False, + msg='Host stat found' + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + system, host = get_sys_host(module) + host_name = module.params["name"] + if not host: + changed = create_host(module, system) + msg='Host {0} created'.format(host_name) + module.exit_json(changed=changed, msg=msg) + else: + changed = update_host(module, host) + msg='Host {0} updated'.format(host_name) + module.exit_json(changed=changed, msg=msg) + + +def handle_absent(module): + system, host = get_sys_host(module) + host_name = module.params["name"] + if not host: + msg="Host {0} already absent".format(host_name) + module.exit_json(changed=False, msg=msg) + else: + changed = delete_host(module, host) + msg="Host {0} removed".format(host_name) + module.exit_json(changed=changed, msg=msg) + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + name=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_map.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_map.py new file mode 100644 index 00000000..9163b29f --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_map.py @@ -0,0 +1,355 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 +from infinisdk.core.exceptions import APICommandFailed +__metaclass__ = type + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_map +version_added: '2.10' +short_description: Create and Delete mapping of a volume to a host on Infinibox +description: + - This module creates or deletes mappings of volumes to hosts on + Infinibox. infini_map is implemented separately from infini_host to allow + ansible plays to remove, or make absent, a mapping without removing the host. +author: David Ohlemacher (@ohlemacher) +options: + host: + description: + - Host Name + required: true + volume: + description: + - Volume name to map to the host + required: true + state: + description: + - Creates mapping when present or removes when absent, or provides + details of a mapping when stat. + required: false + default: present + choices: [ "stat", "present", "absent" ] +extends_documentation_fragment: + - infinibox +''' + +EXAMPLES = r''' +- name: Map a volume to an existing host + infini_map: + host: foo.example.com + volume: bar + state: present # Default + user: admin + password: secret + system: ibox001 + +- name: Unmap volume bar from host foo.example.com + infini_map: + host: foo.example.com + volume: bar + state: absent + system: ibox01 + user: admin + password: secret + +- name: Stat mapping of volume bar to host foo.example.com + infini_map: + host: foo.example.com + volume: bar + state: stat + system: ibox01 + user: admin + password: secret +''' + +# RETURN = r''' # ''' + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_pool, get_system, get_volume, get_host, merge_two_dicts + + +def vol_is_mapped_to_host(volume, host): + volume_fields = volume.get_fields() + volume_id = volume_fields.get('id') + host_luns = host.get_luns() + #print('volume id: {0}'.format(volume_id)) + #print('host luns: {0}'.format(str(host_luns))) + for lun in host_luns: + if lun.volume == volume: + #print('found mapped volume: {0}'.format(volume)) + return True + return False + + +def find_lun_use(module, host, volume): + check_result = {'lun_used': False, 'lun_volume_matches': False} + desired_lun = module.params['lun'] + + if desired_lun: + for host_lun in host.get_luns(): + if desired_lun == host_lun.lun: + if host_lun.volume == volume: + check_result = {'lun_used': True, 'lun_volume_matches': True} + else: + check_result = {'lun_used': True, 'lun_volume_matches': False} + + return check_result + + +def find_lun(host, volume): + found_lun = None + luns = host.get_luns() + + for lun in luns: + if lun.volume == volume: + found_lun = lun.lun + return found_lun + + +@api_wrapper +def create_mapping(module, system): + """ + Create mapping of volume to host. If already mapped, exit_json with changed False. + """ + changed = False + + host = system.hosts.get(name=module.params['host']) + volume = get_volume(module, system) + + lun_use = find_lun_use(module, host, volume) + if lun_use['lun_used']: + #assert not lun_use['lun_volume_matches'], "Cannot have matching lun and volume in create_mapping()" + msg = "Cannot create mapping of volume '{}' to host '{}' using lun '{}'. Lun in use.".format( + volume.get_name(), + host.get_name(), + module.params['lun']) + module.fail_json(msg=msg) + + try: + desired_lun = module.params['lun'] + if not module.check_mode: + host.map_volume(volume, lun=desired_lun) + changed = True + except APICommandFailed as err: + if "is already mapped" not in str(err): + module.fail_json('Cannot map volume {0} to host {1}: {2}'.format( + module.params['volume'], + module.params['host'], + str(err))) + + return changed + + +@api_wrapper +def update_mapping(module, system): + host = system.hosts.get(name=module.params['host']) + volume = get_volume(module, system) + desired_lun = module.params['lun'] + + assert vol_is_mapped_to_host(volume, host) + + if desired_lun: + found_lun = find_lun(host, volume) + if found_lun != desired_lun: + msg = "Cannot change the lun from '{}' to '{}' for existing mapping of volume '{}' to host '{}'".format( + found_lun, + desired_lun, + volume.get_name(), + host.get_name()) + module.fail_json(msg=msg) + + changed = False + return changed + + +@api_wrapper +def delete_mapping(module, system): + """ + Remove mapping of volume from host. If the either the volume or host + do not exist, then there should be no mapping to unmap. If unmapping + generates a key error with 'has no logical units' in its message, then + the volume is not mapped. Either case, return changed=False. + """ + changed = False + msg = "" + + if not module.check_mode: + volume = get_volume(module, system) + host = system.hosts.get(name=module.params['host']) + + if volume and host: + try: + existing_lun = find_lun(host, volume) + host.unmap_volume(volume) + changed = True + msg = "Volume '{0}' was unmapped from host '{1}' freeing lun '{2}'".format( + module.params['volume'], + module.params['host'], + existing_lun, + ) + except KeyError as err: + if 'has no logical units' not in str(err): + module.fail_json('Cannot unmap volume {0} from host {1}: {2}'.format( + module.params['volume'], + module.params['host'], + str(err))) + else: + msg = "Volume {0} was not mapped to host {1} and so unmapping was not executed".format( + module.params['volume'], + module.params['host'], + ) + else: + msg = "Either volume {0} or host {1} does not exist. Unmapping was not executed".format( + module.params['volume'], + module.params['host'], + ) + else: # check_mode + changed = True + + module.exit_json(msg=msg, changed=changed) + + +def get_sys_vol_host(module): + system = get_system(module) + volume = get_volume(module, system) + host = get_host(module, system) + return (system, volume, host) + + +def get_mapping_fields(volume, host): + luns = host.get_luns() + for lun in luns: + if volume.get_name() == lun.volume.get_name(): + field_dict = dict( + id=lun.id, + ) + return field_dict + assert False, 'Failed to find lun details from volume {0} and host {1}'.format( + volume.get_name(), host.get_name()) + + +def handle_stat(module): + system, volume, host = get_sys_vol_host(module) + volume_name = module.params['volume'] + host_name = module.params['host'] + if not volume: + module.fail_json(msg='Volume {0} not found'.format(volume_name)) + if not host: + module.fail_json(msg='Host {0} not found'.format(host_name)) + if not vol_is_mapped_to_host(volume, host): + msg = 'Volume {0} is not mapped to host {1}'.format(volume_name, host_name) + module.fail_json(msg=msg) + + found_lun = find_lun(host, volume) + + field_dict = get_mapping_fields(volume, host) + result = dict( + changed=False, + volume_lun=found_lun, + msg = 'Volume {0} is mapped to host {1}'.format(volume_name, host_name), + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + system, volume, host= get_sys_vol_host(module) + if not volume: + module.fail_json(changed=False, msg='Volume {0} not found'.format( + module.params['volume'])) + if not host: + module.fail_json(changed=False, msg='Host {0} not found'.format( + module.params['host'])) + if not vol_is_mapped_to_host(volume, host): + changed = create_mapping(module, system) + # TODO: Why is find_lun() returning None after creating the mapping? + # host.get_luns() returns an empty list, why? + # existing_lun = find_lun(host, volume) + # msg = "Volume '{0}' map to host '{1}' created using lun '{2}'".format( + # volume.get_name(), + # host.get_name(), + # existing_lun, + # ) + msg = "Volume '{0}' map to host '{1}' created".format( + volume.get_name(), + host.get_name() + ) + else: + changed = update_mapping(module, system) + existing_lun = find_lun(host, volume) + msg = "Volume '{0}' map to host '{1}' already exists using lun '{2}'".format( + volume.get_name(), + host.get_name(), + existing_lun, + ) + + result = dict( + changed=changed, + msg=msg, + ) + module.exit_json(**result) + + +def handle_absent(module): + system, volume, host = get_sys_vol_host(module) + if not volume or not host: + module.exit_json(changed=False, msg='Mapping of volume {0} to host {1} already absent'.format( + module.params['volume'], + module.params['host'])) + else: + changed = delete_mapping(module, system) + module.exit_json(changed=changed, msg="File system removed") + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def main(): + """ + Gather auguments and manage mapping of vols to hosts. + """ + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + host=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + volume=dict(required=True), + lun=dict(type=int), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_pool.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_pool.py new file mode 100644 index 00000000..06889fcb --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_pool.py @@ -0,0 +1,287 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_pool +version_added: 2.3 +short_description: Create, Delete and Modify Pools on Infinibox +description: + - This module to creates, deletes or modifies pools on Infinibox. +author: Gregory Shulov (@GR360RY) +options: + name: + description: + - Pool Name + required: true + state: + description: + - Creates/Modifies Pool when present or removes when absent + required: false + default: present + choices: [ "present", "absent" ] + size: + description: + - Pool Physical Capacity in MB, GB or TB units. + If pool size is not set on pool creation, size will be equal to 1TB. + See examples. + required: false + vsize: + description: + - Pool Virtual Capacity in MB, GB or TB units. + If pool vsize is not set on pool creation, Virtual Capacity will be equal to Physical Capacity. + See examples. + required: false + ssd_cache: + description: + - Enable/Disable SSD Cache on Pool + required: false + default: yes + type: bool + compression: + description: + - Enable/Disable Compression on Pool + required: false + default: yes + type: bool + version_added: 2.8 + +notes: + - Infinibox Admin level access is required for pool modifications +extends_documentation_fragment: + - infinibox +requirements: + - capacity +''' + +EXAMPLES = r''' +- name: Make sure pool foo exists. Set pool physical capacity to 10TB + infini_pool: + name: foo + size: 10TB + vsize: 10TB + user: admin + password: secret + system: ibox001 + +- name: Disable SSD Cache on pool + infini_pool: + name: foo + ssd_cache: no + user: admin + password: secret + system: ibox001 + +- name: Disable Compression on pool + infini_pool: + name: foo + compression: no + user: admin + password: secret + system: ibox001 +''' + +# RETURN = r''' # ''' + +import traceback + +CAPACITY_IMP_ERR = None +try: + from capacity import KiB, Capacity + HAS_CAPACITY = True +except ImportError: + CAPACITY_IMP_ERR = traceback.format_exc() + HAS_CAPACITY = False + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_pool, get_system + + +@api_wrapper +def create_pool(module, system): + """Create Pool""" + name = module.params['name'] + size = module.params['size'] + vsize = module.params['vsize'] + ssd_cache = module.params['ssd_cache'] + compression = module.params['compression'] + + if not module.check_mode: + if not size and not vsize: + pool = system.pools.create(name=name, physical_capacity=Capacity('1TB'), virtual_capacity=Capacity('1TB')) + elif size and not vsize: + pool = system.pools.create(name=name, physical_capacity=Capacity(size), virtual_capacity=Capacity(size)) + elif not size and vsize: + pool = system.pools.create(name=name, physical_capacity=Capacity('1TB'), virtual_capacity=Capacity(vsize)) + else: + pool = system.pools.create(name=name, physical_capacity=Capacity(size), virtual_capacity=Capacity(vsize)) + # Default value of ssd_cache is True. Disable ssd caching if False + if not ssd_cache: + pool.update_ssd_enabled(ssd_cache) + # Default value of compression is True. Disable compression if False + if not compression: + pool.update_compression_enabled(compression) + + module.exit_json(changed=True, msg='Pool created') + + +@api_wrapper +def update_pool(module, system, pool): + """Update Pool""" + changed = False + + size = module.params['size'] + vsize = module.params['vsize'] + #ssd_cache = module.params['ssd_cache'] + compression = module.params['compression'] + + # Roundup the capacity to mimic Infinibox behaviour + if size: + physical_capacity = Capacity(size).roundup(6 * 64 * KiB) + if pool.get_physical_capacity() != physical_capacity: + if not module.check_mode: + pool.update_physical_capacity(physical_capacity) + changed = True + + if vsize: + virtual_capacity = Capacity(vsize).roundup(6 * 64 * KiB) + if pool.get_virtual_capacity() != virtual_capacity: + if not module.check_mode: + pool.update_virtual_capacity(virtual_capacity) + changed = True + + #if pool.is_ssd_enabled() != ssd_cache: + # if not module.check_mode: + # pool.update_ssd_enabled(ssd_cache) + # changed = True + + if pool.is_compression_enabled() != compression: + if not module.check_mode: + pool.update_compression_enabled(compression) + changed = True + + if changed: + msg = 'Pool updated' + else: + msg = 'Pool did not require updating' + module.exit_json(changed=changed, msg=msg) + + +@api_wrapper +def delete_pool(module, pool): + """Delete Pool""" + if not module.check_mode: + pool.delete() + msg = 'Pool deleted' + module.exit_json(changed=True, msg=msg) + + +def get_sys_pool(module): + system = get_system(module) + pool = get_pool(module, system) + return (system, pool) + + +def handle_stat(module): + system, pool = get_sys_pool(module) + if not pool: + module.fail_json(msg='Pool {0} not found'.format(module.params['name'])) + fields = pool.get_fields() #from_cache=True, raw_value=True) + print('fields: {0}'.format(fields)) + free_physical_capacity = fields.get('free_physical_capacity', None) + pool_id = fields.get('id', None) + + result = dict( + changed=False, + free_physical_capacity=str(free_physical_capacity), + id=pool_id, + msg='Pool stat found' + ) + module.exit_json(**result) + + +def handle_present(module): + system, pool = get_sys_pool(module) + if not pool: + create_pool(module, system) + module.exit_json(changed=True, msg="Pool created") + else: + changed = update_pool(module, system, pool) + module.exit_json(changed=changed, msg="Pool updated") + + +def handle_absent(module): + system, pool = get_sys_pool(module) + if not pool: + module.exit_json(changed=False, msg="Pool already absent") + else: + delete_pool(module, pool) + module.exit_json(changed=True, msg="Pool removed") + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + name=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + size=dict(), + vsize=dict(), + ssd_cache=dict(type='bool', default=True), + compression=dict(type='bool', default=True), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + if not HAS_CAPACITY: + module.fail_json(msg=missing_required_lib('capacity'), exception=CAPACITY_IMP_ERR) + + if module.params['size']: + try: + Capacity(module.params['size']) + except Exception: + module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units') + + if module.params['vsize']: + try: + Capacity(module.params['vsize']) + except Exception: + module.fail_json(msg='vsize (Virtual Capacity) should be defined in MB, GB, TB or PB units') + + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_port.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_port.py new file mode 100644 index 00000000..2d55ae6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_port.py @@ -0,0 +1,376 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_port +version_added: 2.10 +short_description: Add and Delete fiber channel and iSCSI ports to a host on Infinibox +description: + - This module adds or deletes fiber channel or iSCSI ports to hosts on + Infinibox. +author: David Ohlemacher (@ohlemacher) +options: + name: + description: + - Host Name + required: true + state: + description: + - Creates mapping when present, removes when absent, or provides + details of a mapping when stat. + required: false + default: present + choices: [ "stat", "present", "absent" ] + wwns: + description: + - List of wwns of the host + required: false + default: [] + iqns: + description: + - List of iqns of the host + required: false + default: [] +extends_documentation_fragment: + - infinibox +''' + +EXAMPLES = r''' +- name: Make sure host bar is available with wwn/iqn ports + infini_host: + name: bar.example.com + state: present + wwns: + - "00:00:00:00:00:00:00" + - "11:11:11:11:11:11:11" + iqns: + - "iqn.yyyy-mm.reverse-domain:unique-string" + system: ibox01 + user: admin + password: secret +''' + +# RETURN = r''' # ''' + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_system, get_host, merge_two_dicts +from infi.dtypes.wwn import WWN +from infi.dtypes.iqn import make_iscsi_name +#from infinisdk.core.exceptions import APICommandFailed + +@api_wrapper +def update_ports(module, system): + """ + Updated mapping of volume to host. If already mapped, exit_json with changed False. + """ + changed = False + + host = system.hosts.get(name=module.params['host']) + + for wwn_port in module.params['wwns']: + wwn = WWN(wwn_port) + if not system.hosts.get_host_by_initiator_address(wwn) == host: + if not module.check_mode: + host.add_port(wwn) + changed = True + + for iscsi_port in module.params['iqns']: + iscsi_name = make_iscsi_name(iscsi_port) + if not system.hosts.get_host_by_initiator_address(iscsi_name) == host: + if not module.check_mode: + host.add_port(iscsi_name) + changed = True + + return changed + + +@api_wrapper +def delete_ports(module, system): + """ + Remove ports from host. + """ + changed = False + + host = system.hosts.get(name=module.params['host']) + for wwn_port in module.params['wwns']: + wwn = WWN(wwn_port) + if system.hosts.get_host_by_initiator_address(wwn) == host: + if not module.check_mode: + host.remove_port(wwn) + changed = True + for iscsi_port in module.params['iqns']: + iscsi_name = make_iscsi_name(iscsi_port) + if system.hosts.get_host_by_initiator_address(iscsi_name) == host: + if not module.check_mode: + host.remove_port(iscsi_name) + changed = True + return changed + + +def get_sys_host(module): + system = get_system(module) + host = get_host(module, system) + return (system, host) + + +def edit_initiator_keys(host_initiators, include_key_list): + """ + For each host initiator, remove keys not in the include_key_list. + For FCs, add a long address. This is the address with colons inserted. + Return the edited host initiators list. + """ + trimmed_initiators = [] + for init in host_initiators: + if init['type'] == 'FC' and 'address' in init.keys(): + # Add address_long key to init whose value is the address with colons inserted. + address_str = str(init['address']) + address_iter = iter(address_str) + long_address = ':'.join(a+b for a, b in zip(address_iter, address_iter)) + init['address_long'] = long_address + + trimmed_item = {key:val for key, val in init.items() if key in include_key_list} + trimmed_initiators.append(trimmed_item) + return trimmed_initiators + + +def find_host_initiators_data(module, system, host, initiator_type): + """ + Given a host object, find its initiators that match initiator_type. + Only include desired initiator keys for each initiator. + Return the filtered and edited host initiator list. + """ + request = 'initiators?page=1&page_size=1000&host_id={0}'.format(host.id) + #print("\nrequest:", request, "initiator_type:", initiator_type) + get_initiators_result = system.api.get(request, check_version=False) + result_code = get_initiators_result.status_code + if result_code != 200: + msg = 'get initiators REST call failed. code: {0}'.format(result_code) + module.fail_json(msg=msg) + + # Only return initiators of the desired type. + host_initiators_by_type = [initiator for initiator in get_initiators_result.get_result() \ + if initiator['type'] == initiator_type] + + + #print("host_initiators_by_type:", host_initiators_by_type) + #print() + + # Only include certain keys in the returned initiators + if initiator_type == 'FC': + include_key_list = ['address', 'address_long', 'host_id', 'port_key', 'targets', 'type'] + elif initiator_type == 'ISCSI': + include_key_list = ['address', 'host_id', 'port_key', 'targets', 'type'] + else: + msg = 'Cannot search for host initiator types other than FC and ISCSI' + module.fail_json(msg=msg) + host_initiators_by_type = edit_initiator_keys(host_initiators_by_type, include_key_list) + + return host_initiators_by_type + + +def get_port_fields(module, system, host): + """ + Return a dict with desired fields from FC and ISCSI ports associated with the host. + """ + host_fc_initiators = find_host_initiators_data(module, system, host, initiator_type='FC') + host_iscsi_initiators = find_host_initiators_data(module, system, host, initiator_type='ISCSI') + + field_dict = dict( + ports=[], + ) + + connectivity_lut = { + 0: "DISCONNECTED", + 1: "DEGRADED", + 2: "DEGRADED", + 3: "CONNECTED" + } + + ports = host.get_ports() + for port in ports: + if str(type(port)) == "": + found_initiator = False + for initiator in host_fc_initiators: + if initiator['address'] == str(port).replace(":", ""): + found_initiator = True + #print("initiator targets:", initiator['targets']) + unique_initiator_target_ids = \ + {target['node_id'] for target in initiator['targets']} + port_dict = { + "address": str(port), + "address_long": initiator['address_long'], + "connectivity": connectivity_lut[len(unique_initiator_target_ids)], + "targets": initiator['targets'], + "type": initiator['type'], + } + + if not found_initiator: + address_str = str(port) + address_iter = iter(address_str) + long_address = ':'.join(a+b for a, b in zip(address_iter, address_iter)) + port_dict = { + "address": str(port), + "address_long": long_address, + "connectivity": connectivity_lut[0], + "targets": [], + "type": "FC" + } + + field_dict['ports'].append(port_dict) + + if str(type(port)) == "": + found_initiator = False + for initiator in host_iscsi_initiators: + if initiator['address'] == str(port): + found_initiator = True + #print("initiator targets:", initiator['targets']) + unique_initiator_target_ids = \ + {target['node_id'] for target in initiator['targets']} + port_dict = { + "address": str(port), + "connectivity": connectivity_lut[len(unique_initiator_target_ids)], + "targets": initiator['targets'], + "type": initiator['type'], + } + + if not found_initiator: + port_dict = { + "address": str(port), + "connectivity": connectivity_lut[0], + "targets": [], + "type": "ISCSI" + } + + field_dict['ports'].append(port_dict) + + return field_dict + + +def handle_stat(module): + """ + Handle stat state. Fail if host is None. + Return json with status. + """ + system, host = get_sys_host(module) + + host_name = module.params['host'] + if not host: + module.fail_json(msg='Host {0} not found'.format(host_name)) + + field_dict = get_port_fields(module, system, host) + result = dict( + changed=False, + msg='Host {0} ports found'.format(host_name), + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + """ + Handle present state. Fail if host is None. + """ + system, host = get_sys_host(module) + + host_name = module.params['host'] + if not host: + module.fail_json(msg='Host {0} not found'.format(host_name)) + + changed = update_ports(module, system) + if changed: + msg = 'Mapping created for host {0}'.format(host.get_name()) + else: + msg = 'No mapping changes were required for host {0}'.format(host.get_name()) + + result = dict( + changed=changed, + msg=msg, + ) + module.exit_json(**result) + + +def handle_absent(module): + """ + Handle absent state. Fail if host is None. + """ + system, host = get_sys_host(module) + if not host: + module.exit_json(changed=False, msg='Host {0} not found'.format( + module.params['host'])) + + changed = delete_ports(module, system) + if changed: + msg = 'Mapping removed from host {0}'.format(host.get_name()) + else: + msg = 'No mapping changes were required. Mapping already removed from host {0}'.format(host.get_name()) + + result = dict( + changed=changed, + msg=msg, + ) + module.exit_json(**result) + + +def execute_state(module): + """ + Handle states. Always logout. + """ + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def check_options(module): + pass + + +def main(): + """ + Gather auguments and manage mapping of vols to hosts. + """ + argument_spec = infinibox_argument_spec() + null_list = list() + argument_spec.update( + dict( + host=dict(required=True), + state=dict(default='present', choices=['stat', 'present', 'absent']), + wwns=dict(type='list', default=list()), + iqns=dict(type='list', default=list()), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + + check_options(module) + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_user.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_user.py new file mode 100644 index 00000000..df5ce5ed --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_user.py @@ -0,0 +1,332 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 +from infi.dtypes.iqn import make_iscsi_name + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_user +version_added: '2.10' +short_description: Create, Delete and Modify a User on Infinibox +description: + - This module creates, deletes or modifies a user on Infinibox. +author: David Ohlemacher (@ohlemacher) +options: + user_name: + description: + - The new user's Name. Once a user is created, the user_name may not be + changed from this module. It may be changed from the UI or from + infinishell. + required: true + user_email: + description: + - The new user's Email address + required: true + user_password: + description: + - The new user's password + required: true + user_role: + description: + - The user's role + required: true + choices: [ "admin", "pool_admin", "read_only" ] + user_enabled: + description: + - Specify whether to enable the user + type: bool + required: false + default: true + user_pool: + description: + - Use with role==pool_admin. Specify the new user's pool. + required: False + state: + description: + - Creates/Modifies user when present or removes when absent + required: false + default: present + choices: [ "stat", "reset_password", "present", "absent" ] + +extends_documentation_fragment: + - infinibox +''' + +EXAMPLES = r''' +- name: Create new user + infini_user: + user_name: foo_user + user_email: foo@example.com + user_password: secret2 + user_role: pool_admin + user_enabled: false + pool: foo_pool + state: present + password: secret1 + system: ibox001 +''' + +# RETURN = r''' # ''' + +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, \ + get_system, get_user, get_pool, unixMillisecondsToDate, merge_two_dicts + + +@api_wrapper +def create_user(module, system): + if not module.check_mode: + user = system.users.create(name=module.params['user_name'], + password=module.params['user_password'], + email=module.params['user_email'], + enabled=module.params['user_enabled'], + ) + # Set the user's role + user.update_role(module.params['user_role']) + if module.params['user_pool']: + assert module.params['user_role'] == 'pool_admin', \ + 'user_pool set, but role is not pool_admin' + # Add the user to the pool's owners + pool = system.pools.get(name=module.params['user_pool']) + add_user_to_pool_owners(user, pool) + changed = True + return changed + + +def add_user_to_pool_owners(user, pool): + """ + Find the current list of pool owners and add user using pool.set_owners(). + set_owners() replaces the current owners with the list of new owners. So, + get owners, add user, then set owners. Further, we need to know if the + owners changed. Use sets of owners to compare. + """ + #print("add_user_to_pool_owners(): start") + changed = False + pool_fields = pool.get_fields(from_cache=True, raw_value=True) + pool_owners = pool_fields.get('owners', []) + #print('pool_owners:', pool_owners, 'pool_owners type:', type(pool_owners)) + #print('user:', user) + #print('pool:', pool) + pool_owners_set = set(pool_owners) + #print('pool_owners_set:', pool_owners_set) + new_pool_owners_set = pool_owners_set.copy() + new_pool_owners_set.add(user.id) + #print('new_pool_owners_set:', new_pool_owners_set) + if pool_owners_set != new_pool_owners_set: + pool.set_owners([user]) #(pool_owners.append(user)) + changed = True + #print("changed:", changed) + #print("add_user_to_pool_owners(): end") + return changed + + +def remove_user_from_pool_owners(user, pool): + changed = False + pool_fields = pool.get_fields(from_cache=True, raw_value=True) + pool_owners = pool_fields.get('owners', []) + try: + pool_owners.remove(user) + pool.set_owners(pool_owners) + changed = True + except ValueError: + pass # User is not a pool owner + return changed + + +@api_wrapper +def update_user(module, system, user): + #print("update_user()") + assert user is not None, "Cannot update user. User not found." + changed = False + fields = user.get_fields(from_cache=True, raw_value=True) + if fields.get('role') != module.params['user_role'].upper(): + user.update_field('role', module.params['user_role']) + changed = True + if fields.get('enabled') != module.params['user_enabled']: + user.update_field('enabled', module.params['user_enabled']) + changed = True + if fields.get('email') != module.params['user_email']: + user.update_field('email', module.params['user_email']) + changed = True + + if module.params['user_pool']: + try: + pool_name = module.params['user_pool'] + pool = system.pools.get(name=pool_name) + except Exception as err: + module.fail_json(msg='Cannot find pool {0}: {1}'.format(pool_name, err)) + if add_user_to_pool_owners(user, pool): + changed = True + return changed + + +@api_wrapper +def reset_user_password(module, system, user): + #print("update_user()") + assert user is not None, "Cannot change user password. User not found." + user.update_password(module.params['user_password']) + + +@api_wrapper +def delete_user(module, user): + if not user: + return False + + changed = True + if not module.check_mode: + # May raise APICommandFailed if mapped, etc. + user.delete() + return changed + + +def get_sys_user(module): + system = get_system(module) + user = get_user(module, system) + #print("get_sys_user(): user:", user) + return (system, user) + + +def get_user_fields(user): + pools = user.get_owned_pools() + pool_names = [pool.get_field('name') for pool in pools] + + fields = user.get_fields(from_cache=True, raw_value=True) + field_dict = dict( + id=user.id, + enabled=fields.get('enabled', None), + role=fields.get('role', None), + email=fields.get('email', None), + pools=pool_names, + ) + return field_dict + + +def handle_stat(module): + system, user = get_sys_user(module) + user_name = module.params["user_name"] + if not user: + module.fail_json(msg='User {0} not found'.format(user_name)) + field_dict = get_user_fields(user) + result = dict( + changed=False, + msg='User stat found' + ) + result = merge_two_dicts(result, field_dict) + module.exit_json(**result) + + +def handle_present(module): + system, user = get_sys_user(module) + user_name = module.params["user_name"] + if not user: + changed = create_user(module, system) + msg='User {0} created'.format(user_name) + else: + changed = update_user(module, system, user) + if changed: + msg='User {0} updated'.format(user_name) + else: + msg='User {0} update required no changes'.format(user_name) + module.exit_json(changed=changed, msg=msg) + + +def handle_absent(module): + system, user = get_sys_user(module) + user_name = module.params["user_name"] + if not user: + changed = False + msg="User {0} already absent".format(user_name) + else: + changed = delete_user(module, user) + msg="User {0} removed".format(user_name) + module.exit_json(changed=changed, msg=msg) + + +def handle_reset_password(module): + system, user = get_sys_user(module) + user_name = module.params["user_name"] + if not user: + msg = 'Cannot change password. User {0} not found'.format(user_name) + module.fail_json(msg=msg) + else: + reset_user_password(module, system, user) + msg='User {0} password changed'.format(user_name) + module.exit_json(changed=True, msg=msg) + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + elif state == 'reset_password': + handle_reset_password(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def check_options(module): + state = module.params['state'] + user_role = module.params['user_role'] + user_pool = module.params['user_pool'] + if state == 'present': + if user_role == 'pool_admin' and not user_pool: + module.fail_json(msg='user_role "pool_admin" requires a user_pool to be provided') + if user_role != 'pool_admin' and user_pool: + module.fail_json(msg='Only user_role "pool_admin" should have a user_pool provided') + + valid_keys = ['user_email', 'user_password', 'user_role', 'user_enabled'] + for valid_key in valid_keys: + try: + _ = module.params[valid_key] + except KeyError: + msg = 'For state "present", options {0} are required'.format(", ".join(valid_keys)) + module.fail_json(msg=msg) + elif state == 'reset_password': + if not module.params['user_password']: + msg = 'For state "reset_password", user_password is required' + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + user_name=dict(required=True), + user_email=dict(required=False), + user_password=dict(required=False, no_log=True), + user_role=dict(required=False, choices=['admin', 'pool_admin', 'read_only']), + user_enabled=dict(required=False, type='bool'), + user_pool=dict(required=False), + state=dict(default='present', choices=['stat', 'reset_password', 'present', 'absent']), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + + check_options(module) + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_vol.py b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_vol.py new file mode 100644 index 00000000..1689316f --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/plugins/modules/infini_vol.py @@ -0,0 +1,466 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright: (c) 2020, Infinidat +# 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 + + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + + +DOCUMENTATION = r''' +--- +module: infini_vol +version_added: 2.3 +short_description: Create, Delete or Modify volumes on Infinibox +description: + - This module creates, deletes or modifies a volume on Infinibox. +author: Gregory Shulov (@GR360RY) +options: + name: + description: + - Volume Name + required: true + state: + description: + - Creates/Modifies master volume or snapshot when present or removes when absent. + required: false + default: present + choices: [ "stat", "present", "absent" ] + size: + description: + - Volume size in MB, GB or TB units. Required for creating a master volume, but not a snapshot + required: false + snapshot_lock_expires_at: + description: + - This will cause a snapshot to be locked at the specified date-time. + Uses python's datetime format YYYY-mm-dd HH:MM:SS.ffffff, e.g. 2020-02-13 16:21:59.699700 + required: false + snapshot_lock_only: + description: + - This will lock an existing snapshot but will suppress refreshing the snapshot. + type: bool + required: false + default: false + thin_provision: + description: + - Whether the master volume should be thin provisioned. Required for creating a master volume, but not a snapshot. + type: bool + required: false + default: true + version_added: '2.8' + pool: + description: + - Pool that master volume will reside within. Required for creating a master volume, but not a snapshot. + required: false + volume_type: + description: + - Specifies the volume type, regular volume or snapshot. + required: false + default: master + choices: [ "master", "snapshot" ] + parent_volume_name: + description: + - Specify a volume name. This is the volume parent for creating a snapshot. Required if volume_type is snapshot. + required: false +extends_documentation_fragment: + - infinibox +requirements: + - capacity +''' + +EXAMPLES = r''' +- name: Create new volume named foo under pool named bar + infini_vol: + name: foo + # volume_type: master # Default + size: 1TB + thin_provision: yes + pool: bar + state: present + user: admin + password: secret + system: ibox001 +- name: Create snapshot named foo_snap from volume named foo + infini_vol: + name: foo_snap + volume_type: snapshot + parent_volume_name: foo + state: present + user: admin + password: secret + system: ibox001 +- name: Stat snapshot, also a volume, named foo_snap + infini_vol: + name: foo_snap + state: present + user: admin + password: secret + system: ibox001 +- name: Remove snapshot, also a volume, named foo_snap + infini_vol: + name: foo_snap + state: absent + user: admin + password: secret + system: ibox001 +''' + +# RETURN = r''' # ''' + +try: + from capacity import KiB, Capacity + HAS_CAPACITY = True +except ImportError: + HAS_CAPACITY = False + +import arrow +from ansible.module_utils.basic import AnsibleModule, missing_required_lib +from ansible.module_utils.infinibox import \ + HAS_INFINISDK, api_wrapper, infinibox_argument_spec, ObjectNotFound, \ + get_pool, get_system, get_volume + + +@api_wrapper +def create_volume(module, system): + """Create Volume""" + if not module.check_mode: + if module.params['thin_provision']: + prov_type = 'THIN' + else: + prov_type = 'THICK' + pool = get_pool(module, system) + volume = system.volumes.create(name=module.params['name'], provtype=prov_type, pool=pool) + + if module.params['size']: + size = Capacity(module.params['size']).roundup(64 * KiB) + volume.update_size(size) + changed = True + return changed + + +@api_wrapper +def update_volume(module, volume): + """Update Volume""" + changed = False + if module.params['size']: + size = Capacity(module.params['size']).roundup(64 * KiB) + if volume.get_size() != size: + if not module.check_mode: + volume.update_size(size) + changed = True + if module.params['thin_provision'] is not None: + type = str(volume.get_provisioning()) + if type == 'THICK' and module.params['thin_provision']: + if not module.check_mode: + volume.update_provisioning('THIN') + changed = True + if type == 'THIN' and not module.params['thin_provision']: + if not module.check_mode: + volume.update_provisioning('THICK') + changed = True + return changed + + +@api_wrapper +def delete_volume(module, volume): + """ Delete Volume. Volume could be a snapshot.""" + if not module.check_mode: + volume.delete() + changed = True + return True + + +@api_wrapper +def create_snapshot(module, system): + """Create Snapshot from parent volume""" + snapshot_name = module.params['name'] + parent_volume_name = module.params['parent_volume_name'] + try: + parent_volume = system.volumes.get(name=parent_volume_name) + except ObjectNotFound as err: + msg = 'Cannot create snapshot {}. Parent volume {} not found'.format( + snapshot_name, + parent_volume_name) + module.fail_json(msg=msg) + if not parent_volume: + msg = "Cannot find new snapshot's parent volume named {}".format(parent_volume_name) + module.fail_json(msg=msg) + if not module.check_mode: + if module.params['snapshot_lock_only']: + msg = "Snapshot does not exist. Cannot comply with 'snapshot_lock_only: true'." + module.fail_json(msg=msg) + check_snapshot_lock_options(module) + snapshot = parent_volume.create_snapshot(name=snapshot_name) + manage_snapshot_locks(module, snapshot) + changed = True + return changed + + +@api_wrapper +def update_snapshot(module, snapshot): + """ + Update/refresh snapshot. May also lock it. + """ + refresh_changed = False + if not module.params['snapshot_lock_only']: + snap_is_locked = snapshot.get_lock_state() == "LOCKED" + if not snap_is_locked: + if not module.check_mode: + snapshot.refresh_snapshot() + refresh_changed = True + else: + msg = "Snapshot is locked and may not be refreshed" + module.fail_json(msg=msg) + + check_snapshot_lock_options(module) + lock_changed = manage_snapshot_locks(module, snapshot) + + return refresh_changed or lock_changed + + +def get_sys_pool_vol_parname(module): + system = get_system(module) + pool = get_pool(module, system) + volume = get_volume(module, system) + parname = module.params['parent_volume_name'] + return (system, pool, volume, parname) + + +def check_snapshot_lock_options(module): + """ + Check if specified options are feasible for a snapshot. + + Prevent very long lock times. + max_delta_minutes limits locks to 30 days (43200 minutes). + + This functionality is broken out from manage_snapshot_locks() to allow + it to be called by create_snapshot() before the snapshot is actually + created. + """ + snapshot_lock_expires_at = module.params['snapshot_lock_expires_at'] + + if snapshot_lock_expires_at: # Then user has specified wish to lock snap + lock_expires_at = arrow.get(snapshot_lock_expires_at) + + # Check for lock in the past + now = arrow.utcnow() + if lock_expires_at <= now: + msg = "Cannot lock snapshot with a snapshot_lock_expires_at " + msg += "of '{}' from the past".format(snapshot_lock_expires_at) + module.fail_json(msg=msg) + + # Check for lock later than max lock, i.e. too far in future. + max_delta_minutes = 43200 # 30 days in minutes + max_lock_expires_at = now.shift(minutes=max_delta_minutes) + if lock_expires_at >= max_lock_expires_at: + msg = "snapshot_lock_expires_at exceeds {} days in the future".format( + max_delta_minutes//24//60) + module.fail_json(msg=msg) + + +def manage_snapshot_locks(module, snapshot): + """ + Manage the locking of a snapshot. Check for bad lock times. + See check_snapshot_lock_options() which has additional checks. + """ + name = module.params["name"] + snapshot_lock_expires_at = module.params['snapshot_lock_expires_at'] + snap_is_locked = snapshot.get_lock_state() == "LOCKED" + current_lock_expires_at = snapshot.get_lock_expires_at() + changed = False + + check_snapshot_lock_options(module) + + if snapshot_lock_expires_at: # Then user has specified wish to lock snap + lock_expires_at = arrow.get(snapshot_lock_expires_at) + if snap_is_locked and lock_expires_at < current_lock_expires_at: + # Lock earlier than current lock + msg = "snapshot_lock_expires_at '{}' preceeds the current lock time of '{}'".format( + lock_expires_at, + current_lock_expires_at) + module.fail_json(msg=msg) + elif snap_is_locked and lock_expires_at == current_lock_expires_at: + # Lock already set to correct time + pass + else: + # Set lock + if not module.check_mode: + snapshot.update_lock_expires_at(lock_expires_at) + changed = True + return changed + + +def handle_stat(module): + system, pool, volume, parname = get_sys_pool_vol_parname(module) + if not volume: + msg = "Volume {} not found. Cannot stat.".format(module.params['name']) + module.fail_json(msg=msg) + fields = volume.get_fields() #from_cache=True, raw_value=True) + created_at = str(fields.get('created_at', None)) + has_children = fields.get('has_children', None) + lock_expires_at= str(volume.get_lock_expires_at()) + lock_state = volume.get_lock_state() + mapped = str(fields.get('mapped', None)) + name = fields.get('name', None) + parent_id = fields.get('parent_id', None) + size = str(volume.get_size()) + updated_at = str(fields.get('updated_at', None)) + used = str(fields.get('used_size', None)) + volume_id = fields.get('id', None) + volume_type = fields.get('type', None) + if volume_type == 'SNAPSHOT': + msg = 'Snapshot stat found' + else: + msg = 'Volume stat found' + + result = dict( + changed=False, + created_at=created_at, + has_children=has_children, + lock_expires_at=lock_expires_at, + lock_state=lock_state, + mapped=mapped, + msg=msg, + parent_id=parent_id, + size=size, + updated_at=updated_at, + used=used, + volume_id=volume_id, + volume_type=volume_type, + ) + module.exit_json(**result) + + +def handle_present(module): + system, pool, volume, parname = get_sys_pool_vol_parname(module) + volume_type = module.params['volume_type'] + if volume_type == 'master': + if not volume: + changed = create_volume(module, system) + module.exit_json(changed=changed, msg="Volume created") + else: + changed = update_volume(module, volume) + module.exit_json(changed=changed, msg="Volume updated") + elif volume_type == 'snapshot': + snapshot = volume + if not snapshot: + changed = create_snapshot(module, system) + module.exit_json(changed=changed, msg="Snapshot created") + else: + changed = update_snapshot(module, snapshot) + module.exit_json(changed=changed, msg="Snapshot updated") + else: + module.fail_json(msg='A programming error has occurred') + + +def handle_absent(module): + system, pool, volume, parname = get_sys_pool_vol_parname(module) + volume_type = module.params['volume_type'] + + if volume and volume.get_lock_state() == "LOCKED": + msg = "Cannot delete snapshot. Locked." + module.fail_json(msg=msg) + + if volume_type == 'master': + if not volume: + module.exit_json(changed=False, msg="Volume already absent") + else: + changed = delete_volume(module, volume) + module.exit_json(changed=changed, msg="Volume removed") + elif volume_type == 'snapshot': + if not volume: + module.exit_json(changed=False, msg="Snapshot already absent") + else: + snapshot = volume + changed = delete_volume(module, snapshot) + module.exit_json(changed=changed, msg="Snapshot removed") + else: + module.fail_json(msg='A programming error has occured') + + +def execute_state(module): + state = module.params['state'] + try: + if state == 'stat': + handle_stat(module) + elif state == 'present': + handle_present(module) + elif state == 'absent': + handle_absent(module) + else: + module.fail_json(msg='Internal handler error. Invalid state: {0}'.format(state)) + finally: + system = get_system(module) + system.logout() + + +def check_options(module): + """Verify module options are sane""" + state = module.params['state'] + size = module.params['size'] + pool = module.params['pool'] + volume_type = module.params['volume_type'] + parent_volume_name = module.params['parent_volume_name'] + if state == 'present': + if volume_type == 'master': + if state == 'present': + if parent_volume_name: + msg = "parent_volume_name should not be specified " + msg += "if volume_type is 'volume'. Snapshots only." + module.fail_json(msg=msg) + if not size: + msg = "Size is required to create a volume" + module.fail_json(msg=msg) + elif volume_type == "snapshot": + if size or pool: + msg = "Neither pool nor size should not be specified " + msg += "for volume_type snapshot" + module.fail_json(msg=msg) + if state == "present": + if not parent_volume_name: + msg = "For state 'present' and volume_type 'snapshot', " + msg += "parent_volume_name is required" + module.fail_json(msg=msg) + else: + msg = "A programming error has occurred" + module.fail_json(msg=msg) + + +def main(): + argument_spec = infinibox_argument_spec() + argument_spec.update( + dict( + name=dict(required=True), + parent_volume_name=dict(required=False), + pool=dict(required=False), + size=dict(), + snapshot_lock_expires_at=dict(), + snapshot_lock_only=dict(type='bool', default=False), + state=dict(default='present', choices=['stat', 'present', 'absent']), + thin_provision=dict(type='bool', default=True), + volume_type=dict(default='master', choices=['master', 'snapshot']), + ) + ) + + module = AnsibleModule(argument_spec, supports_check_mode=True) + + if not HAS_INFINISDK: + module.fail_json(msg=missing_required_lib('infinisdk')) + + if module.params['size']: + try: + Capacity(module.params['size']) + except Exception: + module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units') + + check_options(module) + execute_state(module) + + +if __name__ == '__main__': + main() diff --git a/collections-debian-merged/ansible_collections/infinidat/infinibox/requirements.txt b/collections-debian-merged/ansible_collections/infinidat/infinibox/requirements.txt new file mode 100644 index 00000000..b6148b7b --- /dev/null +++ b/collections-debian-merged/ansible_collections/infinidat/infinibox/requirements.txt @@ -0,0 +1,63 @@ +ansible==2.9.2 +api-object-schema==2.0.0 +appdirs==1.4.3 +arrow==0.15.0 +asn1crypto==0.24.0 +astroid==2.3.3 +atomicwrites==1.3.0 +attrs==19.1.0 +black==19.10b0 +capacity==1.3.14 +certifi==2019.6.16 +cffi==1.12.3 +chardet==3.0.4 +Click==7.0 +colorama==0.4.1 +confetti==2.5.3 +cryptography==2.7 +flux==1.3.5 +gossip==2.4.0 +idna==2.8 +importlib-metadata==0.23 +infi.dtypes.iqn==0.4.0 +infi.dtypes.wwn==0.1.1 +infinisdk==151.1.1 +isort==4.3.21 +Jinja2==2.10.3 +lazy-object-proxy==1.4.2 +Logbook==1.5.3 +MarkupSafe==1.1.1 +mccabe==0.6.1 +mitba==1.1.1 +more-itertools==5.0.0 +munch==2.3.2 +packaging==19.1 +pact==1.12.0 +pathspec==0.6.0 +pluggy==0.12.0 +py==1.8.0 +pycodestyle==2.5.0 +pycparser==2.19 +pylint==2.4.3 +pyparsing==2.4.2 +pytest==5.1.2 +python-dateutil==2.8.0 +PyYAML==5.1.2 +regex==2019.8.19 +requests==2.22.0 +ruamel.yaml==0.16.5 +ruamel.yaml.clib==0.2.0 +sentinels==1.0.0 +six==1.12.0 +storage-interfaces==1.0.3 +toml==0.10.0 +typed-ast==1.4.0 +urllib3==1.25.3 +URLObject==2.4.3 +vintage==0.4.1 +voluptuous==0.11.7 +waiting==1.4.1 +wcwidth==0.1.7 +wheel==0.34.2 +wrapt==1.11.2 +zipp==0.6.0 -- cgit v1.2.3