diff options
Diffstat (limited to 'collections-debian-merged/ansible_collections/cisco/asa')
189 files changed, 23480 insertions, 0 deletions
diff --git a/collections-debian-merged/ansible_collections/cisco/asa/.gitignore b/collections-debian-merged/ansible_collections/cisco/asa/.gitignore new file mode 100644 index 00000000..6037698f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/.gitignore @@ -0,0 +1,3 @@ +.tox +__pycache__ +*.py[cod] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/.yamllint b/collections-debian-merged/ansible_collections/cisco/asa/.yamllint new file mode 100644 index 00000000..3adaf90c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/.yamllint @@ -0,0 +1,15 @@ +--- +extends: default + +ignore: | + .tox + changelogs/* + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + line-length: disable diff --git a/collections-debian-merged/ansible_collections/cisco/asa/FILES.json b/collections-debian-merged/ansible_collections/cisco/asa/FILES.json new file mode 100644 index 00000000..0a582a99 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/FILES.json @@ -0,0 +1,1881 @@ +{ + "files": [ + { + "name": ".", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/modules/asa_command.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0385be9e37e3110edf84b3ac2623f4a496312648fcc51c1db04eadecc9e2477e", + "format": 1 + }, + { + "name": "plugins/modules/asa_acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8c4b3b79e1f515dc699925c83fa5c864c36c97e26058aff2dad8be86c8096b0", + "format": 1 + }, + { + "name": "plugins/modules/asa_og.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "877fa1cfcf85b2a966410b21a8570dafa8cff78623bcbab11397b8f32c4d73ec", + "format": 1 + }, + { + "name": "plugins/modules/asa_acl.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a21be31e34e69cfc46446ab9d298592fd14797143adeb6e8f6ea94e477080edd", + "format": 1 + }, + { + "name": "plugins/modules/asa_config.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fff2b27d8c28630b20ab5f26bf5cb2ebbc6732fd8dc3a8d42f83edd29128f9fd", + "format": 1 + }, + { + "name": "plugins/modules/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/modules/asa_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b3b0ff35c772846b98e6519c9e46fbfb1faf0123bbd377a8107b35977bcae2fb", + "format": 1 + }, + { + "name": "plugins/modules/asa_ogs.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "da544650f5d5a27d539988720a8320d8f1386350474892b92ea3cc7a78c74688", + "format": 1 + }, + { + "name": "plugins/module_utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc091d92756095b6dc05f37d2a570a28645bbfcdb69a88ba0574d90720e61f1e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/ogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/ogs/ogs.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4f8da376ca10dbd28292d65ac83c15b727edb1de1b803fe033be04ce1fd75e94", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/ogs/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/config/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/utils", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/utils/utils.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "05d56bf98f7cedb4449370de6da6532d75eaa249cf707af0bae06c42da376cd8", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/providers", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/providers/providers.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ee054a878154ba76ef686115c5c883cd9a2cd4b74094a7313546da9b56b2f087", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/providers/module.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ab52598ac99da0e23d6a4e899bd8a947005278b7a49ab21e9b812ecfab22f2d0", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/providers/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "91cb90d8cde09d80e487d91d44c579360317d6f6d10e6b96671130821fbcaf7e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/ogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/ogs/ogs.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "920a0c5ce2b15d1dbe35633fc4f5fa5822ec5e4213d7d6c6f38f58b358fa4164", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/ogs/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a08b564ce06dea7dd04b7dac6803219c32a0f36f861a7835d736a5fac5d96f48", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/legacy", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/legacy/base.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "534e86ed209fcf7c561c4708b21515b05e12ed266295067ff9756c7b66b352f2", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/facts/legacy/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/rm_templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/rm_templates/ogs.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3fced5f90f3981c5dca2bc770ea0f7a2e36f1c3f934f77f18c2842bb7042cff1", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/rm_templates/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "45978b986f60a1a6b43f40803ec47a234ffb6eae7a7649a2a5f77281f19e68d4", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/asa.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "60b0b27d1b110c7ccd3d40cefb7fe85874a61ef2b18f534f78c3ef168e39e95e", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/acls/acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "70e99a7460ee744797b9ed717f4d714c91d0cbd4a3d665a382bf84d69c9d8859", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/acls/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/ogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/ogs/ogs.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c574815b4350ec1aa12c9dbf245ce55ed80524d28213c7b49aa3dd19109a184d", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/ogs/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/facts/facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39b339d1544bbdf50e535025c9337188057b13e7aad4ec5628d4d8e6719e6f30", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/facts/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/network/asa/argspec/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/module_utils/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/doc_fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/doc_fragments/asa.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2bff52dbdcbb90167b873de919ef115dc8c679c17eb4d8ed40473000f79708a7", + "format": 1 + }, + { + "name": "plugins/doc_fragments/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/action", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/action/asa.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "28ea6a3720ec779c33234966a433f7a7362fc0be1c9d7da70f0d7a78ef2bd222", + "format": 1 + }, + { + "name": "plugins/action/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/cliconf", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/cliconf/asa.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "76da52a54728fd2427d5cf7a11a93232cba3b8ec2bdaa1768f322171f114f525", + "format": 1 + }, + { + "name": "plugins/cliconf/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "plugins/terminal", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/terminal/asa.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "19a5a7c1301402180dbd91d97f497c9a8f1c1d462a78acd55dec454cdf7b4160", + "format": 1 + }, + { + "name": "plugins/terminal/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": ".gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "13efa8adb5f73be5234e611e5ec4cc509417641a49c47d861ae370cc86bbb981", + "format": 1 + }, + { + "name": "tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/.gitignore", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b5726d3ec9335a09c124469eca039523847a6b0f08a083efaefd002b83326600", + "format": 1 + }, + { + "name": "tests/unit", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/compat", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/compat/mock.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "52ecd54195edca933104eb3e937547c7395ff604ada2694a8b184c2c1466dbf1", + "format": 1 + }, + { + "name": "tests/unit/compat/unittest.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3ed698b1faec43d87a2c1ebcb15a2aae48b09ff355bb9a598e5f5a1c928dbb30", + "format": 1 + }, + { + "name": "tests/unit/compat/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/compat/builtins.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba13a350ade8ef804336f888d5883b8e54f8bddfb9d0fadc10277a8ca6540f4e", + "format": 1 + }, + { + "name": "tests/unit/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/utils.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cce49441adb4dab720d817723e55cd5e9de3baab78cfc7fceec89b8e7200d87e", + "format": 1 + }, + { + "name": "tests/unit/modules/conftest.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2af4846e50d461a131ad3edfb609fbb39a9eb1796048c62e4ead8234bcf5c6a1", + "format": 1 + }, + { + "name": "tests/unit/modules/network", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/asa_module.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "002a025d6db336cba6124270825f1590da9ae08fb2209a39c73a0a23fb150514", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/test_asa_facts.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7ec3ca2952cc5497b3ba3c85cb4e5d1c6014bdaf39a61efc878f6c737d40c6e3", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/asa_og_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8c324a36273027bf40c6aa8003cc355200cfbf67e34ab630e406f74c87a40aee", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/asa_acls_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "361267bdd04bda2fdb69235826c8f20fd236671dff18879a0ab628978e12e662", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/asa_ogs_config.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7c9381eb8b5131448d21eea9056145fdc8e00ed420ddbb8e455e219237395b0d", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/asa_facts_show_memory", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6d382593bb23ea997498f73b6d41f3824667ce95eed3bde5a2584be1d02f27b3", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/asa_facts_show_version", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "63cb648fbc13e844b870ea31d8359b7a70b5b7e84a88a3478dbab9044960c6c9", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/asa_facts_dir", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "29a3ba9c51db713f26ce858365f65785fcc68aa5eb5bc018cbc9f40a0ac77104", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/fixtures/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/test_asa_acls.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ee31dcbf48ca133774f90d240c35118d30d84024729e5d183e29610dce609c83", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/test_asa_ogs.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4f26278567a0966578a65b9d940b31153a2dad2f76a5b622ff647d507f5ad60c", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/test_asa_og.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2d1165033fe3dd83db28c077b6030e3c486dfa65ddc37162a7457d5a2358fb37", + "format": 1 + }, + { + "name": "tests/unit/modules/network/asa/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/modules/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/mock", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/mock/vault_helper.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "feae23166b6eb502f7d9b77c314970516c9a99aaad7de01295b4dfdad53c5c09", + "format": 1 + }, + { + "name": "tests/unit/mock/yaml_helper.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "94e2f3c867d2582c9f7a0e99e544718e355025c4a51c9925e70158fa89b3609e", + "format": 1 + }, + { + "name": "tests/unit/mock/path.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "da4b5d2a14633249ba87e94990fac9d9636dc844d7a91f1b3bebe529fc072b93", + "format": 1 + }, + { + "name": "tests/unit/mock/loader.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0cfbf4c710a5d5725f84d5f34ab76ec1a0e853397cd945c90fd97769f89dddc5", + "format": 1 + }, + { + "name": "tests/unit/mock/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/unit/mock/procenv.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "689dbcfc213bfc2d2dd1fa65ab78355b296f22bf6bf9eff6b2b8a27aeedfaf46", + "format": 1 + }, + { + "name": "tests/unit/requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "49ba996dc4735c3463e9af561344346dfae14bcc1a68096ce78364b377f0df1f", + "format": 1 + }, + { + "name": "tests/unit/__init__.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "tests/integration", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/tests/cli/asa_og.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b83746652a9930b569f66d079af6e01f957c98b77ee80a7e960ef1490e447dee", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e65bb6e7286202bc2d31061a1ae235cd3a051fd42a2bff63e6714f1cb499f2ad", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_og/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10107b2eb06436720995c57ecec2a84c241a7ef5fce23d734bcf4bf77d4ed9aa", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "48418bfcfbd09b487400092798c29c3cbfb96cfb3956a786cbae2966c8c43692", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7747152a8b93f4a11fe3c0c7d8f1439f6e8850c37acf585b1608e50be8483e7c", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba3eaf57589c6393b0ffb5113d1c9be47587b4c85d39d2be8b1efd3620cecdd9", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2a00f9c6f94bdf5e1f2dc3431cab004b36946ca4baee07cece978f42254f2806", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "294e24d48b09bd1374394a59d847941f2f74be4d280978e6832cebc65b6da2da", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "01625314cdf11ee72bf597dd4e61c5c0471f5913e995c7c2bf06eeb4416e3e04", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/_parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "36c65fc73dd9852738647dd2e7f439147cdc29fcd5d4c24273686b3659545c74", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7e2912bd8d5e70042a403930da693d05f7e08feede7f25de3985143640a2251b", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fb3403481f8be9b0bf146a3ac1bdbec8c33a7edcf7ca4c1217ac67ac68522b8c", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e8abfafa58783f64673beed5f0065ce7d3cbd48a2f3b929776cfe276dddf5092", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "33c780254ef202bbdc66060c50d78b8636e9438e8b1aee25e89934b24887a9db", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c535eadec2ae8c6940cb71091fb7d50c6f71250a5f5a6cd78b2b646f9857cfc", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "8fc73956ad2351f87a20a5b231d8ebc8cb81d618a0f4bc92c020e46695ec2e5f", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb248929c73ced85f7ae3cbba03764bcfd88744108710206c807e43948e84646", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_ogs/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10107b2eb06436720995c57ecec2a84c241a7ef5fce23d734bcf4bf77d4ed9aa", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/redirection", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/redirection/shortname.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2f0348d6944add79921a40926f7b0aa744bfb988604529a49ace7e57d34f80b5", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/removal_error.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "60b3367239c349417bf8da368b70e0647c1a0b4e9da5d5f50d3ae0b996e261da", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c72fb9d4e3ecacfea95078d3cca3f3e2fb6e5e22cb264da02e6e7925b6dd21e9", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/toplevel_nonidempotent.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "661eb9ff0eaf56e7a40f0a14d35d3c6ebb5033dbbaba011af3d86b9cb073d35f", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/toplevel_before.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "60bdb57e41d281bcea81d87cff516192ef7e51bc65546a93883c153a80147b00", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/defaults.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4038fb90d01397a3e5d6de1acf973c1c04c3fb53ae5fb5fcda6fcaa644dc5631", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/sublevel_strict_mul_parents.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27f7d22db2f7e3369f7449462d49211d88ade8934899e6e9f35a8ddd4f085427", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/sublevel_exact.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b02c65055ff91d8a732849b264ad40a6a78f67551d52adce214f442184c30ff5", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/sublevel_block.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "77df0b0ff2370171ca0b16d2e24a1c41fb344eb3162eb73a16beb1cb225a1fcc", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/more_system.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "09948e38904217033b76717ccf017825f2126d96fbb918a1051816befee72b62", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/sublevel.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b600ef81e9000470a9d6f6068560585a23230d2e958044b82719cac221a7771e", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/sublevel_strict.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4545bfdfbfc66563d6b299a02870312f34d4c31d326d3217e3bce434529066ac", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/backup.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "050bc1319926a5741b811422c2785314df24bd3099f7e51baa5a58814c911de6", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/toplevel.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "63c8bb7343c467cbb2dfb5f3d576a39219e2224f2f33054e1f02aece88bcc833", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/toplevel_after.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "83cd8df51eee59587880d2d01cafa3d4c498860b749df90bed661b15d3d1a9d0", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tests/cli/force.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a62b96892a5c3a110ac863875103333f5f1a2783964a53b389fc14f40a9d2859", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/templates", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/templates/basic", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/templates/basic/config.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "65308b2b6c691f26581d2c167f0bee0c6175d39279ec8578bb86ca795d7de6fb", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/templates/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/templates/defaults/config.j2", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fb99eb6895703bb60ee1260b4fda100bc0715b494b276bd30af5f86140e3636c", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5a3241e2e06876730d3f3f7d95b6d7d8203210feb79863b4febe516f93e63ad1", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e7d7f58a1d24f52718c31cc560ba27eaf69da2df9e8b0d26516560b547d1d9da", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_config/tasks/redirection.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1c525344e3e8597208b16418f01433551a44e62bda60ed4c1b207ba2315b1b31", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests/cli/bad_operator.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef9148c49c1caaf2ae7bde7817adf45a0f2d661042dc97039689200a8e901cbf", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests/cli/timeout.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "deb846b6fcb5df7dd9e83c96b7e26f4ab8250757aa16a838cf13ba7832c944d5", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests/cli/output.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1a81177ae3253ebf198d31e1e57f88c5a68c1779a6d57216cbeb892cee0057c9", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests/cli/invalid.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "14304529fc650c523519ff678032db11ecb3bc798d8dfcc3534acf0d7238cf78", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tests/cli/contains.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "97549e0b9502ed012a890febceda8b8e3bd33431a075c06cf0a556f444442d55", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5a3241e2e06876730d3f3f7d95b6d7d8203210feb79863b4febe516f93e63ad1", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_command/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10107b2eb06436720995c57ecec2a84c241a7ef5fce23d734bcf4bf77d4ed9aa", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tests/cli/basic.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a380209b8a4e880cf098f6943b3d65e6e89bb1725edd56f34dc1dba982c5cf0e", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tests/cli/insert.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fcdc4949a95e06714689700f29cff560abb0aa70644806f0bb10fd4ddb0b6993", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tests/cli/full_name_match.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "758729b57c7beadba29c68741a212a877a61b09846adc1345e614f2ccfdfbd34", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5a3241e2e06876730d3f3f7d95b6d7d8203210feb79863b4febe516f93e63ad1", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acl/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10107b2eb06436720995c57ecec2a84c241a7ef5fce23d734bcf4bf77d4ed9aa", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tests/cli/invalid_subset.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ae38ef692dbc51640d3d4cf593c6c9914b6c90376c0bd37187b5d89976fe0703", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tests/cli/not_hardware.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e1221462597e03dce00a44c82e92bc31905ce4453cd04d6f2168024dee9ec4f5", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tests/cli/default_facts.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f5f1a8e574feb89ae33eda46d7ec50ba07fa6079f11aee5c41a670bf034eb1e7", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tests/cli/all_facts.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ab48ea672e571204ff994ea6b27078c82fc73111bd6588a5aa390ff8caf50156", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "126c357f960d8408c7d5e4c3bdc05e2e5e898330e173a4f56f72240f10aae4bb", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "33a8ebecfd2c3b3a89004fdc1640f74784dcc2938ce4a55bda708102596a7de8", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_facts/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10107b2eb06436720995c57ecec2a84c241a7ef5fce23d734bcf4bf77d4ed9aa", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/empty_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c000804c291e7e83c19ff95a542b3bc2f92ca990df55c120666aade0fae38d8b", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/_populate_network_og.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "99184795a348c3718179a12f6469025f5b40874888e2f73dee7eb7c241677b9d", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/deleted.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fc2b73e9bc9b0ca69bc6b41546b8851d82d10d6743ea7521891c7aad8e1d60b9", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/rendered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ba9e79850ac112dea3117332d3038817f6155aab67979d59d7e230973351ba2c", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/_remove_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4cf464b3bd8b5375ce936a39c61b4778d28ea9c92c1fc32669149d5dbcb1168e", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/merged.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b1efede62356ce86842ac8f6b6bee066643111f3725c59f71b9e9a892de2684f", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/parsed.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e0605cbeda5172fa13d34bf4c98910ff25e2cd0b35364ff83fd9caf9404d2d21", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/_parsed.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "17da50757f12e49ff1f1cf47ed4f1a5c4d9231d03e6ed89f5e9e19ccdb076c1c", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/replaced.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c4d83b178309e21b4855088e4079a60337bee0e73e55dac0fcb3ce091a9eafe8", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/gathered.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ffa88efc57c22d721b43dabae40143fa11f61e28e51632bc814c6a2c656df2a7", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/overridden.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ce2d5ce7bc001bd249859ef9305cbe1470438e194637e86e4f887cfc6c3d2c02", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/_populate_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b57b940b37127b0ffd87629fca86e1307283d57da12633d4313e233f3f42777b", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/_remove_og_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "386c512bf4a392dfcd2c508a47a29ec7c45729775e0e209c76de3e5095eef7a3", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2beabe457a240ec85141ca5a05cd2544624e397fdd2872d5f966849550468bf6", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/defaults/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c7a04f67f78ee48d4cd68a3fc7ec07e8736cf82ecdca0f9600eb2fbb621d390", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/vars", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/vars/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c252e1db1e7fbfdc103586e97a7d53278d9b109eadc2cdc876a79702fb2ca8f4", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tasks/cli.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "eb248929c73ced85f7ae3cbba03764bcfd88744108710206c807e43948e84646", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/tasks/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10107b2eb06436720995c57ecec2a84c241a7ef5fce23d734bcf4bf77d4ed9aa", + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/integration/targets/asa_acls/meta/main.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "format": 1 + }, + { + "name": "tests/integration/target-prefixes.network", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b323ba8eb5a4df2f162b251ea20b37f6887c7f88714de8ab70ebb4dc99beade5", + "format": 1 + }, + { + "name": "tests/integration/network-integration.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d67b11263a8f50b30bf43c7c2b4bdd8dc4f173f0b5dd22761311360dfbd56a1d", + "format": 1 + }, + { + "name": "tests/sanity", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/sanity/requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c8a4ac4bfdef88e75d6e748e35a42fb4915947dfa2b7dd788626fd829600e014", + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.10.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9a01d39f278abada36c8f698d56c3a0c17efdf85178ceba34c1dc3c523679b9d", + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.9.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fd9dba052f215e7f8be6af9c137d3f7b143bb64dd454d176cc60b82b45399a32", + "format": 1 + }, + { + "name": "test-requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d11c80229cfeba90b38ad16f96ddca133d9633808515599561579cd0e4fd659b", + "format": 1 + }, + { + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "format": 1 + }, + { + "name": "changelogs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "87707263b69af83db185480e9c965b2a1fee283fc57226ea02f287549e19c932", + "format": 1 + }, + { + "name": "changelogs/changelog.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e1dbbea2af945b1ef70430788f4bc702b41b5bb7e248bf10a395be41d919e8f2", + "format": 1 + }, + { + "name": "changelogs/CHANGELOG.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "17ece3f3284d75ac382f83913eefbd3276d1744c396183d3112e272f70407303", + "format": 1 + }, + { + "name": "changelogs/fragments", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "changelogs/fragments/galaxy-version.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dda8eb2efcf0e2d799b90db8e752e5d9b5bcc49cbb0d3a55a997fea15c0520a1", + "format": 1 + }, + { + "name": "changelogs/fragments/76_asa_og_state_delete_not_working_as_expected.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ffa0c5d029934b66fd88a67f29975d18b9fa59f26b3618b35ec1a03ba1da7e8d", + "format": 1 + }, + { + "name": "changelogs/fragments/56_acl_any4_ay6_feature_update_use_rm_approach.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c4dbce6c3eeab14ae0b31a29d442476e8b866583211841abc206795ac35b49d", + "format": 1 + }, + { + "name": "changelogs/fragments/69_resolves_acl_failure.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "89d1b570038fd757714c1890d84e493e09a740e3945fb721fc4889fda739850d", + "format": 1 + }, + { + "name": "requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "47d9fe78273fd64c750e78a317b1a59a6f87ebb93d8d4cf9ae6d98a0f2fc9f9e", + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bcf503ad9c373b9a0af74b23483d573b017c636603538e7ce67d45aca0761fb8", + "format": 1 + }, + { + "name": ".yamllint", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "827ef9e031ecdcaf137be239d33ef93fcbbc3611cbb6b30b0e507d0e03373d0e", + "format": 1 + }, + { + "name": "meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3c21302b2bb59ebe7e69a086cc6ff2c746dab17eea87070b191eda315beb003f", + "format": 1 + }, + { + "name": "docs", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_cliconf.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "0f450591136cd08a043e36557bba93fb0ebf1a19661d143c71d40e74b1baa552", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_facts_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b373bfa858679507001af5a41506cbe548007f70ee421989c545e747179a83b3", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_acls_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d76ed1d1f920e2ebb9eeefc607678c8d426d0db8e24390bf0b2e3ce7acfe5b38", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_acl_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "10e10ac1a7102a9779da92909e40891ba5249cfe7b34e6899e4b7c2c3de35869", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_command_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "bc56d4332eeac8e1860e4906cfc29df5c2e06a861f90c25846e57787342a2131", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_og_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "86f91c0e025a2a329f2db95943845f60049266f6142d6a3bd395b24c1ff4072a", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_ogs_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "66160314ee315a56e577046b6bf01d4a5db970a267b4a5e48e7826c18f3d22b9", + "format": 1 + }, + { + "name": "docs/cisco.asa.asa_config_module.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7b5400359672b51d477e29435cd9045a6e93b265c5d5655a0a430b7aa04bbd25", + "format": 1 + }, + { + "name": "tox.ini", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fa849abc071b00742c00b96e3df480355a2af2c60e4c920f085a9ac5616d8d4b", + "format": 1 + }, + { + "name": "bindep.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "80645079eb025b3a905b4775ac545d080a3d7d35d537c31e04f7197c94315ab5", + "format": 1 + } + ], + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/LICENSE b/collections-debian-merged/ansible_collections/cisco/asa/LICENSE new file mode 100644 index 00000000..f288702d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<https://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<https://www.gnu.org/licenses/why-not-lgpl.html>. diff --git a/collections-debian-merged/ansible_collections/cisco/asa/MANIFEST.json b/collections-debian-merged/ansible_collections/cisco/asa/MANIFEST.json new file mode 100644 index 00000000..5937afa6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/MANIFEST.json @@ -0,0 +1,35 @@ +{ + "collection_info": { + "namespace": "cisco", + "name": "asa", + "version": "1.0.4", + "authors": [ + "Ansible Security Community (ansible-security)" + ], + "readme": "README.md", + "tags": [ + "cisco", + "asa", + "networking", + "security" + ], + "description": "Ansible Security Collection for Cisco ASA devices.", + "license": [], + "license_file": "LICENSE", + "dependencies": { + "ansible.netcommon": "*" + }, + "repository": "https://github.com/ansible-collections/cisco.asa", + "documentation": null, + "homepage": null, + "issues": null + }, + "file_manifest_file": { + "name": "FILES.json", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "27687d0148a829f0f8498e2f4a3935327029d3f0b7524876f4c87f1a86829320", + "format": 1 + }, + "format": 1 +}
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/README.md b/collections-debian-merged/ansible_collections/cisco/asa/README.md new file mode 100644 index 00000000..89202d67 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/README.md @@ -0,0 +1,206 @@ +# CISCO ASA Ansible Collection + +[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/cisco.asa) <!--[![Codecov](https://img.shields.io/codecov/c/github/ansible-collections/cisco)](https://codecov.io/gh/ansible-collections/cisco.asa)--> + +The Ansible Cisco ASA collection includes a variety of Ansible content to help automate the management of Cisco ASA firewall appliances. + +<!--start requires_ansible--> +## Ansible version compatibility + +This collection has been tested against following Ansible versions: **>=2.9.10,<2.11**. + +Plugins and modules within a collection may be tested with only specific Ansible versions. +A collection may contain metadata that identifies these versions. +PEP440 is the schema used to describe the versions of Ansible. +<!--end requires_ansible--> + +## Tested with Ansible + +This collection has been tested against Cisco ASA 9.10(1)11 and Cisco ASA image configured over Zuul with version 9.12.3. +<!-- List the versions of Ansible the collection has been tested with. Must match what is in galaxy.yml. --> + +## External requirements +<!-- List any external resources the collection depends on, for example minimum versions of an OS, libraries, or utilities. Do not list other Ansible collections here. --> +### Supported connections +The Cisco ASA collection supports ``network_cli`` connections. + +## Included content + +<!--start collection content--> +### Cliconf plugins +Name | Description +--- | --- +[cisco.asa.asa](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_cliconf.rst)|Use asa cliconf to run command on Cisco ASA platform + +### Modules +Name | Description +--- | --- +[cisco.asa.asa_acl](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_acl_module.rst)|(deprecated, removed after 2022-06-01) Manage access-lists on a Cisco ASA +[cisco.asa.asa_acls](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_acls_module.rst)|Access-Lists resource module +[cisco.asa.asa_command](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_command_module.rst)|Run arbitrary commands on Cisco ASA devices +[cisco.asa.asa_config](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_config_module.rst)|Manage configuration sections on Cisco ASA devices +[cisco.asa.asa_facts](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_facts_module.rst)|Collect facts from remote devices running Cisco ASA +[cisco.asa.asa_og](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_og_module.rst)|(deprecated, removed after 2022-06-01) Manage object groups on a Cisco ASA +[cisco.asa.asa_ogs](https://github.com/ansible-collections/cisco.asa/blob/main/docs/cisco.asa.asa_ogs_module.rst)|Object Group resource module + +<!--end collection content--> + +## Installing this collection + +You can install the Cisco ASA collection with the Ansible Galaxy CLI: + + ansible-galaxy collection install cisco.asa + +You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: + +```yaml +--- +collections: + - name: cisco.asa +``` +## Using this collection + +This collection includes [security resource modules](https://docs.ansible.com/ansible/latest/network/user_guide/network_resource_modules.html). Similar to Network resource modules introduced in Ansible `2.9` + +### Using Cisco ASA Ansible Collection + +An example for using this collection to manage a ACL resource +[Cisco ASA](https://www.cisco.com/c/en/us/td/docs/security/asa/asa90/configuration/guide/asa_90_cli_config/acl_extended.html) +is as follows: + +`inventory.ini` (Note the password should be managed by a [Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) for a production environment. +``` +[asa01] +host_asa.example.com + +[asa01:vars] +ansible_user=admin +ansible_ssh_pass=password +ansible_become=true +ansible_become_method=ansible.netcommon.enable +ansible_become_pass=become_password +ansible_connection=ansible.netcommon.network_cli +ansible_network_os=cisco.asa.asa +ansible_python_interpreter=python +``` + +#### Using the modules with Fully Qualified Collection Name (FQCN) + +You can either call modules by their Fully Qualified Collection Namespace (FQCN), like `cisco.asa.asa_acls`, or you can call modules by their short name if you list the `cisco.asa` collection in the playbook's `collections`, as follows: + +```yaml +--- +- hosts: asa01 + gather_facts: false + connection: network_cli + + collections: + - cisco.asa + + tasks: + - name: Merge the provided configuration with the existing running configuration + register: result + cisco.asa.asa_acls: &id001 + config: + - acls: + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol: tcp + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - name: test_R1_traffic + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: merged +``` + +The following example task replaces configuration changes in the existing configuration on a Cisco ASA firewall device, using the FQCN: + + ```yaml + --- + - name: Replace device configurations of listed ACLs with provided configurations + register: result + cisco.asa.asa_acls: &id001 + config: + + - acls: + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + state: replaced +``` + +## Contributing to this collection + +We welcome community contributions to this collection. If you find problems, please open an issue or create a PR against the [Cisco ASA collection repository](https://github.com/ansible-collections/cisco.asa). See [Contributing to Ansible-maintained collections](https://docs.ansible.com/ansible/devel/community/contributing_maintained_collections.html#contributing-maintained-collections) for complete details. + +You can also join us on: + +- Freenode IRC - ``#ansible-security`` Freenode channel + +See the [Ansible Community Guide](https://docs.ansible.com/ansible/latest/community/index.html) for details on contributing to Ansible. + +### Code of Conduct +This collection follows the Ansible project's +[Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html). +Please read and familiarize yourself with this document. + +## Release notes +<!--Add a link to a changelog.md file or an external docsite to cover this information. --> +Release notes are available [here](https://github.com/ansible-collections/cisco.asa/blob/main/changelogs/CHANGELOG.rst). + +## Roadmap + +<!-- Optional. Include the roadmap for this collection, and the proposed release/versioning strategy so users can anticipate the upgrade/update cycle. --> + +## More information + +- [Ansible Collection overview](https://github.com/ansible-collections/overview) +- [Ansible User guide](https://docs.ansible.com/ansible/latest/user_guide/index.html) +- [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html) +- [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) + +## Licensing + +GNU General Public License v3.0 or later. + +See [LICENSE](https://www.gnu.org/licenses/gpl-3.0.txt) to see the full text. diff --git a/collections-debian-merged/ansible_collections/cisco/asa/bindep.txt b/collections-debian-merged/ansible_collections/cisco/asa/bindep.txt new file mode 100644 index 00000000..ba9c980f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/bindep.txt @@ -0,0 +1,6 @@ +# This is a cross-platform list tracking distribution packages needed by tests; +# see https://docs.openstack.org/infra/bindep/ for additional information. + +gcc-c++ [doc test platform:rpm] +python3-devel [test platform:rpm] +python3 [test platform:rpm] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/CHANGELOG.rst b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/CHANGELOG.rst new file mode 100644 index 00000000..8cc74f16 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/CHANGELOG.rst @@ -0,0 +1,77 @@ +================================== +Cisco Asa Collection Release Notes +================================== + +.. contents:: Topics + +v1.0.4 +====== + +Release Summary +--------------- + +- Releasing 1.0.4 with updated readme with changelog link, galaxy description, and bugfix. + +Bugfixes +-------- + +- Update asa acls RM to use newer RM design approach and addeed support for any4/any6 feature (https://github.com/ansible-collections/cisco.asa/pull/64). +- Add version key to galaxy.yaml to work around ansible-galaxy bug +- To fix ASA OGs module where delete by name was not resulting to an expected behaviour (https://github.com/ansible-collections/cisco.asa/pull/77). + +v1.0.3 +====== + +Release Summary +--------------- + +- Releasing 1.0.3 with updated readme with changelog link, galaxy description, and bugfix. + +Bugfixes +-------- + +- Unexpected set of CMDs fired when source and destination were both set to hosts acl. (https://github.com/ansible-collections/cisco.asa/pull/69). + +v1.0.2 +====== + +Release Summary +--------------- + +- Re-releasing 1.0.1 with updated changelog. + +v1.0.1 +====== + +Minor Changes +------------- + +- Removes Cisco ASA sanity ignores and sync for argspec and docstring (https://github.com/ansible-collections/cisco.asa/pull/59). +- Updated docs. + +Bugfixes +-------- + +- Make `src`, `backup` and `backup_options` in asa_config work when module alias is used (https://github.com/ansible-collections/cisco.asa/pull/61). + +v1.0.0 +====== + +New Plugins +----------- + +Cliconf +~~~~~~~ + +- asa - Use asa cliconf to run command on Cisco ASA platform + +New Modules +----------- + +- asa_acl - (deprecated, removed after 2022-06-01) Manage access-lists on a Cisco ASA +- asa_acls - Access-Lists resource module +- asa_command - Run arbitrary commands on Cisco ASA devices +- asa_config - Manage configuration sections on Cisco ASA devices +- asa_facts - Collect facts from remote devices running Cisco ASA +- asa_og - (deprecated, removed after 2022-06-01) Manage object groups on a Cisco ASA +- asa_ogs - Object Group resource module diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/changelog.yaml b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/changelog.yaml new file mode 100644 index 00000000..6ac0418d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/changelog.yaml @@ -0,0 +1,73 @@ +ancestor: null +releases: + 1.0.0: + modules: + - description: (deprecated, removed after 2022-06-01) Manage access-lists on a + Cisco ASA + name: asa_acl + namespace: '' + - description: Access-Lists resource module + name: asa_acls + namespace: '' + - description: Run arbitrary commands on Cisco ASA devices + name: asa_command + namespace: '' + - description: Manage configuration sections on Cisco ASA devices + name: asa_config + namespace: '' + - description: Collect facts from remote devices running Cisco ASA + name: asa_facts + namespace: '' + - description: (deprecated, removed after 2022-06-01) Manage object groups on + a Cisco ASA + name: asa_og + namespace: '' + - description: Object Group resource module + name: asa_ogs + namespace: '' + plugins: + cliconf: + - description: Use asa cliconf to run command on Cisco ASA platform + name: asa + namespace: null + release_date: '2020-06-23' + 1.0.1: + changes: + bugfixes: + - Make `src`, `backup` and `backup_options` in asa_config work when module alias + is used (https://github.com/ansible-collections/cisco.asa/pull/61). + minor_changes: + - Removes Cisco ASA sanity ignores and sync for argspec and docstring + (https://github.com/ansible-collections/cisco.asa/pull/59). + - Updated docs. + fragments: + - 48-add-change-log-1.0.0.yaml + - 1.1.0_update_docs.yaml + - fix_config_module_src_backup.yaml + - remove_asa_ignore.yaml + release_date: '2020-08-03' + 1.0.2: + changes: + release_summary: + - Re-releasing 1.0.1 with updated changelog. + fragments: + - 1.0.2.yaml + release_date: '2020-08-07' + 1.0.3: + changes: + bugfixes: + - Unexpected set of CMDs fired when source and destination were both set to hosts acl (https://github.com/ansible-collections/cisco.asa/pull/69). + fragments: + - 69-asa-acls-bugfix.yaml + release_date: '2020-08-28' + 1.0.4: + changes: + bugfixes: + - Update asa acls RM to use newer RM design approach and addeed support for any4/any6 feature (https://github.com/ansible-collections/cisco.asa/pull/64). + - Add version key to galaxy.yaml to work around ansible-galaxy bug + - To fix ASA OGs module where delete by name was not resulting to an expected behaviour (https://github.com/ansible-collections/cisco.asa/pull/77). + fragments: + - 56_acl_any4_ay6_feature_update_use_rm_approach.yaml + - galaxy-version.yaml + - 76_asa_og_state_delete_not_working_as_expected.yaml + release_date: '2020-11-26' diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/config.yaml new file mode 100644 index 00000000..dbcc1e3e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/config.yaml @@ -0,0 +1,30 @@ +changelog_filename_template: CHANGELOG.rst +changelog_filename_version_depth: 0 +changes_file: changelog.yaml +changes_format: combined +keep_fragments: false +mention_ancestor: true +new_plugins_after_name: removed_features +notesdir: fragments +prelude_section_name: release_summary +prelude_section_title: Release Summary +flatmap: true +sections: +- - major_changes + - Major Changes +- - minor_changes + - Minor Changes +- - breaking_changes + - Breaking Changes / Porting Guide +- - deprecated_features + - Deprecated Features +- - removed_features + - Removed Features (previously deprecated) +- - security_fixes + - Security Fixes +- - bugfixes + - Bugfixes +- - known_issues + - Known Issues +title: Cisco Asa Collection +trivial_section_name: trivial diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/56_acl_any4_ay6_feature_update_use_rm_approach.yaml b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/56_acl_any4_ay6_feature_update_use_rm_approach.yaml new file mode 100644 index 00000000..0365ba1d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/56_acl_any4_ay6_feature_update_use_rm_approach.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Update asa acls RM to use newer RM design approach and addeed support for any4/any6 feature (https://github.com/ansible-collections/cisco.asa/issues/56). diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/69_resolves_acl_failure.yaml b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/69_resolves_acl_failure.yaml new file mode 100644 index 00000000..071d2cd0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/69_resolves_acl_failure.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Unexpected set of CMDs fired when source and destination were both set to hosts acl (https://github.com/ansible-collections/cisco.asa/pull/69). diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/76_asa_og_state_delete_not_working_as_expected.yaml b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/76_asa_og_state_delete_not_working_as_expected.yaml new file mode 100644 index 00000000..1eb870ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/76_asa_og_state_delete_not_working_as_expected.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - To fix ASA OGs module where delete by name was not resulting to an expected behaviour (https://github.com/ansible-collections/cisco.asa/pull/77). diff --git a/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/galaxy-version.yaml b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/galaxy-version.yaml new file mode 100644 index 00000000..6d5e47ea --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/changelogs/fragments/galaxy-version.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Add version key to galaxy.yaml to work around ansible-galaxy bug diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_acl_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_acl_module.rst new file mode 100644 index 00000000..4e4fd5fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_acl_module.rst @@ -0,0 +1,457 @@ +.. _cisco.asa.asa_acl_module: + + +***************** +cisco.asa.asa_acl +***************** + +**(deprecated, removed after 2022-06-01) Manage access-lists on a Cisco ASA** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Newer and updated modules released with more functionality in Ansible 2.10 +:Alternative: asa_acl + + + +Synopsis +-------- +- This module allows you to work with access-lists on a Cisco ASA device. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of commands to append to the end of the command stack if a changed needs to be made. Just like with <em>before</em> this allows the playbook designer to append a set of commands to be executed after the command set.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code> and <code>become: yes</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The <em>config</em> argument allows the implementer to pass in the configuration to use as the base config for comparison.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>context</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>force</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>The force argument instructs the module to not consider the current devices running-config. When set to true, this will cause the module to push the contents of <em>src</em> into the device without first checking if already configured.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>lines</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser.</div> + <div style="font-size: small; color: darkgreen"><br/>aliases: commands</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>match</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>line</b> ←</div></li> + <li>strict</li> + <li>exact</li> + </ul> + </td> + <td> + <div>Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to <em>line</em>, commands are matched line by line. If match is set to <em>strict</em>, command lines are matched with respect to position. Finally if match is set to <em>exact</em>, command lines must be an equal match.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>passwords</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>provider</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>A dict object containing connection details.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>auth_pass</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use if required to enter privileged mode on the remote device. If <em>authorize</em> is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTH_PASS</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>password</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_PASSWORD</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the port to use when building the connection to the remote device.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ssh_keyfile</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">path</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_SSH_KEYFILE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timeout</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies idle timeout in seconds for the connection, in seconds. Useful if the console freezes before continuing. For example when saving configurations.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>username</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_USERNAME</code> will be used instead.</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>replace</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>line</b> ←</div></li> + <li>block</li> + </ul> + </td> + <td> + <div>Instructs the module on the way to perform the configuration on the device. If the replace argument is set to <em>line</em> then the modified lines are pushed to the device in configuration mode. If the replace argument is set to <em>block</em> then the entire command block is pushed to the device in configuration mode if any line is not correct.</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` + + + +Examples +-------- + +.. code-block:: yaml + + - cisco.asa.asa_acl: + lines: + - access-list ACL-ANSIBLE extended permit tcp any any eq 82 + - access-list ACL-ANSIBLE extended permit tcp any any eq www + - access-list ACL-ANSIBLE extended permit tcp any any eq 97 + - access-list ACL-ANSIBLE extended permit tcp any any eq 98 + - access-list ACL-ANSIBLE extended permit tcp any any eq 99 + before: clear configure access-list ACL-ANSIBLE + match: strict + replace: block + provider: '{{ cli }}' + + - cisco.asa.asa_acl: + lines: + - access-list ACL-OUTSIDE extended permit tcp any any eq www + - access-list ACL-OUTSIDE extended permit tcp any any eq https + context: customer_a + provider: '{{ cli }}' + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>updates</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The set of commands that will be pushed to the remote device</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['access-list ACL-OUTSIDE extended permit tcp any any eq www']</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Patrick Ogenstad (@ogenstad) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_acls_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_acls_module.rst new file mode 100644 index 00000000..e383701a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_acls_module.rst @@ -0,0 +1,3220 @@ +.. _cisco.asa.asa_acls_module: + + +****************** +cisco.asa.asa_acls +****************** + +**Access-Lists resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module configures and manages the named or numbered ACLs on ASA platforms. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="7">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="7"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>A dictionary of ACL options.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="6"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>acls</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>A list of Access Control Lists (ACL).</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>aces</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>The entries within the ACL.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>destination</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the packet destination.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>address</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Host address to match, or any single host address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>any</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match any destination address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>any4</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match any ipv4 destination address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>any6</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match any ipv6 destination address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>A single destination host</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>interface</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Use interface address as destination address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>netmask</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Netmask for destination IP address, valid with IPV4 address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>object_group</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Network object-group for destination address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port_protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the destination port along with protocol.</div> + <div>Note, Valid with TCP/UDP protocol_options</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>eq</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets on a given port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>gt</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets with a greater port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>lt</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets with a lower port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>neq</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets not on a given port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>range</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Port range operator</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>end</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the end of the port range.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>start</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the start of the port range.</div> + </td> + </tr> + + + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>grant</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>permit</li> + <li>deny</li> + </ul> + </td> + <td> + <div>Specify the action.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>inactive</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Keyword for disabling an ACL element.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>line</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Use this to specify line number at which ACE should be entered.</div> + <div>Existing ACE can be updated based on the input line number.</div> + <div>It's not a required param in case of configuring the acl, but in case of Delete operation it's required, else Delete operation won't work as expected.</div> + <div>Refer to vendor documentation for valid values.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>log</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>default</li> + <li>alerts</li> + <li>critical</li> + <li>debugging</li> + <li>disable</li> + <li>emergencies</li> + <li>errors</li> + <li>informational</li> + <li>interval</li> + <li>notifications</li> + <li>warnings</li> + </ul> + </td> + <td> + <div>Log matches against this entry.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the protocol to match.</div> + <div>Refer to vendor documentation for valid values.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol_options</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>protocol type.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ahp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Authentication Header Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>eigrp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Cisco's EIGRP routing protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>esp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Encapsulation Security Payload.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>gre</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Cisco's GRE tunneling.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>icmp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Internet Control Message Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>alternate_address</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Alternate address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>conversion_error</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Datagram conversion</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>echo</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Echo (ping)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>echo_reply</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Echo reply</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>information_reply</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Information replies</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>information_request</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Information requests</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>mask_reply</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Mask replies</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>mask_request</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>mask_request</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>mobile_redirect</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Mobile host redirect</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>parameter_problem</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>All parameter problems</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>redirect</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>All redirects</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>router_advertisement</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Router discovery advertisements</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>router_solicitation</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Router discovery solicitations</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>source_quench</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Source quenches</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>source_route_failed</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Source route</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>time_exceeded</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>All time exceededs</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timestamp_reply</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Timestamp replies</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timestamp_request</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Timestamp requests</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>traceroute</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Traceroute</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>unreachable</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>All unreachables</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>icmp6</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Internet Control Message Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>echo</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Echo (ping)</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>echo_reply</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Echo reply</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>membership_query</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Membership query</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>membership_reduction</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Membership reduction</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>membership_report</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Membership report</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>neighbor_advertisement</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Neighbor advertisement</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>neighbor_redirect</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Neighbor redirect</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>neighbor_solicitation</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Neighbor_solicitation</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>packet_too_big</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Packet too big</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>parameter_problem</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Parameter problem</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>router_advertisement</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Router discovery advertisements</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>router_renumbering</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Router renumbering</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>router_solicitation</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Router solicitation</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>time_exceeded</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Time exceeded</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>unreachable</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>All unreachables</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>igmp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Internet Gateway Message Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>igrp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Internet Gateway Routing Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ip</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Any Internet Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ipinip</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>IP in IP tunneling.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ipsec</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>IP Security.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>nos</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>KA9Q NOS compatible IP over IP tunneling.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ospf</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>OSPF routing protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>pcp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Payload Compression Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>pim</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Protocol Independent Multicast.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>pptp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Point-to-Point Tunneling Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol_number</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>An IP protocol number</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>sctp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Stream Control Transmission Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>snp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Simple Network Protocol.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>tcp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match TCP packet flags</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>udp</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>User Datagram Protocol.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>remark</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify a comment (remark) for the access-list after this keyword</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>source</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the packet source.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>address</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Source network address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>any</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match any source address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>any4</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match any ipv4 source address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>any6</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Match any ipv6 source address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>A single source host</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>interface</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Use interface address as source address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>netmask</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Netmask for source IP address, valid with IPV4 address.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>object_group</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Network object-group for source address</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port_protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the destination port along with protocol.</div> + <div>Note, Valid with TCP/UDP protocol_options</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>eq</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets on a given port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>gt</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets with a greater port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>lt</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets with a lower port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>neq</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Match only packets not on a given port number.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>range</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Port range operator</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>end</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the end of the port range.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>start</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify the start of the port range.</div> + </td> + </tr> + + + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>time_range</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specify a time-range.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>acl_type</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>extended</li> + <li>standard</li> + </ul> + </td> + <td> + <div>ACL type</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>The name or the number of the ACL.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>rename</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Rename an existing access-list.</div> + <div>If input to rename param is given, it'll take preference over other parameters and only rename config will be matched and computed against.</div> + </td> + </tr> + + + <tr> + <td colspan="7"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>running_config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The <em>running_config</em> argument allows the implementer to pass in the configuration to use as the base config for comparison.</div> + </td> + </tr> + <tr> + <td colspan="7"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>merged</b> ←</div></li> + <li>replaced</li> + <li>overridden</li> + <li>deleted</li> + <li>gathered</li> + <li>rendered</li> + <li>parsed</li> + </ul> + </td> + <td> + <div>The state of the configuration after module completion</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - Tested against Cisco ASA Version 9.10(1)11 + - This module works with connection ``network_cli``. See `ASA Platform Options <../network/user_guide/platform_asa.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + # Before state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 2 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list R1_traffic; 1 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + + - name: Merge provided configuration with device configuration + cisco.asa.asa_acls: + config: + acls: + - name: temp_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + time_range: temp + - grant: deny + line: 3 + protocol_options: + tcp: true + source: + interface: management + destination: + interface: management + port_protocol: + eq: www + log: warnings + - grant: deny + line: 4 + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + - name: global_access + acl_type: extended + aces: + - line: 3 + remark: test global access + - grant: deny + line: 4 + protocol_options: + tcp: true + source: + any: true + destination: + any: true + port_protocol: + eq: www + log: errors + - name: R1_traffic + aces: + - line: 1 + remark: test_v6_acls + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: merged + + # Commands fired: + # --------------- + # access-list global_access line 3 remark test global access + # access-list global_access line 4 extended deny tcp any any eq www log errors interval 300 + # access-list R1_traffic line 1 remark test_v6_acls + # access-list R1_traffic line 2 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + # access-list temp_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + # access-list temp_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp inactive + # access-list temp_access line 2 extended deny tcp interface management interface management + # eq www log warnings + # access-list test_access line 3 extended deny tcp object-group test_og_network object-group test_network_og + # eq www log default + + # After state: + # ------------ + # + # vasa#sh access-lists + # access-list global_access; 3 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list global_access line 3 remark test global access (hitcnt=0) 0xae78337e + # access-list global_access line 4 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 remark test_v6_acls + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + # access-list test_access line 3 + # extended deny tcp interface management interface management eq www log warnings + # interval 300 (hitcnt=0) 0x78aa233d + # access-list test_access line 2 extended deny tcp object-group test_og_network object-group test_network_og + # eq www log default (hitcnt=0) 0x477aec1e + # access-list test_access line 2 extended deny tcp 192.0.2.0 255.255.255.0 host 192.0.3.1 eq www + # log default (hitcnt=0) 0xdc7edff8 + # access-list test_access line 2 extended deny tcp 192.0.2.0 255.255.255.0 host 192.0.3.2 eq www + # log default (hitcnt=0) 0x7b0e9fde + # access-list test_access line 2 extended deny tcp 198.51.100.0 255.255.255.0 2001:db8:3::/64 eq www + # log default (hitcnt=0) 0x97c75adc + + # Using Merged to Rename ACLs + # Before state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 2 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list R1_traffic; 1 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + + - name: Rename ACL with different name using Merged state + cisco.asa.asa_acls: + config: + acls: + - name: global_access + rename: global_access_renamed + - name: R1_traffic + rename: R1_traffic_renamed + state: merged + + # Commands fired: + # --------------- + # access-list global_access rename global_access_renamed + # access-list R1_traffic rename R1_traffic_renamed + + # After state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access_renamed; 2 elements; name hash: 0xbd6c87a7 + # access-list global_access_renamed line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access_renamed line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list R1_traffic_renamed; 1 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic_renamed line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + + + # Using replaced + + # Before state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 3 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + - name: Replaces device configuration of listed acl with provided configuration + cisco.asa.asa_acls: + config: + acls: + - name: global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + state: replaced + + # Commands fired: + # --------------- + # no access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 + # no access-list global_access line 2 extended deny tcp any any eq telnet + # no access-list global_access line 1 extended permit icmp any any log disable + # access-list global_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www + + # After state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 1 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet + # 192.0.5.0 255.255.255.0 eq www (hitcnt=0) 0x3e5b2757 + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + # Using overridden + + # Before state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 3 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + + - name: Override device configuration of all acl with provided configuration + cisco.asa.asa_acls: + config: + acls: + - name: global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + state: overridden + + # Commands fired: + # --------------- + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 time-range temp + # no access-list temp_access line 1 + # extended grant deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + # no access-list R1_traffic line 2 + # extended grant deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + # no access-list R1_traffic line 1 + # extended grant deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www log errors + # no access-list global_access line 3 extended grant deny tcp any any eq www log errors + # no access-list global_access line 2 extended grant deny tcp any any eq telnet + # no access-list global_access line 1 extended grant permit icmp any any log disable + # access-list global_access line 4 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www + + # After state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 1 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + + # Using Deleted + + # Before state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 3 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + - name: "Delete module attributes of given acl (Note: This won't delete ALL of the ACLs configured)" + cisco.asa.asa_acls: + config: + acls: + - name: temp_access + - name: global_access + state: deleted + + # Commands fired: + # --------------- + # no access-list temp_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp inactive + # no access-list temp_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default + # no access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 + # no access-list global_access line 2 extended deny tcp any any eq telnet + # no access-list global_access line 1 extended permit icmp any any log disable + + # After state: + # ------------- + # + # vasa#sh access-lists + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + + # Using Deleted without any config passed + #"(NOTE: This will delete all of configured resource module attributes)" + + # Before state: + # ------------- + # + # vasa#sh access-lists + # access-list global_access; 3 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + - name: 'Delete ALL ACLs in one go (Note: This WILL delete the ALL of configured ACLs)' + cisco.asa.asa_acls: + state: deleted + + # Commands fired: + # --------------- + # no access-list global_access line 1 extended permit icmp any any log disable + # no access-list global_access line 2 extended deny tcp any any eq telnet + # no access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 + # no access-list R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 + # no access-list R1_traffic line 2 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + # no access-list temp_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + # no access-list temp_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp inactive + + + # After state: + # ------------- + # + # vasa#sh access-lists + + # Using Gathered + + # Before state: + # ------------- + # + # access-list global_access; 3 elements; name hash: 0xbd6c87a7 + # access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + # access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af + # access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 + # access-list R1_traffic line 1 + # extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www + # log errors interval 300 (hitcnt=0) 0x4a4660f3 + # access-list R1_traffic line 2 + # extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet + # inactive (hitcnt=0) (inactive) 0xe922b432 + # access-list temp_access; 2 elements; name hash: 0xaf1b712e + # access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www + # log default (hitcnt=0) 0xb58abb0d + # access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + + - name: Gather listed ACLs with provided configurations + cisco.asa.asa_acls: + config: + state: gathered + + # Module Execution Result: + # ------------------------ + # + # "gathered": [ + # { + # "acls": [ + # { + # "aces": [ + # { + # "destination": { + # "any": true + # }, + # "grant": "permit", + # "line": 1, + # "log": "disable", + # "protocol": "icmp", + # "source": { + # "any": true + # } + # }, + # { + # "destination": { + # "any": true, + # "port_protocol": { + # "eq": "telnet" + # } + # }, + # "grant": "deny", + # "line": 2, + # "protocol": "tcp", + # "protocol_options": { + # "tcp": true + # }, + # "source": { + # "any": true + # } + # } + # ], + # "acl_type": "extended", + # "name": "global_access" + # }, + # { + # "aces": [ + # { + # "destination": { + # "address": "2001:fc8:0:4::/64", + # "port_protocol": { + # "eq": "www" + # } + # }, + # "grant": "deny", + # "line": 1, + # "log": "errors", + # "protocol": "tcp", + # "protocol_options": { + # "tcp": true + # }, + # "source": { + # "address": "2001:db8:0:3::/64", + # "port_protocol": { + # "eq": "telnet" + # } + # } + # }, + # { + # "destination": { + # "address": "2001:fc8:0:4::/64", + # "port_protocol": { + # "eq": "telnet" + # } + # }, + # "grant": "deny", + # "inactive": true, + # "line": 2, + # "protocol": "tcp", + # "protocol_options": { + # "tcp": true + # }, + # "source": { + # "address": "2001:db8:0:3::/64", + # "port_protocol": { + # "eq": "www" + # } + # } + # } + # ], + # "acl_type": "extended", + # "name": "R1_traffic" + # }, + # { + # "aces": [ + # { + # "destination": { + # "address": "192.0.3.0", + # "netmask": "255.255.255.0", + # "port_protocol": { + # "eq": "www" + # } + # }, + # "grant": "deny", + # "line": 1, + # "log": "default", + # "protocol": "tcp", + # "protocol_options": { + # "tcp": true + # }, + # "source": { + # "address": "192.0.2.0", + # "netmask": "255.255.255.0" + # } + # }, + # { + # "destination": { + # "address": "198.51.110.0", + # "netmask": "255.255.255.0" + # }, + # "grant": "deny", + # "inactive": true, + # "line": 2, + # "protocol": "igrp", + # "protocol_options": { + # "igrp": true + # }, + # "source": { + # "address": "198.51.100.0", + # "netmask": "255.255.255.0" + # }, + # "time_range": "temp" + # } + # ], + # "acl_type": "extended", + # "name": "temp_access" + # } + # ] + # } + # ] + + # Using Rendered + + - name: Rendered the provided configuration with the exisiting running configuration + cisco.asa.asa_acls: + config: + acls: + - name: temp_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + time_range: temp + - name: R1_traffic + aces: + - grant: deny + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: rendered + + # Module Execution Result: + # ------------------------ + # + # "rendered": [ + # "access-list temp_access line 1 + # extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 + # eq www log default" + # "access-list temp_access line 2 + # extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 + # time-range temp" + # "access-list R1_traffic + # deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive" + # ] + + # Using Parsed + + # parsed.cfg + # + # access-list test_access; 2 elements; name hash: 0xaf1b712e + # access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + # access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors + # access-list test_R1_traffic; 1 elements; name hash: 0xaf40d3c2 + # access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + + - name: Parse the commands for provided configuration + cisco.asa.asa_acls: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + + # Module Execution Result: + # ------------------------ + # + # "parsed": [ + # { + # "acls": [ + # { + # "aces": [ + # { + # "destination": { + # "address": "192.0.3.0", + # "netmask": "255.255.255.0", + # "port_protocol": { + # "eq": "www" + # } + # }, + # "grant": "deny", + # "line": 1, + # "log": "default", + # "protocol": "tcp", + # "protocol_options": { + # "tcp": true + # }, + # "source": { + # "address": "192.0.2.0", + # "netmask": "255.255.255.0" + # } + # }, + # { + # "destination": { + # "address": "198.51.110.0", + # "netmask": "255.255.255.0" + # }, + # "grant": "deny", + # "line": 2, + # "log": "errors", + # "protocol": "igrp", + # "protocol_options": { + # "igrp": true + # }, + # "source": { + # "address": "198.51.100.0", + # "netmask": "255.255.255.0" + # } + # } + # ], + # "acl_type": "extended", + # "name": "test_access" + # }, + # { + # "aces": [ + # { + # "destination": { + # "address": "2001:fc8:0:4::/64", + # "port_protocol": { + # "eq": "telnet" + # } + # }, + # "grant": "deny", + # "inactive": true, + # "line": 1, + # "protocol": "tcp", + # "protocol_options": { + # "tcp": true + # }, + # "source": { + # "address": "2001:db8:0:3::/64", + # "port_protocol": { + # "eq": "www" + # } + # } + # } + # ], + # "acl_type": "extended", + # "name": "test_R1_TRAFFIC" + # } + # ] + # } + # ] + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when changed</td> + <td> + <div>The configuration as structured data after module completion.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The configuration as structured data prior to module invocation.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The set of commands pushed to the remote device</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['access-list global_access line 1 extended permit icmp any any log disable']</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- Sumit Jaiswal (@justjais) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_cliconf.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_cliconf.rst new file mode 100644 index 00000000..d484aca1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_cliconf.rst @@ -0,0 +1,43 @@ +.. _cisco.asa.asa_cliconf: + + +************* +cisco.asa.asa +************* + +**Use asa cliconf to run command on Cisco ASA platform** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This asa plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco ASA network devices. + + + + + + + + + + + +Status +------ + + +Authors +~~~~~~~ + +- Ansible Security Team + + +.. hint:: + Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_command_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_command_module.rst new file mode 100644 index 00000000..fd150c14 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_command_module.rst @@ -0,0 +1,443 @@ +.. _cisco.asa.asa_command_module: + + +********************* +cisco.asa.asa_command +********************* + +**Run arbitrary commands on Cisco ASA devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Sends arbitrary commands to an ASA node and returns the results read from the device. The ``asa_command`` module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code> and <code>become: yes</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>List of commands to send to the remote device over the configured provider. The resulting output from the command is returned. If the <em>wait_for</em> argument is provided, the module is not returned until the condition is satisfied or the number of retires as expired.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>context</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>interval</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">1</div> + </td> + <td> + <div>Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>match</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>any</li> + <li><div style="color: blue"><b>all</b> ←</div></li> + </ul> + </td> + <td> + <div>The <em>match</em> argument is used in conjunction with the <em>wait_for</em> argument to specify the match policy. Valid values are <code>all</code> or <code>any</code>. If the value is set to <code>all</code> then all conditionals in the wait_for must be satisfied. If the value is set to <code>any</code> then only one of the values must be satisfied.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>passwords</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>provider</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>A dict object containing connection details.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>auth_pass</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use if required to enter privileged mode on the remote device. If <em>authorize</em> is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTH_PASS</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>password</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_PASSWORD</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the port to use when building the connection to the remote device.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ssh_keyfile</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">path</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_SSH_KEYFILE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timeout</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies idle timeout in seconds for the connection, in seconds. Useful if the console freezes before continuing. For example when saving configurations.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>username</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_USERNAME</code> will be used instead.</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>retries</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">10</div> + </td> + <td> + <div>Specifies the number of retries a command should by tried before it is considered failed. The command is run on the target device every retry and evaluated against the <em>wait_for</em> conditions.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>wait_for</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of retries, the task fails. See examples.</div> + <div style="font-size: small; color: darkgreen"><br/>aliases: waitfor</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - When processing wait_for, each commands' output is stored as an element of the *result* array. The allowed operators for conditional evaluation are *eq*, *==*, *neq*, *ne*, *!=*, *gt*, *>*, *ge*, *>=*, *lt*, *<*, *le*, *<=*, *contains*, *matches*. Operators can be prefaced by *not* to negate their meaning. The *contains* operator searches for a substring match (like the Python *in* operator). The *matches* operator searches using a regex search operation. + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` + + + +Examples +-------- + +.. code-block:: yaml + + - name: Show the ASA version + cisco.asa.asa_command: + commands: + - show version + + - name: Show ASA drops and memory + cisco.asa.asa_command: + commands: + - show asp drop + - show memory + + - name: Send repeat pings and wait for the result to pass 100% + cisco.asa.asa_command: + commands: + - ping 8.8.8.8 repeat 20 size 350 + wait_for: + - result[0] contains 100 + retries: 2 + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>failed_conditions</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>failed</td> + <td> + <div>the conditionals that failed</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['...', '...']</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>stdout</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>the set of responses from the commands</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['...', '...']</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>stdout_lines</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The value of stdout split into a list</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[['...', '...'], ['...'], ['...']]</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip), Patrick Ogenstad (@ogenstad) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_config_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_config_module.rst new file mode 100644 index 00000000..8f918f25 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_config_module.rst @@ -0,0 +1,641 @@ +.. _cisco.asa.asa_config_module: + + +******************** +cisco.asa.asa_config +******************** + +**Manage configuration sections on Cisco ASA devices** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Cisco ASA configurations use a simple block indent file syntax for segmenting configuration into sections. This module provides an implementation for working with ASA configuration sections in a deterministic way. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of commands to append to the end of the command stack if a change needs to be made. Just like with <em>before</em> this allows the playbook designer to append a set of commands to be executed after the command set.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code> and <code>become: yes</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>backup</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>This argument will cause the module to create a full backup of the current <code>running-config</code> from the remote device before any changes are made. If the <code>backup_options</code> value is not given, the backup file is written to the <code>backup</code> folder in the playbook root directory. If the directory does not exist, it is created.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>backup_options</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>This is a dict object containing configurable options related to backup file path. The value of this option is read only when <code>backup</code> is set to <em>yes</em>, if <code>backup</code> is set to <em>no</em> this option will be silently ignored.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>dir_path</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">path</span> + </div> + </td> + <td> + </td> + <td> + <div>This option provides the path ending with directory name in which the backup configuration file will be stored. If the directory does not exist it will be first created and the filename is either the value of <code>filename</code> or default filename as described in <code>filename</code> options description. If the path value is not given in that case a <em>backup</em> directory will be created in the current working directory and backup configuration will be copied in <code>filename</code> within <em>backup</em> directory.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>filename</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The filename to be used to store the backup configuration. If the filename is not given it will be generated based on the hostname, current time and date in format defined by <hostname>_config.<current-date>@<current-time></div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of commands to push on to the command stack if a change needs to be made. This allows the playbook designer the opportunity to perform configuration commands prior to pushing any changes without affecting how the set of commands are matched against the system.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The <code>config</code> argument allows the playbook designer to supply the base configuration to be used to validate configuration changes necessary. If this argument is provided, the module will not download the running-config from the remote node.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>context</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>defaults</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>This argument specifies whether or not to collect all defaults when getting the remote device running config. When enabled, the module will get the current config by issuing the command <code>show running-config all</code>.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>lines</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of commands that should be configured in the section. The commands must be the exact same commands as found in the device running-config. Be sure to note the configuration command syntax as some commands are automatically modified by the device config parser.</div> + <div style="font-size: small; color: darkgreen"><br/>aliases: commands</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>match</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>line</b> ←</div></li> + <li>strict</li> + <li>exact</li> + <li>none</li> + </ul> + </td> + <td> + <div>Instructs the module on the way to perform the matching of the set of commands against the current device config. If match is set to <em>line</em>, commands are matched line by line. If match is set to <em>strict</em>, command lines are matched with respect to position. If match is set to <em>exact</em>, command lines must be an equal match. Finally, if match is set to <em>none</em>, the module will not attempt to compare the source configuration with the running configuration on the remote device.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>parents</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The ordered set of parents that uniquely identify the section or hierarchy the commands should be checked against. If the parents argument is omitted, the commands are checked against the set of top level or global commands.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>passwords</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>This argument specifies to include passwords in the config when retrieving the running-config from the remote device. This includes passwords related to VPN endpoints. This argument is mutually exclusive with <em>defaults</em>.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>provider</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>A dict object containing connection details.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>auth_pass</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use if required to enter privileged mode on the remote device. If <em>authorize</em> is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTH_PASS</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>password</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_PASSWORD</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the port to use when building the connection to the remote device.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ssh_keyfile</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">path</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_SSH_KEYFILE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timeout</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies idle timeout in seconds for the connection, in seconds. Useful if the console freezes before continuing. For example when saving configurations.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>username</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_USERNAME</code> will be used instead.</div> + </td> + </tr> + + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>replace</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>line</b> ←</div></li> + <li>block</li> + </ul> + </td> + <td> + <div>Instructs the module on the way to perform the configuration on the device. If the replace argument is set to <em>line</em> then the modified lines are pushed to the device in configuration mode. If the replace argument is set to <em>block</em> then the entire command block is pushed to the device in configuration mode if any line is not correct</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>save</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>The <code>save</code> argument instructs the module to save the running- config to the startup-config at the conclusion of the module running. If check mode is specified, this argument is ignored.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>src</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">path</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the source path to the file that contains the configuration or configuration template to load. The path to the source file can either be the full path on the Ansible control host or a relative path from the playbook or role root directory. This argument is mutually exclusive with <em>lines</em>, <em>parents</em>.</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` + + + +Examples +-------- + +.. code-block:: yaml + + - cisco.asa.asa_config: + lines: + - network-object host 10.80.30.18 + - network-object host 10.80.30.19 + - network-object host 10.80.30.20 + parents: [object-group network OG-MONITORED-SERVERS] + provider: '{{ cli }}' + + - cisco.asa.asa_config: + host: '{{ inventory_hostname }}' + lines: + - message-length maximum client auto + - message-length maximum 512 + match: line + parents: [policy-map type inspect dns PM-DNS, parameters] + authorize: yes + auth_pass: cisco + username: admin + password: cisco + context: ansible + + - cisco.asa.asa_config: + lines: + - ikev1 pre-shared-key MyS3cretVPNK3y + parents: tunnel-group 1.1.1.1 ipsec-attributes + passwords: yes + provider: '{{ cli }}' + + - name: attach ASA acl on interface vlan13/nameif cloud13 + cisco.asa.asa_config: + lines: + - access-group cloud-acl_access_in in interface cloud13 + provider: '{{ cli }}' + + - name: configure ASA (>=9.2) default BGP + cisco.asa.asa_config: + lines: + - bgp log-neighbor-changes + - bgp bestpath compare-routerid + provider: '{{ cli }}' + parents: + - router bgp 65002 + register: bgp + when: bgp_default_config is defined + - name: configure ASA (>=9.2) BGP neighbor in default/single context mode + cisco.asa.asa_config: + lines: + - bgp router-id {{ bgp_router_id }} + - neighbor {{ bgp_neighbor_ip }} remote-as {{ bgp_neighbor_as }} + - neighbor {{ bgp_neighbor_ip }} description {{ bgp_neighbor_name }} + provider: '{{ cli }}' + parents: + - router bgp 65002 + - address-family ipv4 unicast + register: bgp + when: bgp_neighbor_as is defined + - name: configure ASA interface with standby + cisco.asa.asa_config: + lines: + - description my cloud interface + - nameif cloud13 + - security-level 50 + - ip address 192.168.13.1 255.255.255.0 standby 192.168.13.2 + provider: '{{ cli }}' + parents: [interface Vlan13] + register: interface + - name: Show changes to interface from task above + debug: + var: interface + + - name: configurable backup path + cisco.asa.asa_config: + lines: + - access-group cloud-acl_access_in in interface cloud13 + provider: '{{ cli }}' + backup: yes + backup_options: + filename: backup.cfg + dir_path: /home/user + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>backup_path</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>when backup is yes</td> + <td> + <div>The full path to the backup file</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">/playbooks/ansible/backup/asa_config.2016-07-16@22:28:34</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>updates</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The set of commands that will be pushed to the remote device</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['...', '...']</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- Peter Sprygada (@privateip), Patrick Ogenstad (@ogenstad) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_facts_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_facts_module.rst new file mode 100644 index 00000000..8cdbc344 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_facts_module.rst @@ -0,0 +1,628 @@ +.. _cisco.asa.asa_facts_module: + + +******************* +cisco.asa.asa_facts +******************* + +**Collect facts from remote devices running Cisco ASA** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- Collects a base set of device facts from a remote device that is running ASA. This module prepends all of the base network fact keys with ``ansible_net_<fact>``. The facts module will always collect a base set of facts from the device and can enable or disable collection of additional facts. +- Note, to collects facts from ASA device properly user should elevate the privilege to become. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="2">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code> and <code>become: yes</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>context</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>gather_network_resources</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>When supplied, this argument will restrict the facts collected to a given subset. Possible values for this argument include all and the resources like interfaces, vlans etc. Can specify a list of values to include a larger subset. Values can also be used with an initial <code><span class='module'>!</span></code> to specify that a specific subset should not be collected. Valid subsets are 'all', 'acls', 'ogs'.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>gather_subset</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + <b>Default:</b><br/><div style="color: blue">"!config"</div> + </td> + <td> + <div>When supplied, this argument restricts the facts collected to a given subset.</div> + <div>Possible values for this argument include <code>all</code>, <code>min</code>, <code>hardware</code>, <code>config</code>.</div> + <div>Specify a list of values to include a larger subset.</div> + <div>Use a value with an initial <code>!</code> to collect all facts except that subset.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>passwords</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>no</li> + <li>yes</li> + </ul> + </td> + <td> + <div>Specifies which context to target if you are running in the ASA in multiple context mode. Defaults to the current context you login to.</div> + </td> + </tr> + <tr> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>provider</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div><b>Deprecated</b></div> + <div>Starting with Ansible 2.5 we recommend using <code>connection: network_cli</code>.</div> + <div>For more information please see the <a href='../network/getting_started/network_differences.html#multiple-communication-protocols'>Network Guide</a>.</div> + <div><hr/></div> + <div>A dict object containing connection details.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>auth_pass</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use if required to enter privileged mode on the remote device. If <em>authorize</em> is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTH_PASS</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>authorize</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">boolean</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>no</b> ←</div></li> + <li>yes</li> + </ul> + </td> + <td> + <div>Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_AUTHORIZE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>password</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the password to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_PASSWORD</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the port to use when building the connection to the remote device.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ssh_keyfile</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">path</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies the SSH key to use to authenticate the connection to the remote device. This value is the path to the key used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_SSH_KEYFILE</code> will be used instead.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>timeout</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies idle timeout in seconds for the connection, in seconds. Useful if the console freezes before continuing. For example when saving configurations.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>username</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate the SSH session. If the value is not specified in the task, the value of environment variable <code>ANSIBLE_NET_USERNAME</code> will be used instead.</div> + </td> + </tr> + + </table> + <br/> + + +Notes +----- + +.. note:: + - Tested against asa 9.10(1)11 + - For more information on using Ansible to manage network devices see the :ref:`Ansible Network Guide <network_guide>` + + + +Examples +-------- + +.. code-block:: yaml + + - name: Gather all legacy facts + cisco.asa.asa_facts: + gather_subset: all + + - name: Gather only the config and default facts + cisco.asa.asa_facts: + gather_subset: + - config + + - name: Do not gather hardware facts + cisco.asa.asa_facts: + gather_subset: + - '!hardware' + + - name: Gather legacy and resource facts + cisco.asa.asa_facts: + gather_subset: all + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_api</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The name of the transport</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_asatype</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The operating system type (Cisco ASA) running on the remote device.</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_config</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>when config is configured</td> + <td> + <div>The current active config from the device</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_device_mgr_version</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The Device manager version running on the remote device.</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_filesystems</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when hardware is configured</td> + <td> + <div>All file system names available on the device</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_filesystems_info</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td>when hardware is configured</td> + <td> + <div>A hash of all file systems containing info about each file system (e.g. free and total space)</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_firepower_version</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The Firepower operating system version running on the remote device.</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_gather_subset</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The list of fact subsets collected from the device</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_hostname</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The configured hostname of the device</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_image</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The image file the device is running</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_memfree_mb</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td>when hardware is configured</td> + <td> + <div>The available free memory on the remote device in Mb</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_memtotal_mb</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td>when hardware is configured</td> + <td> + <div>The total memory on the remote device in Mb</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_memused_mb</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">integer</span> + </div> + </td> + <td>when hardware is configured</td> + <td> + <div>The used memory on the remote device in Mb</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_model</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The model name returned from the device</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_python_version</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The Python version Ansible controller is using</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_serialnum</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The serial number of the remote device</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_stacked_models</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when multiple devices are configured in a stack</td> + <td> + <div>The model names of each device in the stack</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_stacked_serialnums</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when multiple devices are configured in a stack</td> + <td> + <div>The serial numbers of each device in the stack</div> + <br/> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>ansible_net_version</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td>always</td> + <td> + <div>The operating system version running on the remote device</div> + <br/> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- Sumit Jaiswal (@justjais) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_og_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_og_module.rst new file mode 100644 index 00000000..cde1707d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_og_module.rst @@ -0,0 +1,328 @@ +.. _cisco.asa.asa_og_module: + + +**************** +cisco.asa.asa_og +**************** + +**(deprecated, removed after 2022-06-01) Manage object groups on a Cisco ASA** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + +DEPRECATED +---------- +:Removed in collection release after 2022-06-01 +:Why: Newer and updated modules released with more functionality in Ansible 2.10 +:Alternative: asa_ogs + + + +Synopsis +-------- +- This module allows you to create and update object-group network/service on Cisco ASA device. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description for the object-group.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>group_object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The group-object for network object-group.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>group_type</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>network-object</li> + <li>service-object</li> + <li>port-object</li> + </ul> + </td> + <td> + <div>The object group type.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host_ip</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The host IP address for object-group network.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ip_mask</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The IP address and mask for network object-group.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Name of the object group.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port_eq</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The single port for port-object.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>port_range</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The port range for port-object.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>udp</li> + <li>tcp</li> + <li>tcp-udp</li> + </ul> + </td> + <td> + <div>The protocol for object-group service with port-object.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>service_cfg</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>The service-object configuration protocol, direction, range or port.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>present</b> ←</div></li> + <li>absent</li> + <li>replace</li> + </ul> + </td> + <td> + <div>Manage the state of the resource.</div> + </td> + </tr> + </table> + <br/> + + + + +Examples +-------- + +.. code-block:: yaml + + - name: configure network object-group + cisco.asa.asa_og: + name: ansible_test_0 + group_type: network-object + state: present + description: ansible_test object-group description + host_ip: + - 8.8.8.8 + - 8.8.4.4 + ip_mask: + - 10.0.0.0 255.255.255.0 + - 192.168.0.0 255.255.0.0 + group_object: + - awx_lon + - awx_ams + + - name: configure port-object object-group + cisco.asa.asa_og: + name: ansible_test_1 + group_type: port-object + state: replace + description: ansible_test object-group description + protocol: tcp-udp + port_eq: + - 1025 + - kerberos + port_range: + - 1025 5201 + - 0 1024 + + - name: configure service-object object-group + cisco.asa.asa_og: + name: ansible_test_2 + group_type: service-object + state: absent + description: ansible_test object-group description + service_cfg: + - tcp destination eq 8080 + - tcp destination eq www + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>command sent to the device</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['object-group network ansible_test_0', 'description ansible_test object-group description', 'network-object host 8.8.8.8', 'network-object host 8.8.4.4', 'network-object 10.0.0.0 255.255.255.0', 'network-object 192.168.0.0 255.255.0.0', 'network-object 192.168.0.0 255.255.0.0', 'group-object awx_lon', 'group-object awx_ams']</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +- This module will be removed in version . *[deprecated]* +- For more information see `DEPRECATED`_. + + +Authors +~~~~~~~ + +- Federico Olivieri (@Federico87) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_ogs_module.rst b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_ogs_module.rst new file mode 100644 index 00000000..413640ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/docs/cisco.asa.asa_ogs_module.rst @@ -0,0 +1,1369 @@ +.. _cisco.asa.asa_ogs_module: + + +***************** +cisco.asa.asa_ogs +***************** + +**Object Group resource module** + + +Version added: 1.0.0 + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- +- This module configures and manages Objects and Groups on ASA platforms. + + + + +Parameters +---------- + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="5">Parameter</th> + <th>Choices/<font color="blue">Defaults</font></th> + <th width="100%">Comments</th> + </tr> + <tr> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>A list of Object Group options.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>object_groups</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>The object groups.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>description</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The description for the object-group.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>icmp_type</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure an ICMP-type object</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>icmp_object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>alternate-address</li> + <li>conversion-error</li> + <li>echo</li> + <li>echo-reply</li> + <li>information-reply</li> + <li>information-request</li> + <li>mask-reply</li> + <li>mask-request</li> + <li>mobile-redirect</li> + <li>parameter-problem</li> + <li>redirect</li> + <li>router-advertisement</li> + <li>router-solicitation</li> + <li>source-quench</li> + <li>time-exceeded</li> + <li>timestamp-reply</li> + <li>timestamp-request</li> + <li>traceroute</li> + <li>unreachable</li> + </ul> + </td> + <td> + <div>Defines the ICMP types in the group.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Specifies object-group ID</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>network_object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure a network object</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>address</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter an IPv4 network address with space seperated netmask.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>host</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>Set this to specify a single host object.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>ipv6_address</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter an IPv6 prefix.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol_object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure a protocol object</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>ah</li> + <li>eigrp</li> + <li>esp</li> + <li>gre</li> + <li>icmp</li> + <li>icmp6</li> + <li>igmp</li> + <li>igrp</li> + <li>ip</li> + <li>ipinip</li> + <li>ipsec</li> + <li>nos</li> + <li>ospf</li> + <li>pcp</li> + <li>pim</li> + <li>pptp</li> + <li>sctp</li> + <li>snp</li> + <li>tcp</li> + <li>udp</li> + </ul> + </td> + <td> + <div>Defines the protocols in the group.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>security_group</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure a security-group</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>sec_name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter this keyword to specify a security-group name.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>tag</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter this keyword to specify a security-group tag.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>service_object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure a service object</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter this keyword to specify a service object</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>protocol</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>ah</li> + <li>eigrp</li> + <li>esp</li> + <li>gre</li> + <li>icmp</li> + <li>icmp6</li> + <li>igmp</li> + <li>igrp</li> + <li>ip</li> + <li>ipinip</li> + <li>ipsec</li> + <li>nos</li> + <li>ospf</li> + <li>pcp</li> + <li>pim</li> + <li>pptp</li> + <li>sctp</li> + <li>snp</li> + <li>tcp</li> + <li>tcp-udp</li> + <li>udp</li> + </ul> + </td> + <td> + <div>Defines the protocols in the group.</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="3"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>user_object</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configures single user, local or import user group</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>user</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure a user objectUser name to configure a user object.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>domain</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>User domain</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter the name of the user</div> + </td> + </tr> + + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="2"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>user_group</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + / <span style="color: purple">elements=dictionary</span> + </div> + </td> + <td> + </td> + <td> + <div>Configure a user group object.</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>domain</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Group domain</div> + </td> + </tr> + <tr> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td class="elbow-placeholder"></td> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>name</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + </td> + <td> + <div>Enter the name of the group</div> + </td> + </tr> + + + + <tr> + <td class="elbow-placeholder"></td> + <td colspan="4"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>object_type</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + / <span style="color: red">required</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li>icmp-type</li> + <li>network</li> + <li>protocol</li> + <li>security</li> + <li>service</li> + <li>user</li> + </ul> + </td> + <td> + <div>The object group type.</div> + </td> + </tr> + + <tr> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>running_config</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + </td> + <td> + <div>The module, by default, will connect to the remote device and retrieve the current running-config to use as a base for comparing against the contents of source. There are times when it is not desirable to have the task get the current running-config for every task in a playbook. The <em>running_config</em> argument allows the implementer to pass in the configuration to use as the base config for comparison. This value of this option should be the output received from device by executing command.</div> + </td> + </tr> + <tr> + <td colspan="5"> + <div class="ansibleOptionAnchor" id="parameter-"></div> + <b>state</b> + <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a> + <div style="font-size: small"> + <span style="color: purple">string</span> + </div> + </td> + <td> + <ul style="margin: 0; padding: 0"><b>Choices:</b> + <li><div style="color: blue"><b>merged</b> ←</div></li> + <li>replaced</li> + <li>overridden</li> + <li>deleted</li> + <li>gathered</li> + <li>rendered</li> + <li>parsed</li> + </ul> + </td> + <td> + <div>The state the configuration should be left in</div> + </td> + </tr> + </table> + <br/> + + +Notes +----- + +.. note:: + - Tested against Cisco ASA Version 9.10(1)11 + - This module works with connection ``network_cli``. See `ASA Platform Options <../network/user_guide/platform_asa.html>`_. + + + +Examples +-------- + +.. code-block:: yaml + + # Using merged + + # Before state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_network_og + # network-object host 192.0.3.1 + + - name: "Merge module attributes of given object-group" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: merged + + # Commands fired: + # --------------- + # + # object-group security test_og_security + # description test_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group network test_og_network + # description test_og_network + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # object-group network test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:3::/64 + # object-group user test_og_user + # description test_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + # After state: + # ------------ + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # network-object host 192.0.3.1 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # description test_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + # Using Replaced + + # Before state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + - name: "Replace module attributes of given object-group" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_replace + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: replaced + + # Commands Fired: + # --------------- + # + # object-group protocol test_og_protocol + # description test_og_protocol + # protocol tcp + # protocol udp + # object-group network test_og_network + # description test_og_network_replace + # no network-object 192.0.2.0 255.255.255.0 + # no network-object 198.51.100.0 255.255.255.0 + # network-object 192.0.3.0 255.255.255.0 + # no network-object host 192.0.2.1 + # no network-object host 192.0.2.2 + # network-object host 192.0.3.1 + + # After state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network_replace + # network-object host 192.0.3.1 + # network-object 192.0.3.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + # object-group protocol test_og_protocol + # protocol-object tcp + # protocol-object udp + + # Using Overridden + + # Before state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + - name: "Overridden module attributes of given object-group" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_override + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: overridden + + # Commands Fired: + # --------------- + # + # no object-group security test_og_security + # no object-group user test_og_user + # object-group protocol test_og_protocol + # description test_og_protocol + # protocol tcp + # protocol udp + # object-group network test_og_network + # description test_og_network_override + # no network-object 192.0.2.0 255.255.255.0 + # no network-object 198.51.100.0 255.255.255.0 + # network-object 192.0.3.0 255.255.255.0 + # no network-object host 192.0.2.1 + # no network-object host 192.0.2.2 + # network-object host 192.0.3.1 + # no object-group network test_network_og + + # After state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network_override + # network-object host 192.0.3.1 + # network-object 192.0.3.0 255.255.255.0 + # object-group protocol test_og_protocol + # protocol-object tcp + # protocol-object udp + + # Using Deleted + + # Before state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + - name: "Delete given module attributes" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + - name: test_network_og + - object_type: security + object_groups: + - name: test_og_security + state: deleted + + # Commands Fired: + # --------------- + # + # no object-group network test_og_network + # no object-group network test_network_og + # no object-group security test_og_security + + # After state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + # Using DELETED without any config passed + #"(NOTE: This will delete all of configured resource module attributes)" + + # Before state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + - name: Delete ALL configured module attributes + cisco.asa.asa_ogs: + config: + state: deleted + + # Commands Fired: + # --------------- + # + # no object-group network test_og_network + # no object-group network test_network_og + # no object-group security test_og_security + # no object-group user test_og_user + + # After state: + # ------------- + # + # ciscoasa# sh running-config object-group + + # Using Gathered + + # Before state: + # ------------- + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + - name: Gather listed OGs with provided configurations + cisco.asa.asa_ogs: + config: + state: gathered + + # Module Execution Result: + # ------------------------ + # + # "gathered": [ + # { + # "object_groups": [ + # { + # "description": "test_security", + # "name": "test_og_security", + # "security_group": { + # "sec_name": [ + # "test_2", + # "test_1" + # ], + # "tag": [ + # 10, + # 20 + # ] + # } + # } + # ], + # "object_type": "security" + # }, + # { + # "object_groups": [ + # { + # "description": "test_network_og", + # "name": "test_network_og", + # "network_object": { + # "host": [ + # "192.0.3.1", + # "192.0.3.2" + # ], + # "ipv6_address": [ + # "2001:db8:3::/64" + # ] + # } + # }, + # { + # "description": "test_og_network", + # "name": "test_og_network", + # "network_object": { + # "address": [ + # "192.0.2.0 255.255.255.0", + # "198.51.100.0 255.255.255.0" + # ], + # "host": [ + # "192.0.2.1", + # "192.0.2.2" + # ] + # } + # } + # ], + # "object_type": "network" + # }, + # { + # "object_groups": [ + # { + # "description": "test_user", + # "name": "test_og_user", + # "user_object": { + # "user": [ + # { + # "domain": "LOCAL", + # "name": "new_user_1" + # }, + # { + # "domain": "LOCAL", + # "name": "new_user_2" + # } + # ] + # } + # } + # ], + # "object_type": "user" + # } + # ] + + # After state: + # ------------ + # + # ciscoasa# sh running-config object-group + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object host 192.0.2.2 + # network-object 192.0.2.0 255.255.255.0 + # network-object 198.51.100.0 255.255.255.0 + # object-group network test_network_og + # description test_network_og + # network-object host 192.0.3.1 + # network-object host 192.0.3.2 + # network-object 2001:db8:0:3::/64 + # group-object test_og_network + # object-group security test_og_security + # security-group name test_1 + # security-group name test_2 + # security-group tag 10 + # security-group tag 20 + # object-group user test_og_user + # user LOCAL\new_user_1 + # user LOCAL\new_user_2 + + # Using Rendered + + - name: Render the commands for provided configuration + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: rendered + + # Module Execution Result: + # ------------------------ + # + # "rendered": [ + # "object-group security test_og_security", + # "description test_security", + # "security-group name test_1", + # "security-group name test_2", + # "security-group tag 10", + # "security-group tag 20", + # "object-group network test_og_network", + # "description test_og_network", + # "network-object 192.0.2.0 255.255.255.0", + # "network-object 198.51.100.0 255.255.255.0", + # "network-object host 192.0.2.1", + # "network-object host 192.0.2.2", + # "object-group network test_network_og", + # "description test_network_og", + # "network-object host 192.0.3.1", + # "network-object host 192.0.3.2", + # "network-object 2001:db8:3::/64", + # "object-group user test_og_user", + # "description test_user", + # "user LOCAL\new_user_1", + # "user LOCAL\new_user_2" + # ] + + # Using Parsed + + # parsed.cfg + # + # object-group network test_og_network + # description test_og_network + # network-object host 192.0.2.1 + # network-object 192.0.2.0 255.255.255.0 + # object-group network test_network_og + # network-object 2001:db8:3::/64 + # object-group service test_og_service + # service-object tcp-udp + + - name: Parse the commands for provided configuration + cisco.asa.asa_ogs: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + + # Module Execution Result: + # ------------------------ + # + # "parsed": [ + # { + # "object_groups": [ + # { + # "name": "test_network_og" + # }, + # { + # "description": "test_og_network", + # "name": "test_og_network", + # "network_object": { + # "host": [ + # "192.0.2.2" + # ] + # } + # } + # ], + # "object_type": "network" + # }, + # { + # "object_groups": [ + # { + # "name": "test_og_service", + # "service_object": { + # "protocol": [ + # "tcp-udp", + # "ipinip" + # ] + # } + # } + # ], + # "object_type": "service" + # } + # ] + + + +Return Values +------------- +Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module: + +.. raw:: html + + <table border=0 cellpadding=0 class="documentation-table"> + <tr> + <th colspan="1">Key</th> + <th>Returned</th> + <th width="100%">Description</th> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>after</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>when changed</td> + <td> + <div>The configuration as structured data after module completion.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>before</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The configuration as structured data prior to module invocation.</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">The configuration returned will always be in the same format of the parameters above.</div> + </td> + </tr> + <tr> + <td colspan="1"> + <div class="ansibleOptionAnchor" id="return-"></div> + <b>commands</b> + <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a> + <div style="font-size: small"> + <span style="color: purple">list</span> + </div> + </td> + <td>always</td> + <td> + <div>The set of commands pushed to the remote device</div> + <br/> + <div style="font-size: smaller"><b>Sample:</b></div> + <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">['object-group network test_network_og', 'description test_network_og', 'network-object host 192.0.2.1']</div> + </td> + </tr> + </table> + <br/><br/> + + +Status +------ + + +Authors +~~~~~~~ + +- Sumit Jaiswal (@justjais) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/meta/runtime.yml b/collections-debian-merged/ansible_collections/cisco/asa/meta/runtime.yml new file mode 100644 index 00000000..fc94e987 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/meta/runtime.yml @@ -0,0 +1,61 @@ +--- +requires_ansible: '>=2.9.10,<2.11' +plugin_routing: + action: + asa_acl: + redirect: cisco.asa.asa + acl: + redirect: cisco.asa.asa + asa_acls: + redirect: cisco.asa.asa + acls: + redirect: cisco.asa.asa + asa_command: + redirect: cisco.asa.asa + command: + redirect: cisco.asa.asa + asa_config: + redirect: cisco.asa.asa + config: + redirect: cisco.asa.asa + asa_facts: + redirect: cisco.asa.asa + facts: + redirect: cisco.asa.asa + asa_og: + redirect: cisco.asa.asa + og: + redirect: cisco.asa.asa + asa_ogs: + redirect: cisco.asa.asa + ogs: + redirect: cisco.asa.asa + modules: + acl: + redirect: cisco.asa.asa_acl + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + asa_acl: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + acls: + redirect: cisco.asa.asa_acls + command: + redirect: cisco.asa.asa_command + config: + redirect: cisco.asa.asa_config + facts: + redirect: cisco.asa.asa_facts + og: + redirect: cisco.asa.asa_og + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + asa_og: + deprecation: + removal_date: '2022-06-01' + warning_text: See the plugin documentation for more details + ogs: + redirect: cisco.asa.asa_ogs diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/action/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/action/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/action/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/action/asa.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/action/asa.py new file mode 100644 index 00000000..0fa543c4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/action/asa.py @@ -0,0 +1,96 @@ +# +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import sys +import copy + +from ansible import constants as C +from ansible_collections.ansible.netcommon.plugins.action.network import ( + ActionModule as ActionNetworkModule, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + asa_provider_spec, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + load_provider, +) +from ansible.utils.display import Display + +display = Display() + + +class ActionModule(ActionNetworkModule): + def run(self, tmp=None, task_vars=None): + del tmp # tmp no longer has any effect + + module_name = self._task.action.split(".")[-1] + self._config_module = ( + True if module_name in ["asa_config", "config"] else False + ) + + if self._play_context.connection == "local": + provider = load_provider(asa_provider_spec, self._task.args) + pc = copy.deepcopy(self._play_context) + pc.connection = "network_cli" + pc.network_os = "asa" + pc.remote_addr = provider["host"] or self._play_context.remote_addr + pc.port = int(provider["port"] or self._play_context.port or 22) + pc.remote_user = ( + provider["username"] or self._play_context.connection_user + ) + pc.password = provider["password"] or self._play_context.password + pc.private_key_file = ( + provider["ssh_keyfile"] or self._play_context.private_key_file + ) + command_timeout = int( + provider["timeout"] or C.PERSISTENT_COMMAND_TIMEOUT + ) + pc.become = provider["authorize"] or False + pc.become_pass = provider["auth_pass"] + pc.become_method = "enable" + + display.vvv( + "using connection plugin %s (was local)" % pc.connection, + pc.remote_addr, + ) + connection = self._shared_loader_obj.connection_loader.get( + "persistent", pc, sys.stdin, task_uuid=self._task._uuid + ) + connection.set_options( + direct={"persistent_command_timeout": command_timeout} + ) + + socket_path = connection.run() + + display.vvvv("socket_path: %s" % socket_path, pc.remote_addr) + if not socket_path: + return { + "failed": True, + "msg": "unable to open shell. Please see: " + + "https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell", + } + + task_vars["ansible_socket"] = socket_path + + result = super(ActionModule, self).run(task_vars=task_vars) + + return result diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/cliconf/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/cliconf/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/cliconf/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/cliconf/asa.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/cliconf/asa.py new file mode 100644 index 00000000..d5126356 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/cliconf/asa.py @@ -0,0 +1,145 @@ +# +# (c) 2017 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = """ +--- +author: Ansible Security Team +cliconf: asa +short_description: Use asa cliconf to run command on Cisco ASA platform +description: +- This asa plugin provides low level abstraction apis for sending and receiving CLI + commands from Cisco ASA network devices. +version_added: 1.0.0 +""" + +import re +import json + +from itertools import chain +from ansible.errors import AnsibleConnectionFailure +from ansible.module_utils._text import to_text +from ansible.module_utils.common._collections_compat import Mapping +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible.plugins.cliconf import CliconfBase, enable_mode + + +class Cliconf(CliconfBase): + def get_device_info(self): + device_info = {} + + device_info["network_os"] = "asa" + reply = self.get("show version") + data = to_text(reply, errors="surrogate_or_strict").strip() + + match = re.search(r"Version (\S+)", data) + if match: + device_info["network_os_version"] = match.group(1) + + match = re.search(r"Firepower .+ Version (\S+)", data) + if match: + device_info["network_os_firepower_version"] = match.group(1) + + match = re.search(r"Device .+ Version (\S+)", data) + if match: + device_info["network_os_device_mgr_version"] = match.group(1) + + match = re.search(r"^Model Id:\s+(.+) \(revision", data, re.M) + if match: + device_info["network_os_model"] = match.group(1) + + match = re.search(r"^(.+) up", data, re.M) + if match: + device_info["network_os_hostname"] = match.group(1) + + match = re.search(r'image file is "(.+)"', data) + if match: + device_info["network_os_image"] = match.group(1) + + return device_info + + @enable_mode + def get_config(self, source="running", format="text", flags=None): + if source not in ("running", "startup"): + return self.invalid_params( + "fetching configuration from %s is not supported" % source + ) + if source == "running": + cmd = "show running-config all" + else: + cmd = "show startup-config" + return self.send_command(cmd) + + @enable_mode + def edit_config(self, command): + for cmd in chain(["configure terminal"], to_list(command), ["end"]): + self.send_command(cmd) + + def get( + self, + command, + prompt=None, + answer=None, + sendonly=False, + newline=True, + check_all=False, + ): + return self.send_command( + command=command, + prompt=prompt, + answer=answer, + sendonly=sendonly, + newline=newline, + check_all=check_all, + ) + + def get_capabilities(self): + result = super(Cliconf, self).get_capabilities() + return json.dumps(result) + + def run_commands(self, commands=None, check_rc=True): + if commands is None: + raise ValueError("'commands' value is required") + + responses = list() + for cmd in to_list(commands): + if not isinstance(cmd, Mapping): + cmd = {"command": cmd} + + output = cmd.pop("output", None) + if output: + raise ValueError( + "'output' value %s is not supported for run_commands" + % output + ) + + try: + out = self.send_command(**cmd) + except AnsibleConnectionFailure as e: + if check_rc: + raise + out = getattr(e, "err", to_text(e)) + + responses.append(out) + + return responses diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/doc_fragments/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/doc_fragments/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/doc_fragments/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/doc_fragments/asa.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/doc_fragments/asa.py new file mode 100644 index 00000000..3ce7f396 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/doc_fragments/asa.py @@ -0,0 +1,102 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# Copyright: (c) 2016, Peter Sprygada <psprygada@ansible.com> +# Copyright: (c) 2016, Patrick Ogenstad <@ogenstad> +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + + +class ModuleDocFragment(object): + + # Standard files documentation fragment + DOCUMENTATION = r"""options: + authorize: + description: + - B(Deprecated) + - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli) and + C(become: yes).' + - For more information please see the L(Network Guide, ../network/getting_started/network_differences.html#multiple-communication-protocols). + - HORIZONTALLINE + - Instructs the module to enter privileged mode on the remote device before sending + any commands. If not specified, the device will attempt to execute all commands + in non-privileged mode. If the value is not specified in the task, the value + of environment variable C(ANSIBLE_NET_AUTHORIZE) will be used instead. + type: bool + default: false + context: + description: + - Specifies which context to target if you are running in the ASA in multiple + context mode. Defaults to the current context you login to. + type: str + passwords: + description: + - Specifies which context to target if you are running in the ASA in multiple + context mode. Defaults to the current context you login to. + type: bool + provider: + description: + - B(Deprecated) + - 'Starting with Ansible 2.5 we recommend using C(connection: network_cli).' + - For more information please see the L(Network Guide, ../network/getting_started/network_differences.html#multiple-communication-protocols). + - HORIZONTALLINE + - A dict object containing connection details. + type: dict + suboptions: + host: + description: + - Specifies the DNS host name or address for connecting to the remote device + over the specified transport. The value of host is used as the destination + address for the transport. + type: str + port: + description: + - Specifies the port to use when building the connection to the remote device. + type: int + username: + description: + - Configures the username to use to authenticate the connection to the remote + device. This value is used to authenticate the SSH session. If the value + is not specified in the task, the value of environment variable C(ANSIBLE_NET_USERNAME) + will be used instead. + type: str + password: + description: + - Specifies the password to use to authenticate the connection to the remote + device. This value is used to authenticate the SSH session. If the value + is not specified in the task, the value of environment variable C(ANSIBLE_NET_PASSWORD) + will be used instead. + type: str + ssh_keyfile: + description: + - Specifies the SSH key to use to authenticate the connection to the remote + device. This value is the path to the key used to authenticate the SSH + session. If the value is not specified in the task, the value of environment + variable C(ANSIBLE_NET_SSH_KEYFILE) will be used instead. + type: path + authorize: + description: + - Instructs the module to enter privileged mode on the remote device before + sending any commands. If not specified, the device will attempt to execute + all commands in non-privileged mode. If the value is not specified in the + task, the value of environment variable C(ANSIBLE_NET_AUTHORIZE) will be + used instead. + type: bool + default: false + auth_pass: + description: + - Specifies the password to use if required to enter privileged mode on the + remote device. If I(authorize) is false, then this argument does nothing. + If the value is not specified in the task, the value of environment variable + C(ANSIBLE_NET_AUTH_PASS) will be used instead. + type: str + timeout: + description: + - Specifies idle timeout in seconds for the connection, in seconds. Useful + if the console freezes before continuing. For example when saving configurations. + type: int +notes: +- For more information on using Ansible to manage network devices see the :ref:`Ansible + Network Guide <network_guide>` +""" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/acls/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/acls/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/acls/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/acls/acls.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/acls/acls.py new file mode 100644 index 00000000..3a8b2e52 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/acls/acls.py @@ -0,0 +1,290 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The arg spec for the asa_acls module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class AclsArgs(object): + """The arg spec for the asa_acls module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "type": "dict", + "options": { + "acls": { + "elements": "dict", + "type": "list", + "options": { + "name": {"required": True, "type": "str"}, + "acl_type": { + "choices": ["extended", "standard"], + "type": "str", + }, + "rename": {"type": "str"}, + "aces": { + "elements": "dict", + "type": "list", + "options": { + "grant": { + "choices": ["permit", "deny"], + "type": "str", + }, + "line": {"type": "int"}, + "remark": {"type": "str"}, + "source": { + "type": "dict", + "options": { + "address": {"type": "str"}, + "netmask": {"type": "str"}, + "any": {"type": "bool"}, + "any4": {"type": "bool"}, + "any6": {"type": "bool"}, + "host": {"type": "str"}, + "interface": {"type": "str"}, + "object_group": {"type": "str"}, + "port_protocol": { + "type": "dict", + "options": { + "eq": {"type": "str"}, + "gt": {"type": "str"}, + "lt": {"type": "str"}, + "neq": {"type": "str"}, + "range": { + "type": "dict", + "options": { + "start": { + "type": "int" + }, + "end": {"type": "int"}, + }, + }, + }, + }, + }, + }, + "destination": { + "type": "dict", + "options": { + "address": {"type": "str"}, + "netmask": {"type": "str"}, + "any": {"type": "bool"}, + "any4": {"type": "bool"}, + "any6": {"type": "bool"}, + "host": {"type": "str"}, + "interface": {"type": "str"}, + "object_group": {"type": "str"}, + "port_protocol": { + "type": "dict", + "options": { + "eq": {"type": "str"}, + "gt": {"type": "str"}, + "lt": {"type": "str"}, + "neq": {"type": "str"}, + "range": { + "type": "dict", + "options": { + "start": { + "type": "int" + }, + "end": {"type": "int"}, + }, + }, + }, + }, + }, + }, + "protocol": {"type": "str"}, + "protocol_options": { + "type": "dict", + "options": { + "protocol_number": {"type": "int"}, + "ahp": {"type": "bool"}, + "eigrp": {"type": "bool"}, + "esp": {"type": "bool"}, + "gre": {"type": "bool"}, + "icmp": { + "type": "dict", + "options": { + "alternate_address": { + "type": "bool" + }, + "conversion_error": { + "type": "bool" + }, + "echo": {"type": "bool"}, + "echo_reply": {"type": "bool"}, + "information_reply": { + "type": "bool" + }, + "information_request": { + "type": "bool" + }, + "mask_reply": {"type": "bool"}, + "mask_request": { + "type": "bool" + }, + "mobile_redirect": { + "type": "bool" + }, + "parameter_problem": { + "type": "bool" + }, + "redirect": {"type": "bool"}, + "router_advertisement": { + "type": "bool" + }, + "router_solicitation": { + "type": "bool" + }, + "source_quench": { + "type": "bool" + }, + "source_route_failed": { + "type": "bool" + }, + "time_exceeded": { + "type": "bool" + }, + "timestamp_reply": { + "type": "bool" + }, + "timestamp_request": { + "type": "bool" + }, + "traceroute": {"type": "bool"}, + "unreachable": { + "type": "bool" + }, + }, + }, + "icmp6": { + "type": "dict", + "options": { + "echo": {"type": "bool"}, + "echo_reply": {"type": "bool"}, + "membership_query": { + "type": "bool" + }, + "membership_reduction": { + "type": "bool" + }, + "membership_report": { + "type": "bool" + }, + "neighbor_advertisement": { + "type": "bool" + }, + "neighbor_redirect": { + "type": "bool" + }, + "neighbor_solicitation": { + "type": "bool" + }, + "packet_too_big": { + "type": "bool" + }, + "parameter_problem": { + "type": "bool" + }, + "router_advertisement": { + "type": "bool" + }, + "router_renumbering": { + "type": "bool" + }, + "router_solicitation": { + "type": "bool" + }, + "time_exceeded": { + "type": "bool" + }, + "unreachable": { + "type": "bool" + }, + }, + }, + "igmp": {"type": "bool"}, + "igrp": {"type": "bool"}, + "ip": {"type": "bool"}, + "ipinip": {"type": "bool"}, + "ipsec": {"type": "bool"}, + "nos": {"type": "bool"}, + "ospf": {"type": "bool"}, + "pcp": {"type": "bool"}, + "pim": {"type": "bool"}, + "pptp": {"type": "bool"}, + "sctp": {"type": "bool"}, + "snp": {"type": "bool"}, + "tcp": {"type": "bool"}, + "udp": {"type": "bool"}, + }, + }, + "inactive": {"type": "bool"}, + "log": { + "type": "str", + "choices": [ + "default", + "alerts", + "critical", + "debugging", + "disable", + "emergencies", + "errors", + "informational", + "interval", + "notifications", + "warnings", + ], + }, + "time_range": {"type": "str"}, + }, + }, + }, + } + }, + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/facts/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/facts/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/facts/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/facts/facts.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/facts/facts.py new file mode 100644 index 00000000..e1f0b526 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/facts/facts.py @@ -0,0 +1,27 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The arg spec for the asa facts module. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class FactsArgs(object): + """ The arg spec for the asa facts module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "gather_subset": dict( + default=["!config"], type="list", elements="str" + ), + "gather_network_resources": dict(type="list", elements="str"), + } diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/ogs/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/ogs/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/ogs/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/ogs/ogs.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/ogs/ogs.py new file mode 100644 index 00000000..d236993a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/argspec/ogs/ogs.py @@ -0,0 +1,229 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The arg spec for the asa_ogs module +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +class OGsArgs(object): + """The arg spec for the asa_ogs module + """ + + def __init__(self, **kwargs): + pass + + argument_spec = { + "config": { + "elements": "dict", + "type": "list", + "options": { + "object_type": { + "type": "str", + "required": True, + "choices": [ + "icmp-type", + "network", + "protocol", + "security", + "service", + "user", + ], + }, + "object_groups": { + "elements": "dict", + "type": "list", + "options": { + "name": {"required": True, "type": "str"}, + "description": {"type": "str"}, + "icmp_type": { + "type": "dict", + "options": { + "icmp_object": { + "type": "list", + "elements": "str", + "choices": [ + "alternate-address", + "conversion-error", + "echo", + "echo-reply", + "information-reply", + "information-request", + "mask-reply", + "mask-request", + "mobile-redirect", + "parameter-problem", + "redirect", + "router-advertisement", + "router-solicitation", + "source-quench", + "time-exceeded", + "timestamp-reply", + "timestamp-request", + "traceroute", + "unreachable", + ], + } + }, + }, + "network_object": { + "type": "dict", + "options": { + "host": {"type": "list", "elements": "str"}, + "address": {"type": "list", "elements": "str"}, + "ipv6_address": { + "type": "list", + "elements": "str", + }, + }, + }, + "protocol_object": { + "type": "dict", + "options": { + "protocol": { + "type": "list", + "elements": "str", + "choices": [ + "ah", + "eigrp", + "esp", + "gre", + "icmp", + "icmp6", + "igmp", + "igrp", + "ip", + "ipinip", + "ipsec", + "nos", + "ospf", + "pcp", + "pim", + "pptp", + "sctp", + "snp", + "tcp", + "udp", + ], + } + }, + }, + "security_group": { + "type": "dict", + "options": { + "sec_name": { + "type": "list", + "elements": "str", + }, + "tag": {"type": "list", "elements": "str"}, + }, + }, + "service_object": { + "type": "dict", + "options": { + "protocol": { + "type": "list", + "elements": "str", + "choices": [ + "ah", + "eigrp", + "esp", + "gre", + "icmp", + "icmp6", + "igmp", + "igrp", + "ip", + "ipinip", + "ipsec", + "nos", + "ospf", + "pcp", + "pim", + "pptp", + "sctp", + "snp", + "tcp", + "tcp-udp", + "udp", + ], + }, + "object": {"type": "str"}, + }, + }, + "user_object": { + "type": "dict", + "options": { + "user": { + "elements": "dict", + "type": "list", + "options": { + "name": { + "required": True, + "type": "str", + }, + "domain": { + "required": True, + "type": "str", + }, + }, + }, + "user_group": { + "elements": "dict", + "type": "list", + "options": { + "name": { + "required": True, + "type": "str", + }, + "domain": { + "required": True, + "type": "str", + }, + }, + }, + }, + }, + }, + }, + }, + }, + "running_config": {"type": "str"}, + "state": { + "choices": [ + "merged", + "replaced", + "overridden", + "deleted", + "gathered", + "rendered", + "parsed", + ], + "default": "merged", + "type": "str", + }, + } diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/asa.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/asa.py new file mode 100644 index 00000000..f2a3ba2f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/asa.py @@ -0,0 +1,194 @@ +# 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. +# +# (c) 2016 Red Hat Inc. +# +# 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. +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import json + +from ansible.module_utils._text import to_text +from ansible.module_utils.basic import env_fallback +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + EntityCollection, +) +from ansible.module_utils.connection import exec_command +from ansible.module_utils.connection import Connection, ConnectionError + +_DEVICE_CONFIGS = {} +_CONNECTION = None + +asa_provider_spec = { + "host": dict(), + "port": dict(type="int"), + "username": dict(fallback=(env_fallback, ["ANSIBLE_NET_USERNAME"])), + "password": dict( + fallback=(env_fallback, ["ANSIBLE_NET_PASSWORD"]), no_log=True + ), + "ssh_keyfile": dict( + fallback=(env_fallback, ["ANSIBLE_NET_SSH_KEYFILE"]), type="path" + ), + "authorize": dict( + fallback=(env_fallback, ["ANSIBLE_NET_AUTHORIZE"]), type="bool" + ), + "auth_pass": dict( + fallback=(env_fallback, ["ANSIBLE_NET_AUTH_PASS"]), no_log=True + ), + "timeout": dict(type="int"), +} + +asa_argument_spec = { + "provider": dict( + type="dict", + options=asa_provider_spec, + removed_at_date="2022-06-01", + removed_from_collection="cisco.asa", + ) +} + +asa_top_spec = { + "authorize": dict( + fallback=(env_fallback, ["ANSIBLE_NET_AUTHORIZE"]), type="bool" + ), + "context": dict(type="str"), + "passwords": dict(type="bool"), +} +asa_argument_spec.update(asa_top_spec) + +command_spec = {"command": dict(key=True), "prompt": dict(), "answer": dict()} + + +def get_provider_argspec(): + return asa_provider_spec + + +def check_args(module): + pass + + +def get_connection(module): + if hasattr(module, "_asa_connection"): + return module._asa_connection + + # Not all modules include the 'context' key. + context = module.params.get("context") + capabilities = get_capabilities(module) + network_api = capabilities.get("network_api") + if network_api == "cliconf": + module._asa_connection = Connection(module._socket_path) + else: + module.fail_json(msg="Invalid connection type %s" % network_api) + + if context: + if context == "system": + command = "changeto system" + else: + command = "changeto context %s" % context + module._asa_connection.get(command) + + return module._asa_connection + + +def get_capabilities(module): + if hasattr(module, "_asa_capabilities"): + return module._asa_capabilities + try: + capabilities = Connection(module._socket_path).get_capabilities() + except ConnectionError as exc: + module.fail_json(msg=to_text(exc, errors="surrogate_then_replace")) + module._asa_capabilities = json.loads(capabilities) + + return module._asa_capabilities + + +def to_commands(module, commands): + if not isinstance(commands, list): + raise AssertionError("argument must be of type <list>") + + transform = EntityCollection(module, command_spec) + commands = transform(commands) + + for index, item in enumerate(commands): + if module.check_mode and not item["command"].startswith("show"): + module.warn( + "only show commands are supported when using check " + "mode, not executing `%s`" % item["command"] + ) + + return commands + + +def run_commands(module, commands, check_rc=True): + connection = get_connection(module) + try: + return connection.run_commands(commands=commands, check_rc=check_rc) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc)) + + +def get_config(module, flags=None): + flags = [] if flags is None else flags + + # Not all modules include the 'passwords' key. + passwords = module.params.get("passwords", False) + if passwords: + cmd = "more system:running-config" + else: + cmd = "show running-config " + cmd += " ".join(flags) + cmd = cmd.strip() + + try: + return _DEVICE_CONFIGS[cmd] + except KeyError: + conn = get_connection(module) + out = conn.get(cmd) + cfg = to_text(out, errors="surrogate_then_replace").strip() + _DEVICE_CONFIGS[cmd] = cfg + return cfg + + +def load_config(module, config): + try: + conn = get_connection(module) + conn.edit_config(config) + except ConnectionError as exc: + module.fail_json(msg=to_text(exc)) + + +def get_defaults_flag(module): + rc, out, err = exec_command(module, "show running-config ?") + out = to_text(out, errors="surrogate_then_replace") + + commands = set() + for line in out.splitlines(): + if line: + commands.add(line.strip().split()[0]) + + if "all" in commands: + return "all" + else: + return "full" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/acls/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/acls/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/acls/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/acls/acls.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/acls/acls.py new file mode 100644 index 00000000..548453bd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/acls/acls.py @@ -0,0 +1,199 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The asa_acls class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.facts import ( + Facts, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.rm_templates.acls import ( + AclsTemplate, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module import ( + ResourceModule, +) + + +class Acls(ResourceModule): + """ + The asa_acls class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["acls"] + + def __init__(self, module): + super(Acls, self).__init__( + empty_fact_val={}, + facts_module=Facts(module), + module=module, + resource="acls", + tmplt=AclsTemplate(), + ) + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + self.gen_config() + self.run_commands() + return self.result + + def gen_config(self): + """ Select the appropriate function based on the state provided + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + if self.want: + wantd = {(entry["name"]): entry for entry in self.want["acls"]} + else: + wantd = {} + if self.have: + haved = {(entry["name"]): entry for entry in self.have["acls"]} + else: + haved = {} + + for k, want in iteritems(wantd): + h_want = haved.get(k, {}) + if want.get("aces"): + for each in want["aces"]: + if h_want.get("aces"): + for e_have in h_want.get("aces"): + if e_have.get("source") == each.get( + "source" + ) and e_have.get("destination") == each.get( + "destination" + ): + if ( + "protocol" in e_have + and "protocol" not in each + and each.get("protocol_options") + == e_have.get("protocol_options") + ): + del e_have["protocol"] + break + # if state is merged, merge want onto have and then compare + if self.state == "merged": + wantd = dict_merge(haved, wantd) + + # if state is deleted, empty out wantd and set haved to wantd + if self.state == "deleted": + haved = { + k: v for k, v in iteritems(haved) if k in wantd or not wantd + } + wantd = {} + + # remove superfluous config for overridden and deleted + if self.state in ["overridden", "deleted"]: + for k, have in iteritems(haved): + if k not in wantd: + self._compare(want={}, have=have) + + temp = [] + for k, want in iteritems(wantd): + if want.get("rename") and want.get("rename") not in temp: + self.commands.extend( + ["access-list {name} rename {rename}".format(**want)] + ) + elif k in haved: + temp.append(k) + self._compare(want=want, have=haved.pop(k, {})) + if self.state in ["replaced", "overridden", "deleted"]: + config_cmd = [cmd for cmd in self.commands if "no" in cmd][::-1] + config_cmd.extend( + [cmd for cmd in self.commands if "no" not in cmd] + ) + self.commands = config_cmd + + def _compare(self, want, have): + """Leverages the base class `compare()` method and + populates the list of commands to be run by comparing + the `want` and `have` data with the `parsers` defined + for the Ospf_interfaces network resource. + """ + parsers = ["aces"] + + if want.get("aces"): + for each in want["aces"]: + set_want = True + if have.get("aces"): + temp = 0 + for e_have in have.get("aces"): + if e_have.get("source") == each.get( + "source" + ) and e_have.get("destination") == each.get( + "destination" + ): + set_want = False + each.update( + { + "name": want.get("name"), + "acl_type": want.get("acl_type"), + } + ) + e_have.update( + { + "name": have.get("name"), + "acl_type": have.get("acl_type"), + } + ) + self.compare( + parsers=parsers, + want={"aces": each}, + have={"aces": e_have}, + ) + del have.get("aces")[temp] + break + temp += 1 + else: + each.update( + { + "name": want.get("name"), + "acl_type": want.get("acl_type"), + } + ) + self.compare( + parsers=parsers, want={"aces": each}, have=dict() + ) + set_want = False + if set_want: + each.update( + { + "name": want.get("name"), + "acl_type": want.get("acl_type"), + } + ) + self.compare( + parsers=parsers, want={"aces": each}, have=dict() + ) + if self.state in ["overridden", "deleted", "replaced"]: + if have.get("aces"): + for each in have["aces"]: + each.update( + { + "name": have.get("name"), + "acl_type": have.get("acl_type"), + } + ) + self.compare( + parsers=parsers, want=dict(), have={"aces": each} + ) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/ogs/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/ogs/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/ogs/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/ogs/ogs.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/ogs/ogs.py new file mode 100644 index 00000000..857b43ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/config/ogs/ogs.py @@ -0,0 +1,459 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat Inc. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The asa_ogs class +It is in this file where the current configuration (as dict) +is compared to the provided configuration (as dict) and the command set +necessary to bring the current configuration to it's desired end-state is +created +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import copy +from ansible.module_utils.six import iteritems +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.facts import ( + Facts, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.rm_templates.ogs import ( + OGsTemplate, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module import ( + ResourceModule, +) + + +class OGs(ResourceModule): + """ + The asa_ogs class + """ + + gather_subset = ["!all", "!min"] + + gather_network_resources = ["ogs"] + + def __init__(self, module): + super(OGs, self).__init__( + empty_fact_val={}, + facts_module=Facts(module), + module=module, + resource="ogs", + tmplt=OGsTemplate(), + ) + + def execute_module(self): + """ Execute the module + :rtype: A dictionary + :returns: The result from module execution + """ + self.gen_config() + self.run_commands() + return self.result + + def gen_config(self): + """ Select the appropriate function based on the state provided + :rtype: A list + :returns: the commands necessary to migrate the current configuration + to the desired configuration + """ + if self.want: + wantd = {(entry["object_type"]): entry for entry in self.want} + else: + wantd = {} + if self.have: + haved = {(entry["object_type"]): entry for entry in self.have} + else: + haved = {} + + obj_gp = {} + for k, v in wantd.items(): + temp = {} + for each in v.get("object_groups"): + temp[each.get("name")] = each + temp["object_type"] = k + obj_gp[k] = temp + if obj_gp: + wantd = obj_gp + obj_gp = {} + for k, v in haved.items(): + temp = {} + for each in v.get("object_groups"): + temp[each.get("name")] = each + temp["object_type"] = k + obj_gp[k] = temp + if obj_gp: + haved = obj_gp + + # if state is merged, merge want onto have + if self.state == "merged": + wantd = dict_merge(haved, wantd) + + # if state is deleted, empty out wantd and set haved to wantd + if self.state == "deleted": + temp = {} + for k, v in iteritems(haved): + temp_have = {} + if k in wantd or not wantd: + for key, val in iteritems(v): + if not wantd or key in wantd[k]: + temp_have.update({key: val}) + temp.update({k: temp_have}) + haved = temp + wantd = {} + + # delete processes first so we do run into "more than one" errors + if self.state in ["overridden", "deleted"]: + for k, have in iteritems(haved): + if k not in wantd: + for each_key, each_val in iteritems(have): + if each_key != "object_type": + each_val.update( + {"object_type": have.get("object_type")} + ) + self.addcmd(each_val, "og_name", True) + + for k, want in iteritems(wantd): + self._compare(want=want, have=haved.pop(k, {})) + + def _compare(self, want, have): + if want != have: + for k, v in iteritems(want): + if k != "object_type": + v.update({"object_type": want.get("object_type")}) + if have: + for k, v in iteritems(have): + if k != "object_type": + v.update({"object_type": want.get("object_type")}) + + object_type = want.get("object_type") + if object_type == "icmp-type": + self._icmp_object_compare(want, have) + if object_type == "network": + self._network_object_compare(want, have) + elif object_type == "protocol": + self._protocol_object_compare(want, have) + elif object_type == "security": + self._security_object_compare(want, have) + elif object_type == "service": + self._service_object_compare(want, have) + elif object_type == "user": + self._user_object_compare(want, have) + + def get_list_diff(self, want, have, object, param): + diff = [ + item + for item in want[object][param] + if item not in have[object][param] + ] + return diff + + def check_for_have_and_overidden(self, have): + if have and self.state == "overridden": + for name, entry in iteritems(have): + if name != "object_type": + self.addcmd(entry, "og_name", True) + + def _icmp_object_compare(self, want, have): + icmp_obj = "icmp_type" + for name, entry in iteritems(want): + h_item = have.pop(name, {}) + if ( + entry != h_item + and name != "object_type" + and entry[icmp_obj].get("icmp_object") + ): + if h_item: + self._add_object_cmd( + entry, h_item, icmp_obj, ["icmp_type"] + ) + else: + self.addcmd(entry, "og_name", False) + self.compare(["description"], entry, h_item) + if self.state in ("overridden", "replaced") and h_item: + self.compare(["icmp_type"], {}, h_item) + if h_item and h_item[icmp_obj].get("icmp_object"): + li_diff = self.get_list_diff( + entry, h_item, icmp_obj, "icmp_object" + ) + else: + li_diff = entry[icmp_obj].get("icmp_object") + entry[icmp_obj]["icmp_object"] = li_diff + self.addcmd(entry, "icmp_type", False) + self.check_for_have_and_overidden(have) + + def _network_object_compare(self, want, have): + network_obj = "network_object" + parsers = [ + "network_object.host", + "network_object.address", + "network_object.ipv6_address", + ] + add_obj_cmd = False + for name, entry in iteritems(want): + h_item = have.pop(name, {}) + if entry != h_item and name != "object_type": + if h_item: + self._add_object_cmd( + entry, + h_item, + network_obj, + ["address", "host", "ipv6_address"], + ) + else: + add_obj_cmd = True + self.addcmd(entry, "og_name", False) + self.compare(["description"], entry, h_item) + if entry[network_obj].get("address"): + self._compare_object_diff( + entry, + h_item, + network_obj, + "address", + parsers, + "network_object.address", + ) + elif h_item and h_item[network_obj].get("address"): + h_item[network_obj] = { + "address": h_item[network_obj].get("address") + } + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + if entry[network_obj].get("host"): + self._compare_object_diff( + entry, + h_item, + network_obj, + "host", + parsers, + "network_object.host", + ) + elif h_item and h_item[network_obj].get("host"): + h_item[network_obj] = { + "host": h_item[network_obj].get("host") + } + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + if entry[network_obj].get("ipv6_address"): + self._compare_object_diff( + entry, + h_item, + network_obj, + "ipv6_address", + parsers, + "network_object.ipv6_address", + ) + elif h_item and h_item[network_obj].get("ipv6_address"): + h_item[network_obj] = { + "ipv6_address": h_item[network_obj].get("ipv6_address") + } + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + self.check_for_have_and_overidden(have) + + def _protocol_object_compare(self, want, have): + protocol_obj = "protocol_object" + for name, entry in iteritems(want): + h_item = have.pop(name, {}) + if entry != h_item and name != "object_type": + if h_item: + self._add_object_cmd( + entry, h_item, protocol_obj, ["protocol"] + ) + else: + self.addcmd(entry, "og_name", False) + self.compare(["description"], entry, h_item) + if entry[protocol_obj].get("protocol"): + self._compare_object_diff( + entry, + h_item, + protocol_obj, + "protocol", + [protocol_obj], + protocol_obj, + ) + self.check_for_have_and_overidden(have) + + def _security_object_compare(self, want, have): + security_obj = "security_group" + parsers = ["security_group.sec_name", "security_group.tag"] + add_obj_cmd = False + for name, entry in iteritems(want): + h_item = have.pop(name, {}) + if entry != h_item and name != "object_type": + if h_item: + self._add_object_cmd( + entry, h_item, security_obj, ["sec_name", "tag"] + ) + else: + add_obj_cmd = True + self.addcmd(entry, "og_name", False) + self.compare(["description"], entry, h_item) + if entry[security_obj].get("sec_name"): + self._compare_object_diff( + entry, + h_item, + security_obj, + "sec_name", + parsers, + "security_group.sec_name", + ) + elif h_item and h_item[security_obj].get("sec_name"): + h_item[security_obj] = { + "sec_name": h_item[security_obj].get("sec_name") + } + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + if entry[security_obj].get("tag"): + self._compare_object_diff( + entry, + h_item, + security_obj, + "tag", + parsers, + "security_group.tag", + ) + elif h_item and h_item[security_obj].get("tag"): + h_item[security_obj] = { + "tag": h_item[security_obj].get("tag") + } + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + self.check_for_have_and_overidden(have) + + def _service_object_compare(self, want, have): + service_obj = "service_object" + for name, entry in iteritems(want): + h_item = have.pop(name, {}) + if entry != h_item and name != "object_type": + if h_item: + self._add_object_cmd( + entry, h_item, service_obj, ["protocol"] + ) + else: + self.addcmd(entry, "og_name", False) + self.compare(["description"], entry, h_item) + if entry[service_obj].get("protocol"): + self._compare_object_diff( + entry, + h_item, + service_obj, + "protocol", + ["service_object"], + service_obj, + ) + self.check_for_have_and_overidden(have) + + def _user_object_compare(self, want, have): + user_obj = "user_object" + parsers = ["user_object.user", "user_object.user_gp"] + add_obj_cmd = False + for name, entry in iteritems(want): + h_item = have.pop(name, {}) + if entry != h_item and name != "object_type": + if h_item: + self._add_object_cmd( + entry, h_item, user_obj, ["user", "user_group"] + ) + else: + add_obj_cmd = True + self.addcmd(entry, "og_name", False) + self.compare(["description"], entry, h_item) + if entry[user_obj].get("user"): + self._compare_object_diff( + entry, + h_item, + user_obj, + "user", + ["user_object.user"], + "user_object.user", + ) + elif h_item and h_item[user_obj].get("user"): + h_item[user_obj] = {"user": h_item[user_obj].get("user")} + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + if entry[user_obj].get("user_group"): + self._compare_object_diff( + entry, + h_item, + user_obj, + "user_group", + ["user_object.user_group"], + "user_object.user_gp", + ) + elif h_item and h_item[user_obj].get("user_group"): + h_item[user_obj] = { + "user_group": h_item[user_obj].get("user_group") + } + if not add_obj_cmd: + self.addcmd(entry, "og_name", False) + self.compare(parsers, {}, h_item) + self.check_for_have_and_overidden(have) + + def _add_object_cmd(self, want, have, object, object_elements): + obj_cmd_added = False + for each in object_elements: + want_element = want[object].get(each) + have_element = have[object].get(each) + if want_element and isinstance(want_element[0], dict): + if ( + want_element + and have_element + and want_element != have_element + ): + if not obj_cmd_added: + self.addcmd(want, "og_name", False) + self.compare(["description"], want, have) + obj_cmd_added = True + else: + if ( + want_element + and have_element + and set(want_element) != set(have_element) + ): + if not obj_cmd_added: + self.addcmd(want, "og_name", False) + self.compare(["description"], want, have) + obj_cmd_added = True + + def _compare_object_diff( + self, want, have, object, object_type, parsers, val + ): + temp_have = copy.copy(have) + temp_want = copy.copy(want) + if temp_have and temp_have[object].get(object_type): + want_diff = self.get_list_diff( + temp_want, temp_have, object, object_type + ) + have_diff = [ + each + for each in temp_have[object][object_type] + if each not in temp_want[object][object_type] + ] + if have_diff: + temp_have[object].pop(object_type) + else: + have_diff = [] + want_diff = temp_want[object].get(object_type) + temp_want[object][object_type] = want_diff + if ( + have_diff + or temp_have.get(object) + and self.state in ("overridden", "replaced") + ): + if have_diff: + temp_have[object] = {object_type: have_diff} + self.compare(parsers, {}, temp_have) + self.addcmd(temp_want, val, False) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/acls/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/acls/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/acls/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/acls/acls.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/acls/acls.py new file mode 100644 index 00000000..5c3f7b97 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/acls/acls.py @@ -0,0 +1,106 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The asa_acls fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from copy import deepcopy +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.argspec.acls.acls import ( + AclsArgs, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.rm_templates.acls import ( + AclsTemplate, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +class AclsFacts(object): + """ The asa_acls fact class + """ + + def __init__(self, module, subspec="config", options="options"): + + self._module = module + self.argument_spec = AclsArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_acls_config(self, connection): + return connection.get("sh access-list") + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for ACLs + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not data: + data = self.get_acls_config(connection) + + rmmod = NetworkTemplate(lines=data.splitlines(), tmplt=AclsTemplate()) + current = rmmod.parse() + acls = list() + if current.get("acls"): + for key, val in iteritems(current.get("acls")): + if val.get("name") == "cached": + continue + for each in val.get("aces"): + if "protocol_number" in each: + each["protocol_options"] = { + "protocol_number": each["protocol_number"] + } + del each["protocol_number"] + if "icmp_icmp6_protocol" in each and each.get("protocol"): + each["protocol_options"] = { + each.get("protocol"): { + each["icmp_icmp6_protocol"].replace( + "-", "_" + ): True + } + } + del each["icmp_icmp6_protocol"] + elif ( + each.get("protocol") + and each.get("protocol") != "icmp" + and each.get("protocol") != "icmp6" + ): + each["protocol_options"] = {each.get("protocol"): True} + acls.append(val) + facts = {} + params = {} + if acls: + params = utils.validate_config( + self.argument_spec, {"config": {"acls": acls}} + ) + params = utils.remove_empties(params) + facts["acls"] = params["config"] + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/facts.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/facts.py new file mode 100644 index 00000000..b874c3f0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/facts.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The facts class for asa +this file validates each subset of facts and selectively +calls the appropriate facts gathering function +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts import ( + FactsBase, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.acls.acls import ( + AclsFacts, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.ogs.ogs import ( + OGsFacts, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.legacy.base import ( + Default, + Hardware, + Config, +) + + +FACT_LEGACY_SUBSETS = dict(default=Default, hardware=Hardware, config=Config) + +FACT_RESOURCE_SUBSETS = dict(acls=AclsFacts, ogs=OGsFacts) + + +class Facts(FactsBase): + """ The fact class for asa + """ + + VALID_LEGACY_GATHER_SUBSETS = frozenset(FACT_LEGACY_SUBSETS.keys()) + VALID_RESOURCE_SUBSETS = frozenset(FACT_RESOURCE_SUBSETS.keys()) + + def __init__(self, module): + super(Facts, self).__init__(module) + + def get_facts( + self, legacy_facts_type=None, resource_facts_type=None, data=None + ): + """ Collect the facts for asa + :param legacy_facts_type: List of legacy facts types + :param resource_facts_type: List of resource fact types + :param data: previously collected conf + :rtype: dict + :return: the facts gathered + """ + if self.VALID_RESOURCE_SUBSETS: + self.get_network_resources_facts( + FACT_RESOURCE_SUBSETS, resource_facts_type, data + ) + + if self.VALID_LEGACY_GATHER_SUBSETS: + self.get_network_legacy_facts( + FACT_LEGACY_SUBSETS, legacy_facts_type + ) + + return self.ansible_facts, self._warnings diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/legacy/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/legacy/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/legacy/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/legacy/base.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/legacy/base.py new file mode 100644 index 00000000..3ad46007 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/legacy/base.py @@ -0,0 +1,186 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +""" +The asa legacy fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +import platform +import re + +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + run_commands, + get_capabilities, +) + + +class FactsBase(object): + + COMMANDS = list() + + def __init__(self, module): + self.module = module + self.facts = dict() + self.warnings = list() + self.responses = None + + def populate(self): + self.responses = run_commands( + self.module, commands=self.COMMANDS, check_rc=False + ) + + def run(self, cmd): + return run_commands(self.module, commands=cmd, check_rc=False) + + +class Default(FactsBase): + + COMMANDS = ["show version"] + + def populate(self): + super(Default, self).populate() + self.facts.update(self.platform_facts()) + data = self.responses[0] + if data: + self.facts["asatype"] = self.parse_asatype(data) + self.facts["serialnum"] = self.parse_serialnum(data) + self.parse_stacks(data) + + def parse_asatype(self, data): + match = re.search(r"Hardware:(\s+)ASA", data) + if match: + return "ASA" + + def parse_serialnum(self, data): + match = re.search(r"Serial Number: (\S+)", data) + if match: + return match.group(1) + + def parse_stacks(self, data): + match = re.findall(r"^Model [Nn]umber\s+: (\S+)", data, re.M) + if match: + self.facts["stacked_models"] = match + + match = re.findall( + r"^System [Ss]erial [Nn]umber\s+: (\S+)", data, re.M + ) + if match: + self.facts["stacked_serialnums"] = match + + def platform_facts(self): + platform_facts = {} + + resp = get_capabilities(self.module) + device_info = resp["device_info"] + platform_facts["system"] = device_info["network_os"] + + for item in ( + "model", + "image", + "version", + "platform", + "hostname", + "firepower_version", + "device_mgr_version", + ): + val = device_info.get("network_os_%s" % item) + if val: + platform_facts[item] = val + + platform_facts["api"] = resp["network_api"] + platform_facts["python_version"] = platform.python_version() + + return platform_facts + + +class Hardware(FactsBase): + + COMMANDS = ["dir", "show memory"] + + def populate(self): + warnings = list() + super(Hardware, self).populate() + data = self.responses[0] + if data: + self.facts["filesystems"] = self.parse_filesystems(data) + self.facts["filesystems_info"] = self.parse_filesystems_info(data) + + data = self.responses[1] + if data: + if "Invalid input detected" in data: + warnings.append("Unable to gather memory statistics") + else: + mem_list = [l for l in data.splitlines() if "memory" in l] + for each in mem_list: + if "Free memory" in each: + match = re.search( + r"Free memory.+ (\d+) .+(\d\d)", each + ) + if match: + self.facts["memfree_mb"] = ( + int(match.group(1)) // 1024 + ) + elif "Used memory" in each: + match = re.search( + r"Used memory.+ (\d+) .+(\d\d)", each + ) + if match: + self.facts["memused_mb"] = ( + int(match.group(1)) // 1024 + ) + elif "Total memory" in each: + match = re.search( + r"Total memory.+ (\d+) .+(\d\d)", each + ) + if match: + self.facts["memtotal_mb"] = ( + int(match.group(1)) // 1024 + ) + + def parse_filesystems(self, data): + return re.findall(r"^Directory of (\S+)/", data, re.M) + + def parse_filesystems_info(self, data): + facts = dict() + fs = "" + for line in data.split("\n"): + match = re.match(r"^Directory of (\S+)/", line) + if match: + fs = match.group(1) + facts[fs] = dict() + continue + match = re.match( + r"^(\d+) bytes total \((\d+) bytes free\/(\d+)% free\)", line + ) + if match: + facts[fs]["spacetotal_kb"] = int(match.group(1)) / 1024 + facts[fs]["spacefree_kb"] = int(match.group(2)) / 1024 + + return facts + + +class Config(FactsBase): + + COMMANDS = ["show running-config"] + + def populate(self): + super(Config, self).populate() + data = self.responses[0] + if data: + data = re.sub( + r"^Building configuration...\s+Current configuration : \d+ bytes\n", + "", + data, + flags=re.MULTILINE, + ) + self.facts["config"] = data diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/ogs.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/ogs.py new file mode 100644 index 00000000..cf1c4335 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/ogs.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) +""" +The asa_og fact class +It is in this file the configuration is collected from the device +for a given resource, parsed, and the facts tree is populated +based on the configuration. +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +from copy import deepcopy +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( + utils, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.argspec.ogs.ogs import ( + OGsArgs, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.rm_templates.ogs import ( + OGsTemplate, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +class OGsFacts(object): + """ The asa_ogs fact class + """ + + def __init__(self, module, subspec="config", options="options"): + + self._module = module + self.argument_spec = OGsArgs.argument_spec + spec = deepcopy(self.argument_spec) + if subspec: + if options: + facts_argument_spec = spec[subspec][options] + else: + facts_argument_spec = spec[subspec] + else: + facts_argument_spec = spec + + self.generated_spec = utils.generate_dict(facts_argument_spec) + + def get_og_data(self, connection): + return connection.get("sh running-config object-group") + + def populate_facts(self, connection, ansible_facts, data=None): + """ Populate the facts for OGs + :param connection: the device connection + :param ansible_facts: Facts dictionary + :param data: previously collected conf + :rtype: dictionary + :returns: facts + """ + if not data: + data = self.get_og_data(connection) + + rmmod = NetworkTemplate(lines=data.splitlines(), tmplt=OGsTemplate()) + current = rmmod.parse() + + ogs = [] + object_groups = { + "icmp-type": "icmp_type", + "network": "network_object", + "protocol": "protocol_object", + "security": "security_group", + "service": "service_object", + "user": "user_object", + } + if current.get("ogs"): + for k, v in iteritems(current.get("ogs")): + obj_gp = {} + config_dict = {} + config_dict["object_type"] = k + config_dict["object_groups"] = [] + for each in iteritems(v): + obj_gp["name"] = each[1].pop("name") + each[1].pop("object_type") + if each[1].get("description"): + obj_gp["description"] = each[1].pop("description") + if each[1].get("group_object"): + obj_gp["group_object"] = each[1].pop("group_object") + obj_gp[object_groups.get(k)] = each[1] + config_dict["object_groups"].append(obj_gp) + obj_gp = {} + config_dict["object_groups"] = sorted( + config_dict["object_groups"], + key=lambda k, sk="name": k[sk], + ) + ogs.append(config_dict) + # sort the object group list of dict by object_type + ogs = sorted(ogs, key=lambda i: i["object_type"]) + facts = {} + params = utils.remove_empties( + utils.validate_config(self.argument_spec, {"config": ogs}) + ) + facts["ogs"] = params.get("config") + + ansible_facts["ansible_network_resources"].update(facts) + return ansible_facts diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/module.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/module.py new file mode 100644 index 00000000..1a847275 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/module.py @@ -0,0 +1,73 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# 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 ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.connection import Connection +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.providers import ( + providers, +) +from ansible.module_utils._text import to_text + + +class NetworkModule(AnsibleModule): + + fail_on_missing_provider = True + + def __init__(self, connection=None, *args, **kwargs): + super(NetworkModule, self).__init__(*args, **kwargs) + + if connection is None: + connection = Connection(self._socket_path) + + self.connection = connection + + @property + def provider(self): + if not hasattr(self, "_provider"): + capabilities = self.from_json(self.connection.get_capabilities()) + + network_os = capabilities["device_info"]["network_os"] + network_api = capabilities["network_api"] + + if network_api == "cliconf": + connection_type = "network_cli" + + cls = providers.get( + network_os, self._name.split(".")[-1], connection_type + ) + + if not cls: + msg = ( + "unable to find suitable provider for network os %s" + % network_os + ) + if self.fail_on_missing_provider: + self.fail_json(msg=msg) + else: + self.warn(msg) + + obj = cls(self.params, self.connection, self.check_mode) + + setattr(self, "_provider", obj) + + return getattr(self, "_provider") + + def get_facts(self, subset=None): + try: + self.provider.get_facts(subset) + except Exception as exc: + self.fail_json(msg=to_text(exc)) + + def edit_config(self, config_filter=None): + current_config = self.connection.get_config(flags=config_filter) + try: + commands = self.provider.edit_config(current_config) + changed = bool(commands) + return {"commands": commands, "changed": changed} + except Exception as exc: + self.fail_json(msg=to_text(exc)) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/providers.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/providers.py new file mode 100644 index 00000000..fdf99cb3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/providers/providers.py @@ -0,0 +1,129 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# 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 + +import json + +from threading import RLock + +from ansible.module_utils.six import itervalues +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + to_list, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( + NetworkConfig, +) + + +_registered_providers = {} +_provider_lock = RLock() + + +def register_provider(network_os, module_name): + def wrapper(cls): + _provider_lock.acquire() + try: + if network_os not in _registered_providers: + _registered_providers[network_os] = {} + for ct in cls.supported_connections: + if ct not in _registered_providers[network_os]: + _registered_providers[network_os][ct] = {} + for item in to_list(module_name): + for entry in itervalues(_registered_providers[network_os]): + entry[item] = cls + finally: + _provider_lock.release() + return cls + + return wrapper + + +def get(network_os, module_name, connection_type): + network_os_providers = _registered_providers.get(network_os) + if network_os_providers is None: + raise ValueError("unable to find a suitable provider for this module") + if connection_type not in network_os_providers: + raise ValueError("provider does not support this connection type") + elif module_name not in network_os_providers[connection_type]: + raise ValueError("could not find a suitable provider for this module") + return network_os_providers[connection_type][module_name] + + +class ProviderBase(object): + + supported_connections = () + + def __init__(self, params, connection=None, check_mode=False): + self.params = params + self.connection = connection + self.check_mode = check_mode + + @property + def capabilities(self): + if not hasattr(self, "_capabilities"): + resp = self.from_json(self.connection.get_capabilities()) + setattr(self, "_capabilities", resp) + return getattr(self, "_capabilities") + + def get_value(self, path): + params = self.params.copy() + for key in path.split("."): + params = params[key] + return params + + def get_facts(self, subset=None): + raise NotImplementedError(self.__class__.__name__) + + def edit_config(self): + raise NotImplementedError(self.__class__.__name__) + + +class CliProvider(ProviderBase): + + supported_connections = ("network_cli",) + + @property + def capabilities(self): + if not hasattr(self, "_capabilities"): + resp = self.from_json(self.connection.get_capabilities()) + setattr(self, "_capabilities", resp) + return getattr(self, "_capabilities") + + def get_config_context(self, config, path, indent=1): + if config is not None: + netcfg = NetworkConfig(indent=indent, contents=config) + try: + config = netcfg.get_block_config(to_list(path)) + except ValueError: + config = None + return config + + def render(self, config=None): + raise NotImplementedError(self.__class__.__name__) + + def cli(self, command): + try: + if not hasattr(self, "_command_output"): + setattr(self, "_command_output", {}) + return self._command_output[command] + except KeyError: + out = self.connection.get(command) + try: + out = json.loads(out) + except ValueError: + pass + self._command_output[command] = out + return out + + def get_facts(self, subset=None): + return self.populate() + + def edit_config(self, config=None): + commands = self.render(config) + if commands and self.check_mode is False: + self.connection.edit_config(commands) + return commands diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/rm_templates/acls.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/rm_templates/acls.py new file mode 100644 index 00000000..c57c5ffd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/rm_templates/acls.py @@ -0,0 +1,231 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +def _tmplt_access_list_name(config_data): + command = "access-list {acls_name} ".format(**config_data) + return command + + +def _tmplt_access_list_entries(config_data): + if "aces" in config_data: + command = [] + + def source_destination_common_config(config_data, cmd, type): + if config_data["aces"][type].get("any"): + cmd += " any" + elif config_data["aces"][type].get("any4"): + cmd += " any4" + elif config_data["aces"][type].get("any6"): + cmd += " any6" + elif config_data["aces"][type].get("address"): + cmd += " {address}".format(**config_data["aces"][type]) + if config_data["aces"][type].get("netmask"): + cmd += " {netmask}".format(**config_data["aces"][type]) + elif config_data["aces"][type].get("host"): + cmd += " host {host}".format(**config_data["aces"][type]) + elif config_data["aces"][type].get("interface"): + cmd += " interface {interface}".format( + **config_data["aces"][type] + ) + elif config_data["aces"][type].get("object_group"): + cmd += " object-group {object_group}".format( + **config_data["aces"][type] + ) + if config_data["aces"].get("protocol_options"): + protocol_option_key = list( + config_data["aces"]["protocol_options"] + )[0] + if ( + isinstance( + config_data["aces"]["protocol_options"][ + protocol_option_key + ], + dict, + ) + and type == "destination" + ): + val = list( + config_data["aces"]["protocol_options"][ + protocol_option_key + ] + )[0] + cmd += " {0}".format(val.replace("_", "-")) + if config_data["aces"][type].get("port_protocol"): + port_protocol = list( + config_data["aces"][type]["port_protocol"] + )[0] + cmd += ( + " " + + port_protocol + + " " + + config_data["aces"][type]["port_protocol"][port_protocol] + ) + return cmd + + cmd = "" + if config_data["aces"].get("remark"): + command.append( + "access-list {name} line {line} remark {remark}".format( + **config_data["aces"] + ) + ) + if len(config_data["aces"]) > 4: + cmd = "access-list {name} line {line}".format( + **config_data["aces"] + ) + if ( + config_data["aces"].get("acl_type") + and config_data["aces"].get("acl_type") != "standard" + ): + cmd += " {acl_type}".format(**config_data["aces"]) + if config_data["aces"].get("grant"): + cmd += " {grant}".format(**config_data["aces"]) + if config_data["aces"].get("protocol_options"): + if ( + "protocol_number" + in config_data["aces"]["protocol_options"] + ): + cmd += " {protocol_number}".format( + **config_data["aces"]["protocol_options"] + ) + else: + cmd += " {0}".format( + list(config_data["aces"]["protocol_options"])[0] + ) + elif config_data["aces"].get("protocol"): + cmd += " {protocol}".format(**config_data["aces"]) + if config_data["aces"].get("source"): + cmd = source_destination_common_config( + config_data, cmd, "source" + ) + if config_data["aces"].get("destination"): + cmd = source_destination_common_config( + config_data, cmd, "destination" + ) + if config_data["aces"].get("log"): + cmd += " log {log}".format(**config_data["aces"]) + if config_data["aces"].get("inactive"): + cmd += " inactive" + if config_data["aces"].get("time_range"): + cmd += " time-range {time_range}".format(**config_data["aces"]) + if cmd: + command.append(cmd) + return command + + +class AclsTemplate(NetworkTemplate): + def __init__(self, lines=None): + super(AclsTemplate, self).__init__(lines=lines, tmplt=self) + + PARSERS = [ + { + "name": "acls_name", + "getval": re.compile( + r"""^access-list* + \s*(?P<acl_name>\S+); + \s*\S+\s*elements; + """, + re.VERBOSE, + ), + "setval": _tmplt_access_list_name, + "compval": "name", + "result": {"acls": {"{{ acl_name }}": {"name": "{{ acl_name }}"}}}, + "shared": True, + }, + { + "name": "aces", + "getval": re.compile( + r"""^access-list* + \s*(?P<acl_name>\S+)* + \s*(?P<line>line\s\d+)* + \s*(?P<remark>remark\s\S.*)* + \s*(?P<ethertype>ethertype)* + \s*(?P<webtype>webtype)* + \s*(?P<acl_type>extended|standard)* + \s*(?P<grant>deny|permit)* + \s*(?P<ethertype_params>(dsap\s\S+)|bpdu|eii-ipx|ipx|mpls-unicast|mpls-multicast|isis|any\s)* + \s*(?P<std_dest>(host\s\S+)|any4|(?:[0-9]{1,3}\.){3}[0-9]{1,3}\s(?:[0-9]{1,3}\.){3}[0-9]{1,3})* + \s*(?P<protocol>ah|eigrp|esp|gre|icmp|icmp6|igmp|igrp|ip|ipinip|ipsec|nos|ospf|pcp|pim|pptp|sctp|snp|tcp|udp)* + \s*(?P<protocol_num>\d+\s)* + \s*(?P<source>any4|any6|any|(?:[0-9]{1,3}\.){3}[0-9]{1,3}\s(?:[0-9]{1,3}\.){3}[0-9]{1,3}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\S+|host\s(?:[0-9]{1,3}\.){3}[0-9]{1,3}|interface\s\S+|object-group\s\S+)* + \s*(?P<source_port_protocol>(eq|gts|lt|neq)\s(\S+|\d+))* + \s*(?P<destination>any4|any6|any|(?:[0-9]{1,3}\.){3}[0-9]{1,3}\s(?:[0-9]{1,3}\.){3}[0-9]{1,3}|(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\S+|host\s(?:[0-9]{1,3}\.){3}[0-9]{1,3}|interface\s\S+|object-group\s\S+)* + \s*(?P<dest_port_protocol>(eq|gts|lt|neq)\s(\S+|\d+))* + \s*(?P<icmp_icmp6_protocol>alternate-address|conversion-error|echo|echo-reply|information-reply|information-request|mask-reply|mask-request|membership-query|membership-reduction|membership-report|mobile-redirect|neighbor-advertisement|neighbor-redirect|neighbor-solicitation|parameter-problem|packet-too-big|redirect|router-advertisement|router-renumbering|router-solicitation|source-quench|source-route-failed|time-exceeded|timestamp-reply|timestamp-request|traceroute|unreachable)* + \s*(?P<log>log\s\S+)* + \s*(?P<time_range>time-range\s\S+)* + \s*(?P<inactive>inactive)* + """, + re.VERBOSE, + ), + "setval": _tmplt_access_list_entries, + "result": { + "acls": { + "{{ acl_name }}": { + "name": "{{ acl_name }}", + "acl_type": "{{ acl_type if acl_type is defined }}", + "aces": [ + { + "grant": "{{ grant }}", + "line": "{{ line.split(' ')[1] if line is defined }}", + "remark": "{{ remark.split('remark ')[1] if remark is defined }}", + "protocol": "{{ protocol if protocol is defined else None }}", + "protocol_number": "{{ protocol_num if protocol_num is defined }}", + "icmp_icmp6_protocol": "{{ icmp_icmp6_protocol if icmp_icmp6_protocol is defined else None }}", + "source": { + "address": "{% if source is defined and '.' in source and 'host'\ + not in source %}{{ source.split(' ')[0] }}{% elif source is defined and\ + '::' in source %}{{ source }}{% endif %}", + "netmask": "{{ source.split(' ')[1] if source is defined and '.' in source and 'host' not in source else None }}", + "any4": "{{ True if source is defined and source == 'any4' else None }}", + "any6": "{{ True if source is defined and source == 'any6' else None }}", + "any": "{{ True if source is defined and source == 'any' else None }}", + "host": "{{ source.split(' ')[1] if source is defined and 'host' in source else None }}", + "interface": "{{ source.split(' ')[1] if source is defined and 'interface' in source else None }}", + "object_group": "{{ source.split(' ')[1] if source is defined and 'object-group' in source else None }}", + "port_protocol": { + "{{ source_port_protocol.split(' ')[0] if source_port_protocol\ + is defined else None }}": "{{ source_port_protocol.split(' ')[1]\ + if source_port_protocol is defined else None }}" + }, + }, + "destination": { + "address": "{% if destination is defined and\ + '.' in destination %}{{ destination.split(' ')[0] }}{% elif std_dest is defined and\ + '.' in std_dest and 'host' not in std_dest %}{{ std_dest.split(' ')[0] }}{% elif destination is defined and\ + '::' in destination %}{{ destination }}{% endif %}", + "netmask": "{% if destination is defined and\ + '.' in destination %}{{ destination.split(' ')[1] }}{% elif std_dest is defined and\ + '.' in std_dest and 'host' not in std_dest %}{{ std_dest.split(' ')[1] }}{% endif %}", + "any4": "{% if destination is defined and\ + destination == 'any4' %}{{ True }}{% elif std_dest is defined and std_dest == 'any4' %}{{ True }}{% endif %}", + "any6": "{{ True if destination is defined and destination == 'any6' else None }}", + "any": "{{ True if destination is defined and destination == 'any' else None }}", + "host": "{% if destination is defined and\ + 'host' in destination %}{{ source_host.split(' ')[1] }}{% elif std_dest is defined and\ + 'host' in std_dest %}{{ std_dest.split(' ')[1] }}{% endif %}", + "interface": "{{ destination.split(' ')[1] if destination is defined and 'interface' in destination else None }}", + "object_group": "{{ destination.split(' ')[1] if destination is defined and 'object-group' in destination else None }}", + "port_protocol": { + "{{ dest_port_protocol.split(' ')[0] if dest_port_protocol\ + is defined else None }}": "{{ dest_port_protocol.split(' ')[1]\ + if dest_port_protocol is defined else None }}" + }, + }, + "inactive": "{{ True if inactive is defined }}", + "log": "{{ log.split('log ')[1] if log is defined }}", + "time_range": "{{ time_range if time_range is defined }}", + } + ], + } + } + }, + }, + ] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/rm_templates/ogs.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/rm_templates/ogs.py new file mode 100644 index 00000000..ed196fdf --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/rm_templates/ogs.py @@ -0,0 +1,400 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import re +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template import ( + NetworkTemplate, +) + + +def _tmplt_object_group(config_data): + command = "object-group {object_type} {name}".format(**config_data) + return command + + +def _tmplt_icmp_object(config_data): + commands = [] + if config_data.get("icmp_type").get("icmp_object"): + for each in config_data.get("icmp_type").get("icmp_object"): + commands.append("icmp-object {0}".format(each)) + return commands + + +def _tmplt_network_object(config_data): + commands = [] + if config_data.get("network_object").get("host"): + for each in config_data.get("network_object").get("host"): + commands.append("network-object host {0}".format(each)) + return commands + + +def _tmplt_network_object_address(config_data): + commands = [] + if config_data.get("network_object").get("address"): + for each in config_data.get("network_object").get("address"): + commands.append("network-object {0}".format(each)) + return commands + + +def _tmplt_network_object_ipv6(config_data): + commands = [] + if config_data.get("network_object").get("ipv6_address"): + for each in config_data.get("network_object").get("ipv6_address"): + commands.append("network-object {0}".format(each)) + return commands + + +def _tmplt_protocol_object(config_data): + commands = [] + if config_data.get("protocol_object").get("protocol"): + for each in config_data.get("protocol_object").get("protocol"): + commands.append("protocol {0}".format(each)) + return commands + + +def _tmplt_sec_group_name(config_data): + commands = [] + if config_data.get("security_group").get("sec_name"): + for each in config_data.get("security_group").get("sec_name"): + commands.append("security-group name {0}".format(each)) + return commands + + +def _tmplt_sec_group_tag(config_data): + commands = [] + if config_data.get("security_group").get("tag"): + for each in config_data.get("security_group").get("tag"): + commands.append("security-group tag {0}".format(each)) + return commands + + +def _tmplt_service_object(config_data): + if config_data.get("service_object").get("protocol"): + commands = [] + for each in config_data.get("service_object").get("protocol"): + commands.append("service-object {0}".format(each)) + return commands + + +def _tmplt_user_object_user(config_data): + commands = [] + if config_data.get("user_object").get("user"): + for each in config_data.get("user_object").get("user"): + commands.append("user {domain}\\{name}".format(**each)) + return commands + + +def _tmplt_user_object_user_gp(config_data): + commands = [] + if config_data.get("user_object").get("user_group"): + for each in config_data.get("user_object").get("user_group"): + commands.append("user-group {domain}\\{name} {0}".format(**each)) + return commands + + +def _tmplt_group_object(config_data): + command = "group-object { group_object }".format(**config_data) + return command + + +class OGsTemplate(NetworkTemplate): + def __init__(self, lines=None): + super(OGsTemplate, self).__init__(lines=lines, tmplt=self) + + PARSERS = [ + { + "name": "og_name", + "getval": re.compile( + r""" + ^object-group* + \s*(?P<obj_type>\S+)* + \s*(?P<obj_name>\S+) + $""", + re.VERBOSE, + ), + "setval": _tmplt_object_group, + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": { + "object_type": "{{ obj_type }}", + "name": "{{ obj_name }}", + } + } + } + }, + "shared": True, + }, + { + "name": "description", + "getval": re.compile( + r"""\s+description:* + \s*(?P<description>.+) + *$""", + re.VERBOSE, + ), + "setval": "description {{ description }}", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"description": "{{ description }}"} + } + } + }, + }, + { + "name": "icmp_type", + "getval": re.compile( + r"""\s+icmp-object* + \s*(?P<object>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_icmp_object, + "compval": "icmp_type", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"icmp_object": ["{{ object }}"]} + } + } + }, + }, + { + "name": "network_object.address", + "getval": re.compile( + r"""\s+network-object* + \s*(?P<address>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_network_object_address, + "compval": "network_object.address", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"address": ["{{ address }}"]} + } + } + }, + }, + { + "name": "network_object.host", + "getval": re.compile( + r"""\s+network-object* + \s*(?P<host_obj>host)* + \s*(?P<host_address>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_network_object, + "compval": "network_object.host", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"host": ["{{ host_address }}"]} + } + } + }, + }, + { + "name": "network_object.ipv6_address", + "getval": re.compile( + r"""\s+network-object* + \s*(?P<ipv6>\S+::/\d+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_network_object_ipv6, + "compval": "network_object.ipv6_address", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"ipv6_address": ["{{ ipv6 }}"]} + } + } + }, + }, + { + "name": "network_object.object", + "getval": re.compile( + r"""\s+network-object\s + object* + \s*(?P<object>\S+) + *$""", + re.VERBOSE, + ), + "setval": "network-object object {{ object }}", + "compval": "network_object.object", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"object": "{{ object }}"} + } + } + }, + }, + { + "name": "protocol_object", + "getval": re.compile( + r"""\s+protocol-object* + \s*(?P<protocol>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_protocol_object, + "compval": "protocol_object", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"protocol": ["{{ protocol }}"]} + } + } + }, + }, + { + "name": "security_group.sec_name", + "getval": re.compile( + r"""\s+security-group\s + name* + \s*(?P<name>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_sec_group_name, + "compval": "security_group.sec_name", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"sec_name": ["{{ name }}"]} + } + } + }, + }, + { + "name": "security_group.tag", + "getval": re.compile( + r"""\s+security-group\s + tag* + \s*(?P<tag>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_sec_group_tag, + "compval": "security_group.tag", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"tag": ["{{ tag }}"]} + } + } + }, + }, + { + "name": "service_object", + "getval": re.compile( + r"""\s+service-object* + \s*(?P<protocol>\S+)*\s + *$""", + re.VERBOSE, + ), + "setval": _tmplt_service_object, + "compval": "service_object", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"protocol": ["{{ protocol }}"]} + } + } + }, + }, + { + "name": "service_object.object", + "getval": re.compile( + r"""\s+service-object\s + object* + \s*(?P<object>\S+) + *$""", + re.VERBOSE, + ), + "setval": "service-object object {{ object }}", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"object": "{{ object }}"} + } + } + }, + }, + { + "name": "user_object.user", + "getval": re.compile( + r"""\s+user* + \s*(?P<domain>\S+)\\ + (?P<user_name>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_user_object_user, + "compval": "user_object", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": { + "user": [ + { + "name": "{{ user_name }}", + "domain": "{{ domain }}", + } + ] + } + } + } + }, + }, + { + "name": "user_object.user_gp", + "getval": re.compile( + r"""\s+user-group* + \s*(?P<domain>\S+)\\ + (?P<user_gp>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_user_object_user_gp, + "compval": "user_object", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": { + "user_group": [ + { + "name": "{{ user_gp }}", + "domain": "{{ domain }}", + } + ] + } + } + } + }, + }, + { + "name": "group_object", + "getval": re.compile( + r"""\s+group-object* + \s*(?P<gp_obj>\S+) + *$""", + re.VERBOSE, + ), + "setval": _tmplt_group_object, + "compval": "group_object", + "result": { + "ogs": { + "{{ obj_type }}": { + "{{ obj_name }}": {"group_object": "{{ gp_obj }}"} + } + } + }, + }, + ] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/utils/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/utils/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/utils/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/utils/utils.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/utils/utils.py new file mode 100644 index 00000000..5dd85312 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/module_utils/network/asa/utils/utils.py @@ -0,0 +1,330 @@ +# +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# utils + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import socket +from ansible.module_utils.six import iteritems +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + is_masklen, + to_netmask, +) + + +def remove_duplicate_cmd(cmd, commands): + # Remove duplicate interface from commands + set_cmd = [] + for each in commands: + if cmd in each: + if each not in set_cmd: + set_cmd.append(each) + else: + set_cmd.append(each) + + return set_cmd + + +def remove_command_from_config_list(interface, cmd, commands): + # To delete the passed config + if interface not in commands: + commands.insert(0, interface) + commands.append("no %s" % cmd) + return commands + + +def add_command_to_config_list(interface, cmd, commands): + # To set the passed config + if interface not in commands: + commands.insert(0, interface) + commands.append(cmd) + + +def check_n_return_valid_ipv6_addr(module, input_list, filtered_ipv6_list): + # To verify the valid ipv6 address + try: + for each in input_list: + if "::" in each: + if "/" in each: + each = each.split("/")[0] + if socket.inet_pton(socket.AF_INET6, each): + filtered_ipv6_list.append(each) + return filtered_ipv6_list + except socket.error: + module.fail_json(msg="Incorrect IPV6 address!") + + +def new_dict_to_set(input_dict, temp_list, test_set, count=0): + # recursive function to convert input dict to set for comparision + test_dict = dict() + if isinstance(input_dict, dict): + input_dict_len = len(input_dict) + for k, v in sorted(iteritems(input_dict)): + count += 1 + if isinstance(v, list): + temp_list.append(k) + for each in v: + if isinstance(each, dict): + if [True for i in each.values() if type(i) == list]: + new_dict_to_set(each, temp_list, test_set, count) + else: + new_dict_to_set(each, temp_list, test_set, 0) + else: + if v is not None: + test_dict.update({k: v}) + try: + if ( + tuple(iteritems(test_dict)) not in test_set + and count == input_dict_len + ): + test_set.add(tuple(iteritems(test_dict))) + count = 0 + except TypeError: + temp_dict = {} + + def expand_dict(dict_to_expand): + temp = dict() + for k, v in iteritems(dict_to_expand): + if isinstance(v, dict): + expand_dict(v) + else: + if v is not None: + temp.update({k: v}) + temp_dict.update(tuple(iteritems(temp))) + + new_dict = {k: v} + expand_dict(new_dict) + if tuple(iteritems(temp_dict)) not in test_set: + test_set.add(tuple(iteritems(temp_dict))) + + +def dict_to_set(sample_dict): + # Generate a set with passed dictionary for comparison + test_dict = dict() + if isinstance(sample_dict, dict): + for k, v in iteritems(sample_dict): + if v is not None: + if isinstance(v, list): + if isinstance(v[0], dict): + li = [] + for each in v: + for key, value in iteritems(each): + if isinstance(value, list): + each[key] = tuple(value) + li.append(tuple(iteritems(each))) + v = tuple(li) + else: + v = tuple(v) + elif isinstance(v, dict): + li = [] + for key, value in iteritems(v): + if isinstance(value, list): + v[key] = tuple(value) + li.extend(tuple(iteritems(v))) + v = tuple(li) + test_dict.update({k: v}) + return_set = set(tuple(iteritems(test_dict))) + else: + return_set = set(sample_dict) + return return_set + + +def filter_dict_having_none_value(want, have): + # Generate dict with have dict value which is None in want dict + test_dict = dict() + test_key_dict = dict() + name = want.get("name") + if name: + test_dict["name"] = name + diff_ip = False + want_ip = "" + for k, v in iteritems(want): + if isinstance(v, dict): + for key, value in iteritems(v): + if value is None: + dict_val = have.get(k).get(key) + test_key_dict.update({key: dict_val}) + test_dict.update({k: test_key_dict}) + if isinstance(v, list): + for key, value in iteritems(v[0]): + if value is None: + dict_val = have.get(k).get(key) + test_key_dict.update({key: dict_val}) + test_dict.update({k: test_key_dict}) + # below conditions checks are added to check if + # secondary IP is configured, if yes then delete + # the already configured IP if want and have IP + # is different else if it's same no need to delete + for each in v: + if each.get("secondary"): + want_ip = each.get("address").split("/") + have_ip = have.get("ipv4") + if ( + len(want_ip) > 1 + and have_ip + and have_ip[0].get("secondary") + ): + have_ip = have_ip[0]["address"].split(" ")[0] + if have_ip != want_ip[0]: + diff_ip = True + if each.get("secondary") and diff_ip is True: + test_key_dict.update({"secondary": True}) + test_dict.update({"ipv4": test_key_dict}) + if v is None: + val = have.get(k) + test_dict.update({k: val}) + return test_dict + + +def remove_duplicate_interface(commands): + # Remove duplicate interface from commands + set_cmd = [] + for each in commands: + if "interface" in each: + if each not in set_cmd: + set_cmd.append(each) + else: + set_cmd.append(each) + + return set_cmd + + +def validate_ipv4(value, module): + if value: + address = value.split("/") + if len(address) != 2: + module.fail_json( + msg="address format is <ipv4 address>/<mask>, got invalid format {0}".format( + value + ) + ) + + if not is_masklen(address[1]): + module.fail_json( + msg="invalid value for mask: {0}, mask should be in range 0-32".format( + address[1] + ) + ) + + +def validate_ipv6(value, module): + if value: + address = value.split("/") + if len(address) != 2: + module.fail_json( + msg="address format is <ipv6 address>/<mask>, got invalid format {0}".format( + value + ) + ) + else: + if not 0 <= int(address[1]) <= 128: + module.fail_json( + msg="invalid value for mask: {0}, mask should be in range 0-128".format( + address[1] + ) + ) + + +def validate_n_expand_ipv4(module, want): + # Check if input IPV4 is valid IP and expand IPV4 with its subnet mask + ip_addr_want = want.get("address") + if len(ip_addr_want.split(" ")) > 1: + return ip_addr_want + validate_ipv4(ip_addr_want, module) + ip = ip_addr_want.split("/") + if len(ip) == 2: + ip_addr_want = "{0} {1}".format(ip[0], to_netmask(ip[1])) + + return ip_addr_want + + +def normalize_interface(name): + """Return the normalized interface name + """ + if not name: + return + + def _get_number(name): + digits = "" + for char in name: + if char.isdigit() or char in "/.": + digits += char + return digits + + if name.lower().startswith("gi"): + if_type = "GigabitEthernet" + elif name.lower().startswith("te"): + if_type = "TenGigabitEthernet" + elif name.lower().startswith("fa"): + if_type = "FastEthernet" + elif name.lower().startswith("fo"): + if_type = "FortyGigabitEthernet" + elif name.lower().startswith("long"): + if_type = "LongReachEthernet" + elif name.lower().startswith("et"): + if_type = "Ethernet" + elif name.lower().startswith("vl"): + if_type = "Vlan" + elif name.lower().startswith("lo"): + if_type = "loopback" + elif name.lower().startswith("po"): + if_type = "Port-channel" + elif name.lower().startswith("nv"): + if_type = "nve" + elif name.lower().startswith("twe"): + if_type = "TwentyFiveGigE" + elif name.lower().startswith("hu"): + if_type = "HundredGigE" + else: + if_type = None + + number_list = name.split(" ") + if len(number_list) == 2: + number = number_list[-1].strip() + else: + number = _get_number(name) + + if if_type: + proper_interface = if_type + number + else: + proper_interface = name + + return proper_interface + + +def get_interface_type(interface): + """Gets the type of interface + """ + + if interface.upper().startswith("GI"): + return "GigabitEthernet" + elif interface.upper().startswith("TE"): + return "TenGigabitEthernet" + elif interface.upper().startswith("FA"): + return "FastEthernet" + elif interface.upper().startswith("FO"): + return "FortyGigabitEthernet" + elif interface.upper().startswith("LON"): + return "LongReachEthernet" + elif interface.upper().startswith("ET"): + return "Ethernet" + elif interface.upper().startswith("VL"): + return "Vlan" + elif interface.upper().startswith("LO"): + return "loopback" + elif interface.upper().startswith("PO"): + return "Port-channel" + elif interface.upper().startswith("NV"): + return "nve" + elif interface.upper().startswith("TWE"): + return "TwentyFiveGigE" + elif interface.upper().startswith("HU"): + return "HundredGigE" + else: + return "unknown" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_acl.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_acl.py new file mode 100644 index 00000000..a73bcc4a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_acl.py @@ -0,0 +1,235 @@ +#!/usr/bin/python +# +# Copyright: Ansible Project +# 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 + + +DOCUMENTATION = """ +module: asa_acl +author: Patrick Ogenstad (@ogenstad) +short_description: (deprecated, removed after 2022-06-01) Manage access-lists on a + Cisco ASA +description: +- This module allows you to work with access-lists on a Cisco ASA device. +version_added: 1.0.0 +deprecated: + alternative: asa_acl + why: Newer and updated modules released with more functionality in Ansible 2.10 + removed_at_date: '2022-06-01' +extends_documentation_fragment: +- cisco.asa.asa +options: + lines: + description: + - The ordered set of commands that should be configured in the section. The commands + must be the exact same commands as found in the device running-config. Be sure + to note the configuration command syntax as some commands are automatically + modified by the device config parser. + required: true + aliases: + - commands + type: list + elements: str + before: + description: + - The ordered set of commands to push on to the command stack if a change needs + to be made. This allows the playbook designer the opportunity to perform configuration + commands prior to pushing any changes without affecting how the set of commands + are matched against the system. + type: list + elements: str + after: + description: + - The ordered set of commands to append to the end of the command stack if a changed + needs to be made. Just like with I(before) this allows the playbook designer + to append a set of commands to be executed after the command set. + type: list + elements: str + match: + description: + - Instructs the module on the way to perform the matching of the set of commands + against the current device config. If match is set to I(line), commands are + matched line by line. If match is set to I(strict), command lines are matched + with respect to position. Finally if match is set to I(exact), command lines + must be an equal match. + default: line + choices: + - line + - strict + - exact + type: str + replace: + description: + - Instructs the module on the way to perform the configuration on the device. If + the replace argument is set to I(line) then the modified lines are pushed to + the device in configuration mode. If the replace argument is set to I(block) + then the entire command block is pushed to the device in configuration mode + if any line is not correct. + default: line + choices: + - line + - block + type: str + force: + description: + - The force argument instructs the module to not consider the current devices + running-config. When set to true, this will cause the module to push the contents + of I(src) into the device without first checking if already configured. + type: bool + default: no + config: + description: + - The module, by default, will connect to the remote device and retrieve the current + running-config to use as a base for comparing against the contents of source. There + are times when it is not desirable to have the task get the current running-config + for every task in a playbook. The I(config) argument allows the implementer + to pass in the configuration to use as the base config for comparison. + type: str +""" + +EXAMPLES = """ +- cisco.asa.asa_acl: + lines: + - access-list ACL-ANSIBLE extended permit tcp any any eq 82 + - access-list ACL-ANSIBLE extended permit tcp any any eq www + - access-list ACL-ANSIBLE extended permit tcp any any eq 97 + - access-list ACL-ANSIBLE extended permit tcp any any eq 98 + - access-list ACL-ANSIBLE extended permit tcp any any eq 99 + before: clear configure access-list ACL-ANSIBLE + match: strict + replace: block + provider: '{{ cli }}' + +- cisco.asa.asa_acl: + lines: + - access-list ACL-OUTSIDE extended permit tcp any any eq www + - access-list ACL-OUTSIDE extended permit tcp any any eq https + context: customer_a + provider: '{{ cli }}' +""" + +RETURN = """ +updates: + description: The set of commands that will be pushed to the remote device + returned: always + type: list + sample: ['access-list ACL-OUTSIDE extended permit tcp any any eq www'] +""" +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + asa_argument_spec, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + get_config, + load_config, +) + +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( + NetworkConfig, + dumps, +) + + +def get_acl_config(module, acl_name): + contents = module.params["config"] + if not contents: + contents = get_config(module) + + filtered_config = list() + for item in contents.split("\n"): + if item.startswith("access-list %s " % acl_name): + filtered_config.append(item) + + return NetworkConfig(indent=1, contents="\n".join(filtered_config)) + + +def parse_acl_name(module): + first_line = True + for line in module.params["lines"]: + ace = line.split() + if ace[0] != "access-list": + module.fail_json( + msg='All lines/commands must begin with "access-list" %s is not permitted' + % ace[0] + ) + if len(ace) <= 1: + module.fail_json( + msg="All lines/commands must contain the name of the access-list" + ) + if first_line: + acl_name = ace[1] + else: + if acl_name != ace[1]: + module.fail_json( + msg="All lines/commands must use the same access-list %s is not %s" + % (ace[1], acl_name) + ) + first_line = False + + return acl_name + + +def main(): + + argument_spec = dict( + lines=dict( + aliases=["commands"], required=True, type="list", elements="str" + ), + before=dict(type="list", elements="str"), + after=dict(type="list", elements="str"), + match=dict( + default="line", choices=["line", "strict", "exact"], type="str" + ), + replace=dict(default="line", choices=["line", "block"], type="str"), + force=dict(default=False, type="bool"), + config=dict(type="str"), + ) + + argument_spec.update(asa_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + lines = module.params["lines"] + + result = {"changed": False} + if len(lines) > 0: + candidate = NetworkConfig(indent=1) + candidate.add(lines) + + acl_name = parse_acl_name(module) + + if not module.params["force"]: + contents = get_acl_config(module, acl_name) + config = NetworkConfig(indent=1, contents=contents) + + commands = candidate.difference(config) + commands = dumps(commands, "commands").split("\n") + commands = [str(c) for c in commands if c] + else: + commands = str(candidate).split("\n") + + if commands: + if module.params["before"]: + commands[:0] = module.params["before"] + + if module.params["after"]: + commands.extend(module.params["after"]) + + if not module.check_mode: + load_config(module, commands) + + result["changed"] = True + + result["updates"] = commands + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_acls.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_acls.py new file mode 100644 index 00000000..dfcaf159 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_acls.py @@ -0,0 +1,1258 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for asa_acls +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: asa_acls +short_description: Access-Lists resource module +description: This module configures and manages the named or numbered ACLs on ASA + platforms. +version_added: 1.0.0 +author: Sumit Jaiswal (@justjais) +notes: +- Tested against Cisco ASA Version 9.10(1)11 +- This module works with connection C(network_cli). See L(ASA Platform Options,../network/user_guide/platform_asa.html). +options: + config: + description: A dictionary of ACL options. + type: dict + suboptions: + acls: + description: + - A list of Access Control Lists (ACL). + type: list + elements: dict + suboptions: + name: + description: The name or the number of the ACL. + required: true + type: str + acl_type: + description: + - ACL type + type: str + choices: + - extended + - standard + rename: + description: + - Rename an existing access-list. + - If input to rename param is given, it'll take preference over other + parameters and only rename config will be matched and computed against. + type: str + aces: + description: The entries within the ACL. + elements: dict + type: list + suboptions: + grant: + description: Specify the action. + type: str + choices: + - permit + - deny + line: + description: + - Use this to specify line number at which ACE should be entered. + - Existing ACE can be updated based on the input line number. + - It's not a required param in case of configuring the acl, but in + case of Delete operation it's required, else Delete operation won't + work as expected. + - Refer to vendor documentation for valid values. + type: int + remark: + description: + - Specify a comment (remark) for the access-list after this keyword + type: str + protocol: + description: + - Specify the protocol to match. + - Refer to vendor documentation for valid values. + type: str + protocol_options: + description: protocol type. + type: dict + suboptions: + protocol_number: + description: An IP protocol number + type: int + ahp: + description: Authentication Header Protocol. + type: bool + eigrp: + description: Cisco's EIGRP routing protocol. + type: bool + esp: + description: Encapsulation Security Payload. + type: bool + gre: + description: Cisco's GRE tunneling. + type: bool + icmp: + description: Internet Control Message Protocol. + type: dict + suboptions: + alternate_address: + description: Alternate address + type: bool + conversion_error: + description: Datagram conversion + type: bool + echo: + description: Echo (ping) + type: bool + echo_reply: + description: Echo reply + type: bool + information_reply: + description: Information replies + type: bool + information_request: + description: Information requests + type: bool + mask_reply: + description: Mask replies + type: bool + mask_request: + description: mask_request + type: bool + mobile_redirect: + description: Mobile host redirect + type: bool + parameter_problem: + description: All parameter problems + type: bool + redirect: + description: All redirects + type: bool + router_advertisement: + description: Router discovery advertisements + type: bool + router_solicitation: + description: Router discovery solicitations + type: bool + source_quench: + description: Source quenches + type: bool + source_route_failed: + description: Source route + type: bool + time_exceeded: + description: All time exceededs + type: bool + timestamp_reply: + description: Timestamp replies + type: bool + timestamp_request: + description: Timestamp requests + type: bool + traceroute: + description: Traceroute + type: bool + unreachable: + description: All unreachables + type: bool + icmp6: + description: Internet Control Message Protocol. + type: dict + suboptions: + echo: + description: Echo (ping) + type: bool + echo_reply: + description: Echo reply + type: bool + membership_query: + description: Membership query + type: bool + membership_reduction: + description: Membership reduction + type: bool + membership_report: + description: Membership report + type: bool + neighbor_advertisement: + description: Neighbor advertisement + type: bool + neighbor_redirect: + description: Neighbor redirect + type: bool + neighbor_solicitation: + description: Neighbor_solicitation + type: bool + packet_too_big: + description: Packet too big + type: bool + parameter_problem: + description: Parameter problem + type: bool + router_advertisement: + description: Router discovery advertisements + type: bool + router_renumbering: + description: Router renumbering + type: bool + router_solicitation: + description: Router solicitation + type: bool + time_exceeded: + description: Time exceeded + type: bool + unreachable: + description: All unreachables + type: bool + igmp: + description: Internet Gateway Message Protocol. + type: bool + igrp: + description: Internet Gateway Routing Protocol. + type: bool + ip: + description: Any Internet Protocol. + type: bool + ipinip: + description: IP in IP tunneling. + type: bool + ipsec: + description: IP Security. + type: bool + nos: + description: KA9Q NOS compatible IP over IP tunneling. + type: bool + ospf: + description: OSPF routing protocol. + type: bool + pcp: + description: Payload Compression Protocol. + type: bool + pim: + description: Protocol Independent Multicast. + type: bool + pptp: + description: Point-to-Point Tunneling Protocol. + type: bool + sctp: + description: Stream Control Transmission Protocol. + type: bool + snp: + description: Simple Network Protocol. + type: bool + udp: + description: User Datagram Protocol. + type: bool + tcp: + description: Match TCP packet flags + type: bool + source: + description: Specify the packet source. + type: dict + suboptions: + address: + description: Source network address. + type: str + netmask: + description: Netmask for source IP address, valid with IPV4 address. + type: str + any: + description: + - Match any source address. + type: bool + any4: + description: + - Match any ipv4 source address. + type: bool + any6: + description: + - Match any ipv6 source address. + type: bool + host: + description: A single source host + type: str + interface: + description: Use interface address as source address + type: str + object_group: + description: Network object-group for source address + type: str + port_protocol: + description: + - Specify the destination port along with protocol. + - Note, Valid with TCP/UDP protocol_options + type: dict + suboptions: + eq: + description: Match only packets on a given port number. + type: str + gt: + description: Match only packets with a greater port number. + type: str + lt: + description: Match only packets with a lower port number. + type: str + neq: + description: Match only packets not on a given port number. + type: str + range: + description: Port range operator + type: dict + suboptions: + start: + description: Specify the start of the port range. + type: int + end: + description: Specify the end of the port range. + type: int + destination: + description: Specify the packet destination. + type: dict + suboptions: + address: + description: Host address to match, or any single host address. + type: str + netmask: + description: Netmask for destination IP address, valid with IPV4 + address. + type: str + any: + description: Match any destination address. + type: bool + any4: + description: + - Match any ipv4 destination address. + type: bool + any6: + description: + - Match any ipv6 destination address. + type: bool + host: + description: A single destination host + type: str + interface: + description: Use interface address as destination address + type: str + object_group: + description: Network object-group for destination address + type: str + port_protocol: + description: + - Specify the destination port along with protocol. + - Note, Valid with TCP/UDP protocol_options + type: dict + suboptions: + eq: + description: Match only packets on a given port number. + type: str + gt: + description: Match only packets with a greater port number. + type: str + lt: + description: Match only packets with a lower port number. + type: str + neq: + description: Match only packets not on a given port number. + type: str + range: + description: Port range operator + type: dict + suboptions: + start: + description: Specify the start of the port range. + type: int + end: + description: Specify the end of the port range. + type: int + inactive: + description: Keyword for disabling an ACL element. + type: bool + log: + description: Log matches against this entry. + type: str + choices: + - default + - alerts + - critical + - debugging + - disable + - emergencies + - errors + - informational + - interval + - notifications + - warnings + time_range: + description: Specify a time-range. + type: str + running_config: + description: + - The module, by default, will connect to the remote device and retrieve the current + running-config to use as a base for comparing against the contents of source. + There are times when it is not desirable to have the task get the current running-config + for every task in a playbook. The I(running_config) argument allows the implementer + to pass in the configuration to use as the base config for comparison. + type: str + state: + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged + description: + - The state of the configuration after module completion + type: str + +""" + +EXAMPLES = """ +# Using merged +# Before state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 2 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list R1_traffic; 1 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 + +- name: Merge provided configuration with device configuration + cisco.asa.asa_acls: + config: + acls: + - name: temp_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + time_range: temp + - grant: deny + line: 3 + protocol_options: + tcp: true + source: + interface: management + destination: + interface: management + port_protocol: + eq: www + log: warnings + - grant: deny + line: 4 + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + - name: global_access + acl_type: extended + aces: + - line: 3 + remark: test global access + - grant: deny + line: 4 + protocol_options: + tcp: true + source: + any: true + destination: + any: true + port_protocol: + eq: www + log: errors + - name: R1_traffic + aces: + - line: 1 + remark: test_v6_acls + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: merged + +# Commands fired: +# --------------- +# access-list global_access line 3 remark test global access +# access-list global_access line 4 extended deny tcp any any eq www log errors interval 300 +# access-list R1_traffic line 1 remark test_v6_acls +# access-list R1_traffic line 2 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive +# access-list temp_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +# access-list temp_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp inactive +# access-list temp_access line 2 extended deny tcp interface management interface management +# eq www log warnings +# access-list test_access line 3 extended deny tcp object-group test_og_network object-group test_network_og +# eq www log default + +# After state: +# ------------ +# +# vasa#sh access-lists +# access-list global_access; 3 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list global_access line 3 remark test global access (hitcnt=0) 0xae78337e +# access-list global_access line 4 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 remark test_v6_acls +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae +# access-list test_access line 3 +# extended deny tcp interface management interface management eq www log warnings +# interval 300 (hitcnt=0) 0x78aa233d +# access-list test_access line 2 extended deny tcp object-group test_og_network object-group test_network_og +# eq www log default (hitcnt=0) 0x477aec1e +# access-list test_access line 2 extended deny tcp 192.0.2.0 255.255.255.0 host 192.0.3.1 eq www +# log default (hitcnt=0) 0xdc7edff8 +# access-list test_access line 2 extended deny tcp 192.0.2.0 255.255.255.0 host 192.0.3.2 eq www +# log default (hitcnt=0) 0x7b0e9fde +# access-list test_access line 2 extended deny tcp 198.51.100.0 255.255.255.0 2001:db8:3::/64 eq www +# log default (hitcnt=0) 0x97c75adc + +# Using Merged to Rename ACLs +# Before state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 2 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list R1_traffic; 1 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 + +- name: Rename ACL with different name using Merged state + cisco.asa.asa_acls: + config: + acls: + - name: global_access + rename: global_access_renamed + - name: R1_traffic + rename: R1_traffic_renamed + state: merged + +# Commands fired: +# --------------- +# access-list global_access rename global_access_renamed +# access-list R1_traffic rename R1_traffic_renamed + +# After state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access_renamed; 2 elements; name hash: 0xbd6c87a7 +# access-list global_access_renamed line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access_renamed line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list R1_traffic_renamed; 1 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic_renamed line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 + + +# Using replaced + +# Before state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 3 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + +- name: Replaces device configuration of listed acl with provided configuration + cisco.asa.asa_acls: + config: + acls: + - name: global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + state: replaced + +# Commands fired: +# --------------- +# no access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 +# no access-list global_access line 2 extended deny tcp any any eq telnet +# no access-list global_access line 1 extended permit icmp any any log disable +# access-list global_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www + +# After state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 1 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet +# 192.0.5.0 255.255.255.0 eq www (hitcnt=0) 0x3e5b2757 +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + +# Using overridden + +# Before state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 3 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + +- name: Override device configuration of all acl with provided configuration + cisco.asa.asa_acls: + config: + acls: + - name: global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + state: overridden + +# Commands fired: +# --------------- +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 time-range temp +# no access-list temp_access line 1 +# extended grant deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +# no access-list R1_traffic line 2 +# extended grant deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive +# no access-list R1_traffic line 1 +# extended grant deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www log errors +# no access-list global_access line 3 extended grant deny tcp any any eq www log errors +# no access-list global_access line 2 extended grant deny tcp any any eq telnet +# no access-list global_access line 1 extended grant permit icmp any any log disable +# access-list global_access line 4 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www + +# After state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 1 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 + +# Using Deleted + +# Before state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 3 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + +- name: "Delete module attributes of given acl (Note: This won't delete ALL of the ACLs configured)" + cisco.asa.asa_acls: + config: + acls: + - name: temp_access + - name: global_access + state: deleted + +# Commands fired: +# --------------- +# no access-list temp_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp inactive +# no access-list temp_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default +# no access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 +# no access-list global_access line 2 extended deny tcp any any eq telnet +# no access-list global_access line 1 extended permit icmp any any log disable + +# After state: +# ------------- +# +# vasa#sh access-lists +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 + +# Using Deleted without any config passed +#"(NOTE: This will delete all of configured resource module attributes)" + +# Before state: +# ------------- +# +# vasa#sh access-lists +# access-list global_access; 3 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x605f2421 +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + +- name: 'Delete ALL ACLs in one go (Note: This WILL delete the ALL of configured ACLs)' + cisco.asa.asa_acls: + state: deleted + +# Commands fired: +# --------------- +# no access-list global_access line 1 extended permit icmp any any log disable +# no access-list global_access line 2 extended deny tcp any any eq telnet +# no access-list global_access line 3 extended deny tcp any any eq www log errors interval 300 +# no access-list R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 +# no access-list R1_traffic line 2 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive +# no access-list temp_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +# no access-list temp_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp inactive + + +# After state: +# ------------- +# +# vasa#sh access-lists + +# Using Gathered + +# Before state: +# ------------- +# +# access-list global_access; 3 elements; name hash: 0xbd6c87a7 +# access-list global_access line 1 extended permit icmp any any log disable (hitcnt=0) 0xf1efa630 +# access-list global_access line 2 extended deny tcp any any eq telnet (hitcnt=0) 0xae5833af +# access-list R1_traffic; 2 elements; name hash: 0xaf40d3c2 +# access-list R1_traffic line 1 +# extended deny tcp 2001:db8:0:3::/64 eq telnet 2001:fc8:0:4::/64 eq www +# log errors interval 300 (hitcnt=0) 0x4a4660f3 +# access-list R1_traffic line 2 +# extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet +# inactive (hitcnt=0) (inactive) 0xe922b432 +# access-list temp_access; 2 elements; name hash: 0xaf1b712e +# access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www +# log default (hitcnt=0) 0xb58abb0d +# access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp (hitcnt=0) (inactive) 0xcd6b92ae + + +- name: Gather listed ACLs with provided configurations + cisco.asa.asa_acls: + config: + state: gathered + +# Module Execution Result: +# ------------------------ +# +# "gathered": [ +# { +# "acls": [ +# { +# "aces": [ +# { +# "destination": { +# "any": true +# }, +# "grant": "permit", +# "line": 1, +# "log": "disable", +# "protocol": "icmp", +# "source": { +# "any": true +# } +# }, +# { +# "destination": { +# "any": true, +# "port_protocol": { +# "eq": "telnet" +# } +# }, +# "grant": "deny", +# "line": 2, +# "protocol": "tcp", +# "protocol_options": { +# "tcp": true +# }, +# "source": { +# "any": true +# } +# } +# ], +# "acl_type": "extended", +# "name": "global_access" +# }, +# { +# "aces": [ +# { +# "destination": { +# "address": "2001:fc8:0:4::/64", +# "port_protocol": { +# "eq": "www" +# } +# }, +# "grant": "deny", +# "line": 1, +# "log": "errors", +# "protocol": "tcp", +# "protocol_options": { +# "tcp": true +# }, +# "source": { +# "address": "2001:db8:0:3::/64", +# "port_protocol": { +# "eq": "telnet" +# } +# } +# }, +# { +# "destination": { +# "address": "2001:fc8:0:4::/64", +# "port_protocol": { +# "eq": "telnet" +# } +# }, +# "grant": "deny", +# "inactive": true, +# "line": 2, +# "protocol": "tcp", +# "protocol_options": { +# "tcp": true +# }, +# "source": { +# "address": "2001:db8:0:3::/64", +# "port_protocol": { +# "eq": "www" +# } +# } +# } +# ], +# "acl_type": "extended", +# "name": "R1_traffic" +# }, +# { +# "aces": [ +# { +# "destination": { +# "address": "192.0.3.0", +# "netmask": "255.255.255.0", +# "port_protocol": { +# "eq": "www" +# } +# }, +# "grant": "deny", +# "line": 1, +# "log": "default", +# "protocol": "tcp", +# "protocol_options": { +# "tcp": true +# }, +# "source": { +# "address": "192.0.2.0", +# "netmask": "255.255.255.0" +# } +# }, +# { +# "destination": { +# "address": "198.51.110.0", +# "netmask": "255.255.255.0" +# }, +# "grant": "deny", +# "inactive": true, +# "line": 2, +# "protocol": "igrp", +# "protocol_options": { +# "igrp": true +# }, +# "source": { +# "address": "198.51.100.0", +# "netmask": "255.255.255.0" +# }, +# "time_range": "temp" +# } +# ], +# "acl_type": "extended", +# "name": "temp_access" +# } +# ] +# } +# ] + +# Using Rendered + +- name: Rendered the provided configuration with the exisiting running configuration + cisco.asa.asa_acls: + config: + acls: + - name: temp_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + time_range: temp + - name: R1_traffic + aces: + - grant: deny + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: rendered + +# Module Execution Result: +# ------------------------ +# +# "rendered": [ +# "access-list temp_access line 1 +# extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 +# eq www log default" +# "access-list temp_access line 2 +# extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 +# time-range temp" +# "access-list R1_traffic +# deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive" +# ] + +# Using Parsed + +# parsed.cfg +# +# access-list test_access; 2 elements; name hash: 0xaf1b712e +# access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +# access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors +# access-list test_R1_traffic; 1 elements; name hash: 0xaf40d3c2 +# access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + +- name: Parse the commands for provided configuration + cisco.asa.asa_acls: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + +# Module Execution Result: +# ------------------------ +# +# "parsed": [ +# { +# "acls": [ +# { +# "aces": [ +# { +# "destination": { +# "address": "192.0.3.0", +# "netmask": "255.255.255.0", +# "port_protocol": { +# "eq": "www" +# } +# }, +# "grant": "deny", +# "line": 1, +# "log": "default", +# "protocol": "tcp", +# "protocol_options": { +# "tcp": true +# }, +# "source": { +# "address": "192.0.2.0", +# "netmask": "255.255.255.0" +# } +# }, +# { +# "destination": { +# "address": "198.51.110.0", +# "netmask": "255.255.255.0" +# }, +# "grant": "deny", +# "line": 2, +# "log": "errors", +# "protocol": "igrp", +# "protocol_options": { +# "igrp": true +# }, +# "source": { +# "address": "198.51.100.0", +# "netmask": "255.255.255.0" +# } +# } +# ], +# "acl_type": "extended", +# "name": "test_access" +# }, +# { +# "aces": [ +# { +# "destination": { +# "address": "2001:fc8:0:4::/64", +# "port_protocol": { +# "eq": "telnet" +# } +# }, +# "grant": "deny", +# "inactive": true, +# "line": 1, +# "protocol": "tcp", +# "protocol_options": { +# "tcp": true +# }, +# "source": { +# "address": "2001:db8:0:3::/64", +# "port_protocol": { +# "eq": "www" +# } +# } +# } +# ], +# "acl_type": "extended", +# "name": "test_R1_TRAFFIC" +# } +# ] +# } +# ] + +""" + +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: The configuration returned will always be in the same format of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: The configuration returned will always be in the same format of the parameters above. +commands: + description: The set of commands pushed to the remote device + returned: always + type: list + sample: ['access-list global_access line 1 extended permit icmp any any log disable'] +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.argspec.acls.acls import ( + AclsArgs, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.config.acls.acls import ( + Acls, +) + + +def main(): + """ + Main entry point for module execution + :returns: the result form module invocation + """ + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + mutually_exclusive = [("config", "running_config")] + + module = AnsibleModule( + argument_spec=AclsArgs.argument_spec, + required_if=required_if, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + + result = Acls(module).execute_module() + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_command.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_command.py new file mode 100644 index 00000000..ce5f2f77 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_command.py @@ -0,0 +1,197 @@ +#!/usr/bin/python +# +# Copyright: Ansible Project +# 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 + + +DOCUMENTATION = """ +module: asa_command +author: Peter Sprygada (@privateip), Patrick Ogenstad (@ogenstad) +short_description: Run arbitrary commands on Cisco ASA devices +description: +- Sends arbitrary commands to an ASA node and returns the results read from the device. + The C(asa_command) module includes an argument that will cause the module to wait + for a specific condition before returning or timing out if the condition is not + met. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.asa.asa +options: + commands: + description: + - List of commands to send to the remote device over the configured provider. + The resulting output from the command is returned. If the I(wait_for) argument + is provided, the module is not returned until the condition is satisfied or + the number of retires as expired. + required: true + type: list + elements: str + wait_for: + description: + - List of conditions to evaluate against the output of the command. The task will + wait for each condition to be true before moving forward. If the conditional + is not true within the configured number of retries, the task fails. See examples. + aliases: + - waitfor + type: list + elements: str + match: + description: + - The I(match) argument is used in conjunction with the I(wait_for) argument to + specify the match policy. Valid values are C(all) or C(any). If the value + is set to C(all) then all conditionals in the wait_for must be satisfied. If + the value is set to C(any) then only one of the values must be satisfied. + default: all + choices: + - any + - all + type: str + retries: + description: + - Specifies the number of retries a command should by tried before it is considered + failed. The command is run on the target device every retry and evaluated against + the I(wait_for) conditions. + default: 10 + type: int + interval: + description: + - Configures the interval in seconds to wait between retries of the command. If + the command does not pass the specified conditions, the interval indicates how + long to wait before trying the command again. + default: 1 + type: int +notes: +- When processing wait_for, each commands' output is stored as an element of the I(result) + array. The allowed operators for conditional evaluation are I(eq), I(==), I(neq), + I(ne), I(!=), I(gt), I(>), I(ge), I(>=), I(lt), I(<), I(le), I(<=), I(contains), + I(matches). Operators can be prefaced by I(not) to negate their meaning. The I(contains) + operator searches for a substring match (like the Python I(in) operator). The I(matches) + operator searches using a regex search operation. +""" + +EXAMPLES = """ +- name: Show the ASA version + cisco.asa.asa_command: + commands: + - show version + +- name: Show ASA drops and memory + cisco.asa.asa_command: + commands: + - show asp drop + - show memory + +- name: Send repeat pings and wait for the result to pass 100% + cisco.asa.asa_command: + commands: + - ping 8.8.8.8 repeat 20 size 350 + wait_for: + - result[0] contains 100 + retries: 2 +""" + +RETURN = """ +stdout: + description: the set of responses from the commands + returned: always + type: list + sample: ['...', '...'] + +stdout_lines: + description: The value of stdout split into a list + returned: always + type: list + sample: [['...', '...'], ['...'], ['...']] + +failed_conditions: + description: the conditionals that failed + returned: failed + type: list + sample: ['...', '...'] +""" +import time + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + asa_argument_spec, + check_args, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + run_commands, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.parsing import ( + Conditional, +) +from ansible.module_utils.six import string_types + + +def to_lines(stdout): + for item in stdout: + if isinstance(item, string_types): + item = str(item).split("\n") + yield item + + +def main(): + spec = dict( + # { command: <str>, prompt: <str>, response: <str> } + commands=dict(type="list", required=True, elements="str"), + wait_for=dict(type="list", aliases=["waitfor"], elements="str"), + match=dict(default="all", choices=["all", "any"], type="str"), + retries=dict(default=10, type="int"), + interval=dict(default=1, type="int"), + ) + + spec.update(asa_argument_spec) + + module = AnsibleModule(argument_spec=spec, supports_check_mode=True) + check_args(module) + + result = {"changed": False} + + wait_for = module.params["wait_for"] or list() + conditionals = [Conditional(c) for c in wait_for] + + commands = module.params["commands"] + retries = module.params["retries"] + interval = module.params["interval"] + match = module.params["match"] + + while retries > 0: + responses = run_commands(module, commands) + + for item in list(conditionals): + if item(responses): + if match == "any": + conditionals = list() + break + conditionals.remove(item) + + if not conditionals: + break + + time.sleep(interval) + retries -= 1 + + if conditionals: + failed_conditions = [item.raw for item in conditionals] + msg = "One or more conditional statements have not be satisfied" + module.fail_json(msg=msg, failed_conditions=failed_conditions) + + result.update( + { + "changed": False, + "stdout": responses, + "stdout_lines": list(to_lines(responses)), + } + ) + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_config.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_config.py new file mode 100644 index 00000000..71cb9fb0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_config.py @@ -0,0 +1,368 @@ +#!/usr/bin/python +# +# Copyright: Ansible Project +# 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 + + +DOCUMENTATION = """ +module: asa_config +author: Peter Sprygada (@privateip), Patrick Ogenstad (@ogenstad) +short_description: Manage configuration sections on Cisco ASA devices +description: +- Cisco ASA configurations use a simple block indent file syntax for segmenting configuration + into sections. This module provides an implementation for working with ASA configuration + sections in a deterministic way. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.asa.asa +options: + lines: + description: + - The ordered set of commands that should be configured in the section. The commands + must be the exact same commands as found in the device running-config. Be sure + to note the configuration command syntax as some commands are automatically + modified by the device config parser. + aliases: + - commands + type: list + elements: str + parents: + description: + - The ordered set of parents that uniquely identify the section or hierarchy the + commands should be checked against. If the parents argument is omitted, the + commands are checked against the set of top level or global commands. + type: list + elements: str + src: + description: + - Specifies the source path to the file that contains the configuration or configuration + template to load. The path to the source file can either be the full path on + the Ansible control host or a relative path from the playbook or role root directory. This + argument is mutually exclusive with I(lines), I(parents). + type: path + before: + description: + - The ordered set of commands to push on to the command stack if a change needs + to be made. This allows the playbook designer the opportunity to perform configuration + commands prior to pushing any changes without affecting how the set of commands + are matched against the system. + type: list + elements: str + after: + description: + - The ordered set of commands to append to the end of the command stack if a change + needs to be made. Just like with I(before) this allows the playbook designer + to append a set of commands to be executed after the command set. + type: list + elements: str + match: + description: + - Instructs the module on the way to perform the matching of the set of commands + against the current device config. If match is set to I(line), commands are + matched line by line. If match is set to I(strict), command lines are matched + with respect to position. If match is set to I(exact), command lines must be + an equal match. Finally, if match is set to I(none), the module will not attempt + to compare the source configuration with the running configuration on the remote + device. + default: line + choices: + - line + - strict + - exact + - none + type: str + replace: + description: + - Instructs the module on the way to perform the configuration on the device. If + the replace argument is set to I(line) then the modified lines are pushed to + the device in configuration mode. If the replace argument is set to I(block) + then the entire command block is pushed to the device in configuration mode + if any line is not correct + default: line + choices: + - line + - block + type: str + backup: + description: + - This argument will cause the module to create a full backup of the current C(running-config) + from the remote device before any changes are made. If the C(backup_options) + value is not given, the backup file is written to the C(backup) folder in the + playbook root directory. If the directory does not exist, it is created. + type: bool + default: no + config: + description: + - The C(config) argument allows the playbook designer to supply the base configuration + to be used to validate configuration changes necessary. If this argument is + provided, the module will not download the running-config from the remote node. + type: str + defaults: + description: + - This argument specifies whether or not to collect all defaults when getting + the remote device running config. When enabled, the module will get the current + config by issuing the command C(show running-config all). + type: bool + default: no + passwords: + description: + - This argument specifies to include passwords in the config when retrieving the + running-config from the remote device. This includes passwords related to VPN + endpoints. This argument is mutually exclusive with I(defaults). + type: bool + default: false + save: + description: + - The C(save) argument instructs the module to save the running- config to the + startup-config at the conclusion of the module running. If check mode is specified, + this argument is ignored. + type: bool + default: no + backup_options: + description: + - This is a dict object containing configurable options related to backup file + path. The value of this option is read only when C(backup) is set to I(yes), + if C(backup) is set to I(no) this option will be silently ignored. + suboptions: + filename: + description: + - The filename to be used to store the backup configuration. If the filename + is not given it will be generated based on the hostname, current time and + date in format defined by <hostname>_config.<current-date>@<current-time> + type: str + dir_path: + description: + - This option provides the path ending with directory name in which the backup + configuration file will be stored. If the directory does not exist it will + be first created and the filename is either the value of C(filename) or + default filename as described in C(filename) options description. If the + path value is not given in that case a I(backup) directory will be created + in the current working directory and backup configuration will be copied + in C(filename) within I(backup) directory. + type: path + type: dict +""" + +EXAMPLES = """ +- cisco.asa.asa_config: + lines: + - network-object host 10.80.30.18 + - network-object host 10.80.30.19 + - network-object host 10.80.30.20 + parents: [object-group network OG-MONITORED-SERVERS] + provider: '{{ cli }}' + +- cisco.asa.asa_config: + host: '{{ inventory_hostname }}' + lines: + - message-length maximum client auto + - message-length maximum 512 + match: line + parents: [policy-map type inspect dns PM-DNS, parameters] + authorize: yes + auth_pass: cisco + username: admin + password: cisco + context: ansible + +- cisco.asa.asa_config: + lines: + - ikev1 pre-shared-key MyS3cretVPNK3y + parents: tunnel-group 1.1.1.1 ipsec-attributes + passwords: yes + provider: '{{ cli }}' + +- name: attach ASA acl on interface vlan13/nameif cloud13 + cisco.asa.asa_config: + lines: + - access-group cloud-acl_access_in in interface cloud13 + provider: '{{ cli }}' + +- name: configure ASA (>=9.2) default BGP + cisco.asa.asa_config: + lines: + - bgp log-neighbor-changes + - bgp bestpath compare-routerid + provider: '{{ cli }}' + parents: + - router bgp 65002 + register: bgp + when: bgp_default_config is defined +- name: configure ASA (>=9.2) BGP neighbor in default/single context mode + cisco.asa.asa_config: + lines: + - bgp router-id {{ bgp_router_id }} + - neighbor {{ bgp_neighbor_ip }} remote-as {{ bgp_neighbor_as }} + - neighbor {{ bgp_neighbor_ip }} description {{ bgp_neighbor_name }} + provider: '{{ cli }}' + parents: + - router bgp 65002 + - address-family ipv4 unicast + register: bgp + when: bgp_neighbor_as is defined +- name: configure ASA interface with standby + cisco.asa.asa_config: + lines: + - description my cloud interface + - nameif cloud13 + - security-level 50 + - ip address 192.168.13.1 255.255.255.0 standby 192.168.13.2 + provider: '{{ cli }}' + parents: [interface Vlan13] + register: interface +- name: Show changes to interface from task above + debug: + var: interface + +- name: configurable backup path + cisco.asa.asa_config: + lines: + - access-group cloud-acl_access_in in interface cloud13 + provider: '{{ cli }}' + backup: yes + backup_options: + filename: backup.cfg + dir_path: /home/user +""" + +RETURN = """ +updates: + description: The set of commands that will be pushed to the remote device + returned: always + type: list + sample: ['...', '...'] +backup_path: + description: The full path to the backup file + returned: when backup is yes + type: str + sample: /playbooks/ansible/backup/asa_config.2016-07-16@22:28:34 +""" +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + asa_argument_spec, + check_args, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + get_config, + load_config, + run_commands, +) +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import ( + NetworkConfig, + dumps, +) + + +def get_candidate(module): + candidate = NetworkConfig(indent=1) + if module.params["src"]: + candidate.load(module.params["src"]) + elif module.params["lines"]: + parents = module.params["parents"] or list() + candidate.add(module.params["lines"], parents=parents) + return candidate + + +def run(module, result): + match = module.params["match"] + replace = module.params["replace"] + path = module.params["parents"] + + candidate = get_candidate(module) + if match != "none": + contents = module.params["config"] + if not contents: + contents = get_config(module) + config = NetworkConfig(indent=1, contents=contents) + configobjs = candidate.difference( + config, path=path, match=match, replace=replace + ) + + else: + configobjs = candidate.items + + if configobjs: + commands = dumps(configobjs, "commands").split("\n") + + if module.params["lines"]: + if module.params["before"]: + commands[:0] = module.params["before"] + + if module.params["after"]: + commands.extend(module.params["after"]) + + result["updates"] = commands + + # send the configuration commands to the device and merge + # them with the current running config + if not module.check_mode: + load_config(module, commands) + result["changed"] = True + + if module.params["save"]: + if not module.check_mode: + run_commands(module, "write mem") + result["changed"] = True + + +def main(): + """ main entry point for module execution + """ + backup_spec = dict(filename=dict(), dir_path=dict(type="path")) + argument_spec = dict( + src=dict(type="path"), + lines=dict(aliases=["commands"], type="list", elements="str"), + parents=dict(type="list", elements="str"), + before=dict(type="list", elements="str"), + after=dict(type="list", elements="str"), + match=dict( + default="line", choices=["line", "strict", "exact", "none"] + ), + replace=dict(default="line", choices=["line", "block"]), + backup_options=dict(type="dict", options=backup_spec), + config=dict(), + defaults=dict(type="bool", default=False), + passwords=dict(type="bool", default=False), + backup=dict(type="bool", default=False), + save=dict(type="bool", default=False), + ) + + argument_spec.update(asa_argument_spec) + + mutually_exclusive = [ + ("lines", "src"), + ("parents", "src"), + ("defaults", "passwords"), + ] + + required_if = [ + ("match", "strict", ["lines"]), + ("match", "exact", ["lines"]), + ("replace", "block", ["lines"]), + ] + + module = AnsibleModule( + argument_spec=argument_spec, + mutually_exclusive=mutually_exclusive, + required_if=required_if, + supports_check_mode=True, + ) + + result = {"changed": False} + + check_args(module) + + if module.params["backup"]: + result["__backup__"] = get_config(module) + + run(module, result) + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_facts.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_facts.py new file mode 100644 index 00000000..6efd2175 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_facts.py @@ -0,0 +1,209 @@ +#!/usr/bin/python +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: asa_facts +author: +- Sumit Jaiswal (@justjais) +short_description: Collect facts from remote devices running Cisco ASA +description: +- Collects a base set of device facts from a remote device that is running ASA. This + module prepends all of the base network fact keys with C(ansible_net_<fact>). The + facts module will always collect a base set of facts from the device and can enable + or disable collection of additional facts. +- Note, to collects facts from ASA device properly user should elevate the privilege + to become. +version_added: 1.0.0 +extends_documentation_fragment: +- cisco.asa.asa +notes: +- Tested against asa 9.10(1)11 +options: + gather_subset: + description: + - When supplied, this argument restricts the facts collected to a given subset. + - Possible values for this argument include C(all), C(min), C(hardware), C(config). + - Specify a list of values to include a larger subset. + - Use a value with an initial C(!) to collect all facts except that subset. + required: false + type: list + elements: str + default: '!config' + gather_network_resources: + description: + - When supplied, this argument will restrict the facts collected to a given subset. + Possible values for this argument include all and the resources like interfaces, + vlans etc. Can specify a list of values to include a larger subset. Values can + also be used with an initial C(M(!)) to specify that a specific subset should + not be collected. Valid subsets are 'all', 'acls', 'ogs'. + required: false + type: list + elements: str +""" + +EXAMPLES = """ +- name: Gather all legacy facts + cisco.asa.asa_facts: + gather_subset: all + +- name: Gather only the config and default facts + cisco.asa.asa_facts: + gather_subset: + - config + +- name: Do not gather hardware facts + cisco.asa.asa_facts: + gather_subset: + - '!hardware' + +- name: Gather legacy and resource facts + cisco.asa.asa_facts: + gather_subset: all +""" + +RETURN = """ +ansible_net_gather_subset: + description: The list of fact subsets collected from the device + returned: always + type: list + +# default +ansible_net_model: + description: The model name returned from the device + returned: always + type: str +ansible_net_serialnum: + description: The serial number of the remote device + returned: always + type: str +ansible_net_version: + description: The operating system version running on the remote device + returned: always + type: str +ansible_net_firepower_version: + description: The Firepower operating system version running on the remote device. + returned: always + type: str +ansible_net_device_mgr_version: + description: The Device manager version running on the remote device. + returned: always + type: str +ansible_net_asatype: + description: The operating system type (Cisco ASA) running on the remote device. + returned: always + type: str +ansible_net_hostname: + description: The configured hostname of the device + returned: always + type: str +ansible_net_image: + description: The image file the device is running + returned: always + type: str +ansible_net_stacked_models: + description: The model names of each device in the stack + returned: when multiple devices are configured in a stack + type: list +ansible_net_stacked_serialnums: + description: The serial numbers of each device in the stack + returned: when multiple devices are configured in a stack + type: list +ansible_net_api: + description: The name of the transport + returned: always + type: str +ansible_net_python_version: + description: The Python version Ansible controller is using + returned: always + type: str + +# hardware +ansible_net_filesystems: + description: All file system names available on the device + returned: when hardware is configured + type: list +ansible_net_filesystems_info: + description: A hash of all file systems containing info about each file system (e.g. free and total space) + returned: when hardware is configured + type: dict +ansible_net_memfree_mb: + description: The available free memory on the remote device in Mb + returned: when hardware is configured + type: int +ansible_net_memused_mb: + description: The used memory on the remote device in Mb + returned: when hardware is configured + type: int +ansible_net_memtotal_mb: + description: The total memory on the remote device in Mb + returned: when hardware is configured + type: int + +# config +ansible_net_config: + description: The current active config from the device + returned: when config is configured + type: str +""" + +from ansible.module_utils.basic import AnsibleModule + +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.argspec.facts.facts import ( + FactsArgs, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.facts import ( + Facts, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + asa_argument_spec, +) + + +def main(): + """ + Main entry point for module execution + + :returns: ansible_facts + """ + argument_spec = FactsArgs.argument_spec + argument_spec.update(asa_argument_spec) + + module = AnsibleModule( + argument_spec=argument_spec, supports_check_mode=True + ) + + warnings = [] + if module.params["gather_subset"] == "!config": + warnings.append( + "default value for `gather_subset` will be changed to `min` from `!config` v2.11 onwards" + ) + + result = Facts(module).get_facts() + + ansible_facts, additional_warnings = result + warnings.extend(additional_warnings) + + module.exit_json(ansible_facts=ansible_facts, warnings=warnings) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_og.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_og.py new file mode 100644 index 00000000..de37aebb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_og.py @@ -0,0 +1,1034 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# (c) 2019, Ansible by Red Hat, inc +# 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 + + +DOCUMENTATION = """ +module: asa_og +author: +- Federico Olivieri (@Federico87) +short_description: (deprecated, removed after 2022-06-01) Manage object groups on + a Cisco ASA +description: +- This module allows you to create and update object-group network/service on Cisco + ASA device. +version_added: 1.0.0 +deprecated: + alternative: asa_ogs + why: Newer and updated modules released with more functionality in Ansible 2.10 + removed_at_date: '2022-06-01' +options: + name: + description: + - Name of the object group. + required: true + type: str + group_type: + description: + - The object group type. + choices: + - network-object + - service-object + - port-object + required: true + type: str + protocol: + description: + - The protocol for object-group service with port-object. + choices: + - udp + - tcp + - tcp-udp + type: str + host_ip: + description: + - The host IP address for object-group network. + type: list + elements: str + description: + description: + - The description for the object-group. + type: str + group_object: + description: + - The group-object for network object-group. + type: list + elements: str + ip_mask: + description: + - The IP address and mask for network object-group. + type: list + elements: str + port_range: + description: + - The port range for port-object. + type: list + elements: str + port_eq: + description: + - The single port for port-object. + type: list + elements: str + service_cfg: + description: + - The service-object configuration protocol, direction, range or port. + type: list + elements: str + state: + description: + - Manage the state of the resource. + type: str + default: present + choices: + - present + - absent + - replace + +""" + +EXAMPLES = """ +- name: configure network object-group + cisco.asa.asa_og: + name: ansible_test_0 + group_type: network-object + state: present + description: ansible_test object-group description + host_ip: + - 8.8.8.8 + - 8.8.4.4 + ip_mask: + - 10.0.0.0 255.255.255.0 + - 192.168.0.0 255.255.0.0 + group_object: + - awx_lon + - awx_ams + +- name: configure port-object object-group + cisco.asa.asa_og: + name: ansible_test_1 + group_type: port-object + state: replace + description: ansible_test object-group description + protocol: tcp-udp + port_eq: + - 1025 + - kerberos + port_range: + - 1025 5201 + - 0 1024 + +- name: configure service-object object-group + cisco.asa.asa_og: + name: ansible_test_2 + group_type: service-object + state: absent + description: ansible_test object-group description + service_cfg: + - tcp destination eq 8080 + - tcp destination eq www +""" + +RETURN = """ +commands: + description: command sent to the device + returned: always + type: list + sample: [ + "object-group network ansible_test_0", + "description ansible_test object-group description", + "network-object host 8.8.8.8", + "network-object host 8.8.4.4", + "network-object 10.0.0.0 255.255.255.0", + "network-object 192.168.0.0 255.255.0.0", + "network-object 192.168.0.0 255.255.0.0", + "group-object awx_lon", + "group-object awx_ams", + ] +""" +import re + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa import ( + get_config, + load_config, +) + + +class Parser: + """Regex class for outputs parsing""" + + def __init__(self, config, protocol): + """Parser __init__ method""" + self.config = config + self.protocol = protocol + + def parse_obj_grp_name(self): + list_return = list() + match = re.search( + r"(?:object-group\s)(network\s|service\s)(\w+)\s?(tcp-udp|tcp|udp)?", + self.config, + re.M, + ) + + if match: + if match.group(3): + list_return.append(str(match.group(3))) + else: + list_return.append(False) + + if match.group(2): + list_return.append(str(match.group(2))) + + if match.group(1): + list_return.append(str(match.group(1))) + + return list_return + + def parse_description(self): + match = re.search(r"description(:)?\s(.*)", self.config, re.M) + if match: + description = match.group(2) + + return description + + def parse_host(self): + list_return = list() + match = re.findall(r"(host\s)(\d+\.\d+\.\d+\.\d+)", self.config, re.M) + + if match: + for i in match: + if i[1]: + list_return.append(str(i[1])) + + return list_return + + def parse_group_object(self): + list_return = list() + match = re.findall(r"(group-object\s)(.*)", self.config, re.M) + + if match: + for i in match: + if i[1]: + list_return.append(str(i[1])) + + return list_return + + def parse_address(self): + list_return = list() + match = re.findall( + r"(network-object\s)(\d+\.\d+\.\d+\.\d+\s\d+\.\d+\.\d+\.\d+)", + self.config, + re.M, + ) + + if match: + for i in match: + if i[1]: + list_return.append(str(i[1])) + + return list_return + + def parse_port_range(self): + list_return = list() + match = re.findall(r"(range\s)(.*)", self.config, re.M) + + if match: + for i in match: + if i[1]: + list_return.append(str(i[1])) + + return list_return + + def parse_port_eq(self): + list_return = list() + match = re.findall(r"(eq\s)(.*)", self.config, re.M) + + if match: + for i in match: + if i[1]: + list_return.append(str(i[1])) + + return list_return + + def parse_service_cfg(self): + list_return = list() + match = re.findall(r"(service-object\s)(.*)", self.config, re.M) + + if match: + for i in match: + if i[1]: + list_return.append(str(i[1])) + + return list_return + + +def map_config_to_obj(module): + + obj = list() + obj_dict = dict() + + group_name = module.params["name"] + protocol = module.params["protocol"] + + sh_run_group_name = get_config( + module, flags=["object-group | include {0}".format(group_name)] + ) + run_group_name = Parser(sh_run_group_name, protocol).parse_obj_grp_name() + + obj_dict["have_name"] = run_group_name + + if run_group_name: + if run_group_name[0] is not False: + obj_dict["have_group_type"] = "port-object" + obj_dict["have_protocol"] = run_group_name[0] + elif "network" in run_group_name[2]: + obj_dict["have_group_type"] = "network-object" + elif "service" in run_group_name[2] and run_group_name[0] is False: + obj_dict["have_group_type"] = "service-object" + else: + obj_dict["have_group_type"] = None + + sh_run_group_type = get_config( + module, flags=["object-group id {0}".format(group_name)] + ) + + have_description = Parser(sh_run_group_type, protocol).parse_description() + obj_dict["have_description"] = have_description + + have_host_ip = Parser(sh_run_group_type, protocol).parse_host() + obj_dict["have_host_ip"] = have_host_ip + + have_group_object = Parser( + sh_run_group_type, protocol + ).parse_group_object() + obj_dict["have_group_object"] = have_group_object + + have_ip_mask = Parser(sh_run_group_type, protocol).parse_address() + obj_dict["have_ip_mask"] = have_ip_mask + + have_port_range = Parser(sh_run_group_type, protocol).parse_port_range() + obj_dict["have_port_range"] = have_port_range + + have_port_eq = Parser(sh_run_group_type, protocol).parse_port_eq() + obj_dict["have_port_eq"] = have_port_eq + + have_service_cfg = Parser(sh_run_group_type, protocol).parse_service_cfg() + + if have_service_cfg: + have_lines = list() + for i in have_service_cfg: + have_lines.append(i.rstrip(" ")) + obj_dict["have_service_cfg"] = have_lines + elif have_service_cfg is None: + obj_dict["have_service_cfg"] = have_service_cfg + + obj.append(obj_dict) + + return obj + + +def replace(want_dict, have): + + commands = list() + add_lines = list() + remove_lines = list() + + have_group_type = have[0].get("have_group_type") + have_description = have[0].get("have_description") + have_host_ip = have[0].get("have_host_ip") + have_group_object = have[0].get("have_group_object") + have_ip_mask = have[0].get("have_ip_mask") + have_protocol = have[0].get("have_protocol") + have_port_range = have[0].get("have_port_range") + have_port_eq = have[0].get("have_port_eq") + have_service_cfg = have[0].get("have_service_cfg") + + name = want_dict["name"] + group_type = want_dict["group_type"] + protocol = want_dict["protocol"] + description = want_dict["description"] + host = want_dict["host_ip"] + group_object = want_dict["group_object"] + address = want_dict["ip_mask"] + port_range = want_dict["port_range"] + port_eq = want_dict["port_eq"] + service_cfg = want_dict["service_cfg"] + + if "network-object" in group_type: + + if have_group_type is None: + commands.append("object-group network {0}".format(name)) + + if host: + for i in host: + commands.append("network-object host " + i) + if description: + if have_description is None: + commands.append("description {0}".format(description)) + if group_object: + for i in group_object: + if i not in have_group_object: + commands.append("group-object " + i) + if address: + for i in address: + commands.append("network-object " + i) + + elif "network" in have_group_type: + + if host: + if sorted(host) != sorted(have_host_ip): + for i in host: + if i not in have_host_ip: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + add_lines.append("network-object host " + i) + for i in have_host_ip: + if i not in host: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + remove_lines.append("no network-object host " + i) + + if description: + if description != have_description: + if "object-group network {0}".format(name) not in commands: + commands.append( + "object-group network {0}".format(name) + ) + add_lines.append("description {0}".format(description)) + + if group_object: + if sorted(group_object) != sorted(have_group_object): + for i in group_object: + if i not in have_group_object: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + add_lines.append("group-object " + i) + for i in have_group_object: + if i not in group_object: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + remove_lines.append("no group-object " + i) + if address: + if sorted(address) != sorted(have_ip_mask): + for i in address: + if i not in have_ip_mask: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + add_lines.append("network-object " + i) + for i in have_ip_mask: + if i not in address: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + remove_lines.append("no network-object " + i) + + elif "port-object" in group_type: + + if have_group_type is None and have_protocol != protocol: + commands.append( + "object-group service {0} {1}".format(name, protocol) + ) + + if port_range: + for i in port_range: + commands.append("port-object range " + i) + if port_eq: + for i in port_eq: + commands.append("port-object eq " + i) + if description: + commands.append("description {0}".format(description)) + + elif "port" in have_group_type and have_protocol == protocol: + + if port_range: + if sorted(port_range) != sorted(have_port_range): + for i in port_range: + if i not in have_port_range: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + add_lines.append("port-object range " + i) + for i in have_port_range: + if i not in port_range: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + remove_lines.append("no port-object range " + i) + if port_eq: + if sorted(port_eq) != sorted(have_port_eq): + for i in port_eq: + if i not in have_port_eq: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + add_lines.append("port-object eq " + i) + for i in have_port_eq: + if i not in port_eq: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + remove_lines.append("no port-object eq " + i) + if description: + if description != have_description: + if ( + "object-group service {0} {1}".format(name, protocol) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("description {0}".format(description)) + + elif "service-object" in group_type: + + if have_group_type is None: + commands.append("object-group service {0}".format(name)) + + if description: + if have_description is None: + commands.append("description {0}".format(description)) + if service_cfg: + for i in service_cfg: + commands.append("service-object " + i) + + elif "service" in have_group_type: + if description: + if description != have_description: + if "object-group service {0}".format(name) not in commands: + commands.append( + "object-group service {0}".format(name) + ) + commands.append("description {0}".format(description)) + if service_cfg: + for i in service_cfg: + if i not in have_service_cfg: + if ( + "object-group service {0}".format(name) + not in commands + ): + commands.append( + "object-group service {0}".format(name) + ) + add_lines.append("service " + i) + for i in have_service_cfg: + if i not in service_cfg: + if ( + "object-group service {0}".format(name) + not in commands + ): + commands.append( + "object-group service {0}".format(name) + ) + remove_lines.append("no service " + i) + + set_add_lines = set(add_lines) + set_remove_lines = set(remove_lines) + + for i in list(set_add_lines) + list(set_remove_lines): + commands.append(i) + + return commands + + +def present(want_dict, have): + + commands = list() + + have_group_type = have[0].get("have_group_type") + have_description = have[0].get("have_description") + have_host_ip = have[0].get("have_host_ip") + have_group_object = have[0].get("have_group_object") + have_ip_mask = have[0].get("have_ip_mask") + have_protocol = have[0].get("have_protocol") + have_port_range = have[0].get("have_port_range") + have_port_eq = have[0].get("have_port_eq") + have_service_cfg = have[0].get("have_service_cfg") + + name = want_dict["name"] + group_type = want_dict["group_type"] + protocol = want_dict["protocol"] + description = want_dict["description"] + host = want_dict["host_ip"] + group_object = want_dict["group_object"] + address = want_dict["ip_mask"] + port_range = want_dict["port_range"] + port_eq = want_dict["port_eq"] + service_cfg = want_dict["service_cfg"] + + if "network-object" in group_type: + + if have_group_type is None: + commands.append("object-group network {0}".format(name)) + + if host: + for i in host: + commands.append("network-object host " + i) + if description: + if have_description is None: + commands.append("description {0}".format(description)) + if group_object: + for i in group_object: + commands.append("group-object " + i) + if address: + for i in address: + commands.append("network-object " + i) + + elif "network" in have_group_type: + + if host: + for i in host: + if i not in have_host_ip: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + commands.append("network-object host " + i) + if description: + if description != have_description: + if "object-group network {0}".format(name) not in commands: + commands.append( + "object-group network {0}".format(name) + ) + commands.append("description {0}".format(description)) + if group_object: + for i in group_object: + if i not in have_group_object: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + commands.append("group-object " + i) + if address: + for i in address: + if i not in have_ip_mask: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + commands.append("network-object " + i) + + elif "port-object" in group_type: + + if have_group_type is None and have_protocol != protocol: + commands.append( + "object-group service {0} {1}".format(name, protocol) + ) + + if port_range: + for i in port_range: + commands.append("port-object range " + i) + if port_eq: + for i in port_eq: + commands.append("port-object eq " + i) + if description: + commands.append("description {0}".format(description)) + + elif "port" in have_group_type and have_protocol == protocol: + + if port_range: + for i in port_range: + if i not in have_port_range: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("port-object range " + i) + if port_eq: + for i in port_eq: + if i not in have_port_eq: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("port-object eq " + i) + if description: + if description != have_description: + if ( + "object-group service {0} {1}".format(name, protocol) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("description {0}".format(description)) + + elif "service-object" in group_type: + + if have_group_type is None: + commands.append("object-group service {0}".format(name)) + + if description: + if have_description is None: + commands.append("description {0}".format(description)) + if service_cfg: + for i in service_cfg: + commands.append("service-object " + i) + + elif "service" in have_group_type: + + if description: + if description != have_description: + if "object-group service {0}".format(name) not in commands: + commands.append( + "object-group service {0}".format(name) + ) + commands.append("description {0}".format(description)) + if service_cfg: + for i in service_cfg: + if i not in have_service_cfg: + if ( + "object-group service {0}".format(name) + not in commands + ): + commands.append( + "object-group service {0}".format(name) + ) + commands.append("service " + i) + + return commands + + +def absent(want_dict, have): + + commands = list() + + have_group_type = have[0].get("have_group_type") + have_description = have[0].get("have_description") + have_host_ip = have[0].get("have_host_ip") + have_group_object = have[0].get("have_group_object") + have_ip_mask = have[0].get("have_ip_mask") + have_protocol = have[0].get("have_protocol") + have_port_range = have[0].get("have_port_range") + have_port_eq = have[0].get("have_port_eq") + have_service_cfg = have[0].get("have_service_cfg") + + name = want_dict["name"] + group_type = want_dict["group_type"] + protocol = want_dict["protocol"] + description = want_dict["description"] + host = want_dict["host_ip"] + group_object = want_dict["group_object"] + address = want_dict["ip_mask"] + port_range = want_dict["port_range"] + port_eq = want_dict["port_eq"] + service_cfg = want_dict["service_cfg"] + + if "network-object" in group_type: + + if have_group_type is None: + return commands + + elif "network" in have_group_type: + + if host: + for i in host: + if i in have_host_ip: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + commands.append("no network-object host " + i) + if description: + if description == have_description: + if "object-group network {0}".format(name) not in commands: + commands.append( + "object-group network {0}".format(name) + ) + commands.append("no description {0}".format(description)) + if group_object: + for i in group_object: + if i in have_group_object: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + commands.append("no group-object " + i) + if address: + for i in address: + if i in have_ip_mask: + if ( + "object-group network {0}".format(name) + not in commands + ): + commands.append( + "object-group network {0}".format(name) + ) + commands.append("no network-object " + i) + + elif "port-object" in group_type: + + if have_group_type is None and have_protocol is None: + return commands + + elif "port" in have_group_type and have_protocol == protocol: + + if port_range: + for i in port_range: + if i in have_port_range: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("no port-object range " + i) + if port_eq: + for i in port_eq: + if i in have_port_eq: + if ( + "object-group service {0} {1}".format( + name, protocol + ) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("no port-object eq " + i) + if description: + if description == have_description: + if ( + "object-group service {0} {1}".format(name, protocol) + not in commands + ): + commands.append( + "object-group service {0} {1}".format( + name, protocol + ) + ) + commands.append("no description {0}".format(description)) + + elif "service-object" in group_type: + + if have_group_type is None: + return commands + + elif "service" in have_group_type: + if description: + if description == have_description: + if "object-group service {0}".format(name) not in commands: + commands.append( + "object-group service {0}".format(name) + ) + commands.append("no description {0}".format(description)) + if service_cfg: + for i in service_cfg: + if i in have_service_cfg: + if ( + "object-group service {0}".format(name) + not in commands + ): + commands.append( + "object-group service {0}".format(name) + ) + commands.append("no service " + i) + + return commands + + +def map_obj_to_commands(want, have, module): + + for w in want: + + want_dict = dict() + + want_dict["name"] = w["name"] + want_dict["group_type"] = w["group_type"] + want_dict["protocol"] = w["protocol"] + want_dict["description"] = w["description"] + want_dict["host_ip"] = w["host_ip"] + want_dict["group_object"] = w["group_object"] + want_dict["ip_mask"] = w["ip_mask"] + want_dict["port_range"] = w["port_range"] + want_dict["port_eq"] = w["port_eq"] + want_dict["service_cfg"] = w["service_cfg"] + state = w["state"] + + if state == "replace": + return replace(want_dict, have) + elif state == "present": + return present(want_dict, have) + elif state == "absent": + return absent(want_dict, have) + + +def map_params_to_obj(module): + + obj = list() + + obj.append( + { + "name": module.params["name"], + "group_type": module.params["group_type"], + "protocol": module.params["protocol"], + "state": module.params["state"], + "description": module.params["description"], + "host_ip": module.params["host_ip"], + "group_object": module.params["group_object"], + "port_range": module.params["port_range"], + "port_eq": module.params["port_eq"], + "service_cfg": module.params["service_cfg"], + "ip_mask": module.params["ip_mask"], + } + ) + + return obj + + +def main(): + + argument_spec = dict( + name=dict(required=True), + group_type=dict( + choices=["network-object", "service-object", "port-object"], + required=True, + ), + protocol=dict(choices=["udp", "tcp", "tcp-udp"]), + host_ip=dict(type="list", elements="str"), + description=dict(), + group_object=dict(type="list", elements="str"), + ip_mask=dict(type="list", elements="str"), + port_range=dict(type="list"), + port_eq=dict(type="list", elements="str"), + service_cfg=dict(type="list", elements="str"), + state=dict( + choices=["present", "absent", "replace"], default="present" + ), + ) + + required_if = [ + ("group_type", "port-object", ["protocol"]), + ("group_type", "service-object", ["service_cfg"]), + ] + + module = AnsibleModule( + argument_spec=argument_spec, + required_if=required_if, + supports_check_mode=True, + ) + + result = {"changed": False} + + want = map_params_to_obj(module) + have = map_config_to_obj(module) + config_commans = map_obj_to_commands(want, have, module) + + result["commands"] = config_commans + + if config_commans: + if not module.check_mode: + load_config(module, config_commans) + result["changed"] = True + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_ogs.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_ogs.py new file mode 100644 index 00000000..5792bc80 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/modules/asa_ogs.py @@ -0,0 +1,892 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright 2019 Red Hat +# GNU General Public License v3.0+ +# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +############################################# +# WARNING # +############################################# +# +# This file is auto generated by the resource +# module builder playbook. +# +# Do not edit this file manually. +# +# Changes to this file will be over written +# by the resource module builder. +# +# Changes should be made in the model used to +# generate this file or in the resource module +# builder template. +# +############################################# + +""" +The module file for asa_ogs +""" + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + + +DOCUMENTATION = """ +module: asa_ogs +short_description: Object Group resource module +description: This module configures and manages Objects and Groups on ASA platforms. +version_added: 1.0.0 +author: Sumit Jaiswal (@justjais) +notes: +- Tested against Cisco ASA Version 9.10(1)11 +- This module works with connection C(network_cli). See L(ASA Platform Options,../network/user_guide/platform_asa.html). +options: + config: + description: A list of Object Group options. + type: list + elements: dict + suboptions: + object_type: + description: The object group type. + type: str + required: true + choices: + - icmp-type + - network + - protocol + - security + - service + - user + object_groups: + description: The object groups. + type: list + elements: dict + suboptions: + name: + description: Specifies object-group ID + required: true + type: str + description: + description: The description for the object-group. + type: str + icmp_type: + description: Configure an ICMP-type object + type: dict + suboptions: + icmp_object: + description: Defines the ICMP types in the group. + type: list + elements: str + choices: [alternate-address, conversion-error, echo, echo-reply, information-reply, + information-request, mask-reply, mask-request, mobile-redirect, + parameter-problem, redirect, router-advertisement, router-solicitation, + source-quench, time-exceeded, timestamp-reply, timestamp-request, + traceroute, unreachable] + network_object: + description: Configure a network object + type: dict + suboptions: + host: + description: Set this to specify a single host object. + type: list + elements: str + address: + description: Enter an IPv4 network address with space seperated netmask. + type: list + elements: str + ipv6_address: + description: Enter an IPv6 prefix. + type: list + elements: str + protocol_object: + description: Configure a protocol object + type: dict + suboptions: + protocol: + description: Defines the protocols in the group. + type: list + elements: str + choices: [ah, eigrp, esp, gre, icmp, icmp6, igmp, igrp, ip, ipinip, + ipsec, nos, ospf, pcp, pim, pptp, sctp, snp, tcp, udp] + security_group: + description: Configure a security-group + type: dict + suboptions: + sec_name: + description: Enter this keyword to specify a security-group name. + type: list + elements: str + tag: + description: Enter this keyword to specify a security-group tag. + type: list + elements: str + service_object: + description: Configure a service object + type: dict + suboptions: + protocol: + description: Defines the protocols in the group. + type: list + elements: str + choices: [ah, eigrp, esp, gre, icmp, icmp6, igmp, igrp, ip, ipinip, + ipsec, nos, ospf, pcp, pim, pptp, sctp, snp, tcp, tcp-udp, udp] + object: + description: Enter this keyword to specify a service object + type: str + user_object: + description: Configures single user, local or import user group + type: dict + suboptions: + user: + description: Configure a user objectUser name to configure a user + object. + type: list + elements: dict + suboptions: + name: + description: Enter the name of the user + type: str + required: true + domain: + description: User domain + type: str + required: true + user_group: + description: Configure a user group object. + type: list + elements: dict + suboptions: + name: + description: Enter the name of the group + type: str + required: true + domain: + description: Group domain + type: str + required: true + running_config: + description: + - The module, by default, will connect to the remote device and retrieve the current + running-config to use as a base for comparing against the contents of source. + There are times when it is not desirable to have the task get the current running-config + for every task in a playbook. The I(running_config) argument allows the implementer + to pass in the configuration to use as the base config for comparison. This + value of this option should be the output received from device by executing + command. + type: str + state: + description: + - The state the configuration should be left in + type: str + choices: + - merged + - replaced + - overridden + - deleted + - gathered + - rendered + - parsed + default: merged +""" + +EXAMPLES = """ + +# Using merged + +# Before state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_network_og +# network-object host 192.0.3.1 + +- name: "Merge module attributes of given object-group" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: merged + +# Commands fired: +# --------------- +# +# object-group security test_og_security +# description test_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group network test_og_network +# description test_og_network +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# object-group network test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:3::/64 +# object-group user test_og_user +# description test_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +# After state: +# ------------ +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# network-object host 192.0.3.1 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# description test_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +# Using Replaced + +# Before state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +- name: "Replace module attributes of given object-group" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_replace + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: replaced + +# Commands Fired: +# --------------- +# +# object-group protocol test_og_protocol +# description test_og_protocol +# protocol tcp +# protocol udp +# object-group network test_og_network +# description test_og_network_replace +# no network-object 192.0.2.0 255.255.255.0 +# no network-object 198.51.100.0 255.255.255.0 +# network-object 192.0.3.0 255.255.255.0 +# no network-object host 192.0.2.1 +# no network-object host 192.0.2.2 +# network-object host 192.0.3.1 + +# After state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network_replace +# network-object host 192.0.3.1 +# network-object 192.0.3.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 +# object-group protocol test_og_protocol +# protocol-object tcp +# protocol-object udp + +# Using Overridden + +# Before state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +- name: "Overridden module attributes of given object-group" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_override + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: overridden + +# Commands Fired: +# --------------- +# +# no object-group security test_og_security +# no object-group user test_og_user +# object-group protocol test_og_protocol +# description test_og_protocol +# protocol tcp +# protocol udp +# object-group network test_og_network +# description test_og_network_override +# no network-object 192.0.2.0 255.255.255.0 +# no network-object 198.51.100.0 255.255.255.0 +# network-object 192.0.3.0 255.255.255.0 +# no network-object host 192.0.2.1 +# no network-object host 192.0.2.2 +# network-object host 192.0.3.1 +# no object-group network test_network_og + +# After state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network_override +# network-object host 192.0.3.1 +# network-object 192.0.3.0 255.255.255.0 +# object-group protocol test_og_protocol +# protocol-object tcp +# protocol-object udp + +# Using Deleted + +# Before state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +- name: "Delete given module attributes" + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + - name: test_network_og + - object_type: security + object_groups: + - name: test_og_security + state: deleted + +# Commands Fired: +# --------------- +# +# no object-group network test_og_network +# no object-group network test_network_og +# no object-group security test_og_security + +# After state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +# Using DELETED without any config passed +#"(NOTE: This will delete all of configured resource module attributes)" + +# Before state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +- name: Delete ALL configured module attributes + cisco.asa.asa_ogs: + config: + state: deleted + +# Commands Fired: +# --------------- +# +# no object-group network test_og_network +# no object-group network test_network_og +# no object-group security test_og_security +# no object-group user test_og_user + +# After state: +# ------------- +# +# ciscoasa# sh running-config object-group + +# Using Gathered + +# Before state: +# ------------- +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +- name: Gather listed OGs with provided configurations + cisco.asa.asa_ogs: + config: + state: gathered + +# Module Execution Result: +# ------------------------ +# +# "gathered": [ +# { +# "object_groups": [ +# { +# "description": "test_security", +# "name": "test_og_security", +# "security_group": { +# "sec_name": [ +# "test_2", +# "test_1" +# ], +# "tag": [ +# 10, +# 20 +# ] +# } +# } +# ], +# "object_type": "security" +# }, +# { +# "object_groups": [ +# { +# "description": "test_network_og", +# "name": "test_network_og", +# "network_object": { +# "host": [ +# "192.0.3.1", +# "192.0.3.2" +# ], +# "ipv6_address": [ +# "2001:db8:3::/64" +# ] +# } +# }, +# { +# "description": "test_og_network", +# "name": "test_og_network", +# "network_object": { +# "address": [ +# "192.0.2.0 255.255.255.0", +# "198.51.100.0 255.255.255.0" +# ], +# "host": [ +# "192.0.2.1", +# "192.0.2.2" +# ] +# } +# } +# ], +# "object_type": "network" +# }, +# { +# "object_groups": [ +# { +# "description": "test_user", +# "name": "test_og_user", +# "user_object": { +# "user": [ +# { +# "domain": "LOCAL", +# "name": "new_user_1" +# }, +# { +# "domain": "LOCAL", +# "name": "new_user_2" +# } +# ] +# } +# } +# ], +# "object_type": "user" +# } +# ] + +# After state: +# ------------ +# +# ciscoasa# sh running-config object-group +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object host 192.0.2.2 +# network-object 192.0.2.0 255.255.255.0 +# network-object 198.51.100.0 255.255.255.0 +# object-group network test_network_og +# description test_network_og +# network-object host 192.0.3.1 +# network-object host 192.0.3.2 +# network-object 2001:db8:0:3::/64 +# group-object test_og_network +# object-group security test_og_security +# security-group name test_1 +# security-group name test_2 +# security-group tag 10 +# security-group tag 20 +# object-group user test_og_user +# user LOCAL\\new_user_1 +# user LOCAL\\new_user_2 + +# Using Rendered + +- name: Render the commands for provided configuration + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: rendered + +# Module Execution Result: +# ------------------------ +# +# "rendered": [ +# "object-group security test_og_security", +# "description test_security", +# "security-group name test_1", +# "security-group name test_2", +# "security-group tag 10", +# "security-group tag 20", +# "object-group network test_og_network", +# "description test_og_network", +# "network-object 192.0.2.0 255.255.255.0", +# "network-object 198.51.100.0 255.255.255.0", +# "network-object host 192.0.2.1", +# "network-object host 192.0.2.2", +# "object-group network test_network_og", +# "description test_network_og", +# "network-object host 192.0.3.1", +# "network-object host 192.0.3.2", +# "network-object 2001:db8:3::/64", +# "object-group user test_og_user", +# "description test_user", +# "user LOCAL\\new_user_1", +# "user LOCAL\\new_user_2" +# ] + +# Using Parsed + +# parsed.cfg +# +# object-group network test_og_network +# description test_og_network +# network-object host 192.0.2.1 +# network-object 192.0.2.0 255.255.255.0 +# object-group network test_network_og +# network-object 2001:db8:3::/64 +# object-group service test_og_service +# service-object tcp-udp + +- name: Parse the commands for provided configuration + cisco.asa.asa_ogs: + running_config: "{{ lookup('file', 'parsed.cfg') }}" + state: parsed + +# Module Execution Result: +# ------------------------ +# +# "parsed": [ +# { +# "object_groups": [ +# { +# "name": "test_network_og" +# }, +# { +# "description": "test_og_network", +# "name": "test_og_network", +# "network_object": { +# "host": [ +# "192.0.2.2" +# ] +# } +# } +# ], +# "object_type": "network" +# }, +# { +# "object_groups": [ +# { +# "name": "test_og_service", +# "service_object": { +# "protocol": [ +# "tcp-udp", +# "ipinip" +# ] +# } +# } +# ], +# "object_type": "service" +# } +# ] + +""" + +RETURN = """ +before: + description: The configuration as structured data prior to module invocation. + returned: always + type: list + sample: The configuration returned will always be in the same format of the parameters above. +after: + description: The configuration as structured data after module completion. + returned: when changed + type: list + sample: The configuration returned will always be in the same format of the parameters above. +commands: + description: The set of commands pushed to the remote device + returned: always + type: list + sample: ['object-group network test_network_og', 'description test_network_og', 'network-object host 192.0.2.1'] +""" + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.argspec.ogs.ogs import ( + OGsArgs, +) +from ansible_collections.cisco.asa.plugins.module_utils.network.asa.config.ogs.ogs import ( + OGs, +) + + +def main(): + """ + Main entry point for module execution + :returns: the result form module invocation + """ + + required_if = [ + ("state", "merged", ("config",)), + ("state", "replaced", ("config",)), + ("state", "overridden", ("config",)), + ("state", "rendered", ("config",)), + ("state", "parsed", ("running_config",)), + ] + + mutually_exclusive = [("config", "running_config")] + + module = AnsibleModule( + argument_spec=OGsArgs.argument_spec, + required_if=required_if, + mutually_exclusive=mutually_exclusive, + supports_check_mode=True, + ) + result = OGs(module).execute_module() + + module.exit_json(**result) + + +if __name__ == "__main__": + main() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/terminal/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/terminal/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/terminal/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/plugins/terminal/asa.py b/collections-debian-merged/ansible_collections/cisco/asa/plugins/terminal/asa.py new file mode 100644 index 00000000..83f33918 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/plugins/terminal/asa.py @@ -0,0 +1,76 @@ +# +# (c) 2016 Red Hat Inc. +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. +# +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import re +import json + +from ansible.errors import AnsibleConnectionFailure +from ansible.module_utils._text import to_text, to_bytes +from ansible.plugins.terminal import TerminalBase + + +class TerminalModule(TerminalBase): + + terminal_stdout_re = [ + re.compile(br"[\r\n]?[\w+\-\.:\/\[\]]+(?:\([^\)]+\)){,3}(?:>|#) ?$"), + re.compile(br"\[\w+\@[\w\-\.]+(?: [^\]])\] ?[>#\$] ?$"), + ] + + terminal_stderr_re = [ + re.compile(br"error:", re.I), + re.compile(br"Removing.* not allowed, it is being used"), + re.compile(br"^Command authorization failed\r?$", re.MULTILINE), + ] + + def on_open_shell(self): + if self._get_prompt().strip().endswith(b"#"): + self.disable_pager() + + def disable_pager(self): + try: + self._exec_cli_command(u"no terminal pager") + except AnsibleConnectionFailure: + raise AnsibleConnectionFailure("unable to disable terminal pager") + + def on_become(self, passwd=None): + if self._get_prompt().strip().endswith(b"#"): + return + + cmd = {u"command": u"enable"} + if passwd: + # Note: python-3.5 cannot combine u"" and r"" together. Thus make + # an r string and use to_text to ensure it's text on both py2 and py3. + cmd[u"prompt"] = to_text( + r"[\r\n]?[Pp]assword: $", errors="surrogate_or_strict" + ) + cmd[u"answer"] = passwd + + try: + self._exec_cli_command( + to_bytes(json.dumps(cmd), errors="surrogate_or_strict") + ) + except AnsibleConnectionFailure: + raise AnsibleConnectionFailure( + "unable to elevate privilege to enable mode" + ) + + self.disable_pager() diff --git a/collections-debian-merged/ansible_collections/cisco/asa/requirements.txt b/collections-debian-merged/ansible_collections/cisco/asa/requirements.txt new file mode 100644 index 00000000..8608c1b0 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/requirements.txt @@ -0,0 +1 @@ +paramiko diff --git a/collections-debian-merged/ansible_collections/cisco/asa/test-requirements.txt b/collections-debian-merged/ansible_collections/cisco/asa/test-requirements.txt new file mode 100644 index 00000000..4e509b41 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/test-requirements.txt @@ -0,0 +1,5 @@ +black==19.3b0 ; python_version > '3.5' +flake8 +mock +pytest-xdist +coverage==4.5.4 diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/.gitignore b/collections-debian-merged/ansible_collections/cisco/asa/tests/.gitignore new file mode 100644 index 00000000..ea1472ec --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/.gitignore @@ -0,0 +1 @@ +output/ diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/network-integration.cfg b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/network-integration.cfg new file mode 100644 index 00000000..d12c1efe --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/network-integration.cfg @@ -0,0 +1,4 @@ +[persistent_connection] +command_timeout = 100 +connect_timeout = 100 +connect_retry_timeout = 100 diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/target-prefixes.network b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/target-prefixes.network new file mode 100644 index 00000000..50b13099 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/target-prefixes.network @@ -0,0 +1 @@ +asa
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tasks/cli.yaml new file mode 100644 index 00000000..05ca0d6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tasks/cli.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tasks/main.yaml new file mode 100644 index 00000000..a3db933e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/basic.yaml new file mode 100644 index 00000000..d45342df --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/basic.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/basic.yaml" + +- name: Basic ACL + register: result + cisco.asa.asa_acl: + provider: '{{ cli }}' + lines: + - access-list ACL-BASIC extended permit tcp any any eq www + - access-list ACL-BASIC extended permit tcp any any eq https + +- assert: + that: + - result.changed == true + +- name: Basic ACL idempotency + register: result + cisco.asa.asa_acl: + provider: '{{ cli }}' + lines: + - access-list ACL-BASIC extended permit tcp any any eq www + - access-list ACL-BASIC extended permit tcp any any eq https + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + commands: + - clear configure access-list ACL-BASIC + provider: '{{ cli }}' + +- debug: msg="END cli/basic.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/full_name_match.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/full_name_match.yaml new file mode 100644 index 00000000..bc3a5413 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/full_name_match.yaml @@ -0,0 +1,35 @@ +--- +- debug: msg="START cli/full_name_match.yaml" + +- name: Basic ACL + register: result + cisco.asa.asa_acl: + provider: '{{ cli }}' + lines: + - access-list ACL-BASIC2 extended permit tcp any any eq www + - access-list ACL-BASIC2 extended permit tcp any any eq https + +- assert: + that: + - result.changed == true + +- name: Should not match for ACL-BASIC2 + register: result + cisco.asa.asa_acl: + provider: '{{ cli }}' + lines: + - access-list ACL-BASIC extended permit tcp any any eq www + - access-list ACL-BASIC extended permit tcp any any eq https + +- assert: + that: + - result.changed == true + +- name: teardown + cisco.asa.asa_config: + commands: + - clear configure access-list ACL-BASIC + - clear configure access-list ACL-BASIC2 + provider: '{{ cli }}' + +- debug: msg="END cli/full_name_match.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/insert.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/insert.yaml new file mode 100644 index 00000000..fafea5fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acl/tests/cli/insert.yaml @@ -0,0 +1,43 @@ +--- +- debug: msg="START cli/insert.yaml" + +- name: Create ACL + register: result + cisco.asa.asa_acl: + provider: '{{ cli }}' + lines: + - access-list ACL-INSERT extended permit tcp any any eq www + - access-list ACL-INSERT extended permit tcp any any eq https + +- name: Insert on first line + register: result + cisco.asa.asa_acl: + provider: '{{ cli }}' + lines: + - access-list ACL-INSERT extended permit tcp any any eq www + - access-list ACL-INSERT extended permit tcp any any eq https + - access-list ACL-INSERT line 1 extended permit tcp any any eq ssh + +- name: Show ACL + register: result + cisco.asa.asa_command: + provider: '{{ cli }}' + commands: show run access-list ACL-INSERT + +- name: Show me + debug: + var: result + +- name: + assert: + that: + - result.stdout_lines[0][0].rstrip() == 'access-list ACL-INSERT extended permit + tcp any any eq ssh' + +- name: teardown + cisco.asa.asa_config: + commands: + - clear configure access-list ACL-INSERT + provider: '{{ cli }}' + +- debug: msg="END cli/insert.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/meta/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/meta/main.yaml new file mode 100644 index 00000000..23d65c7e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/meta/main.yaml @@ -0,0 +1,2 @@ +--- +dependencies: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tasks/cli.yaml new file mode 100644 index 00000000..4a37ae1f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tasks/cli.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tasks/main.yaml new file mode 100644 index 00000000..a3db933e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_parsed.cfg b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_parsed.cfg new file mode 100644 index 00000000..1dabc77c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_parsed.cfg @@ -0,0 +1,5 @@ +access-list test_access; 2 elements; name hash: 0xaf1b712e +access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors +access-list test_R1_traffic; 1 elements; name hash: 0xaf40d3c2 +access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..dafe55db --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_populate_config.yaml @@ -0,0 +1,62 @@ +--- +- name: Populate Config + cisco.asa.asa_acls: &id001 + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + log: errors + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + any: true + destination: + any: true + port_protocol: + eq: www + log: errors + - name: test_R1_traffic + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_populate_network_og.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_populate_network_og.yaml new file mode 100644 index 00000000..74e21f61 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_populate_network_og.yaml @@ -0,0 +1,21 @@ +--- +- name: Populate Network Object-group + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + network_object: + host: + - 192.0.3.1 + ipv6_address: + - 2001:db8:3::/64 + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..f2d64eab --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_remove_config.yaml @@ -0,0 +1,4 @@ +--- +- name: Remove Config + cisco.asa.asa_acls: + state: deleted diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_remove_og_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_remove_og_config.yaml new file mode 100644 index 00000000..50921c3b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/_remove_og_config.yaml @@ -0,0 +1,4 @@ +--- +- name: Remove configured Object group + cisco.asa.asa_ogs: + state: deleted diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/deleted.yaml new file mode 100644 index 00000000..00edc194 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/deleted.yaml @@ -0,0 +1,64 @@ +--- +- debug: + msg: Start Deleted integration state for asa_acls ansible_connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete attributes of provided configured ACLs + register: result + cisco.asa.asa_acls: &id001 + config: + acls: + - name: test_access + - name: test_global_access + state: deleted + + - assert: + that: + - result.commands|length == 3 + - result.changed == true + - result.commands|symmetric_difference(deleted.commands) == [] + + - name: Delete attributes of all configured interfaces (IDEMPOTENT) + register: result + cisco.asa.asa_acls: *id001 + + - name: Assert that the previous delete task was idempotent + assert: + that: + - result.commands|length == 0 + - result.changed == false + + - include_tasks: _remove_config.yaml + + - include_tasks: _populate_config.yaml + + - name: Delete all off ACLs configured + register: result + cisco.asa.asa_acls: &id002 + state: deleted + + - assert: + that: + - result.commands|length == 4 + - result.changed == true + - result.commands|symmetric_difference(delete_all.commands) == [] + + - name: Delete ACL attributes of provided configured interfaces based on AFI + (IDEMPOTENT) + register: result + cisco.asa.asa_acls: *id002 + + - name: Assert that the previous delete task was idempotent + assert: + that: + - result.commands|length == 0 + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/empty_config.yaml new file mode 100644 index 00000000..6f465b60 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/empty_config.yaml @@ -0,0 +1,59 @@ +--- +- debug: + msg: START asa_acls empty_config.yaml integration tests on connection={{ ansible_connection + }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_acls: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_acls: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_acls: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_acls: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_acls: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/gathered.yaml new file mode 100644 index 00000000..f9d44bfb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/gathered.yaml @@ -0,0 +1,24 @@ +--- +- debug: + msg: START asa_acls gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Gather the provided configuration with the exisiting running configuration + register: result + cisco.asa.asa_acls: + config: + state: gathered + + - assert: + that: + - gathered['config']['acls'] | symmetric_difference(result.gathered.acls) == [] + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/merged.yaml new file mode 100644 index 00000000..a1e10613 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/merged.yaml @@ -0,0 +1,130 @@ +--- +- debug: + msg: START Merged asa_acls state for integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_network_og.yaml + +- block: + + - name: Merge provided configuration with device configuration + register: result + cisco.asa.asa_acls: &id001 + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol: icmp + protocol_options: + icmp: + alternate_address: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + log: errors + - grant: deny + line: 3 + protocol: tcp + protocol_options: + tcp: true + source: + host: 198.51.110.0 + destination: + any: true + port_protocol: + eq: www + log: default + - grant: deny + line: 4 + protocol: tcp + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + any: true + destination: + any: true + port_protocol: + eq: www + log: errors + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + interface: management + destination: + interface: management + port_protocol: + eq: www + log: warnings + - name: test_R1_traffic + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: merged + + - assert: + that: + - result.commands|length == 7 + - result.changed == true + - result.commands|symmetric_difference(merged.commands) == [] + + - name: Merge provided configuration with device configuration (IDEMPOTENT) + register: result + cisco.asa.asa_acls: *id001 + + - name: Assert that the previous task was idempotent + assert: + that: + - result.commands|length == 0 + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + - include_tasks: _remove_og_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/overridden.yaml new file mode 100644 index 00000000..1e0378b2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/overridden.yaml @@ -0,0 +1,66 @@ +--- +- debug: + msg: START Overridden asa_acls state for integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_network_og.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Override device configuration of all interfaces with provided configuration + register: result + cisco.asa.asa_acls: &id001 + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + state: overridden + + - assert: + that: + - result.commands|length == 6 + - result.changed == true + - result.commands|symmetric_difference(overridden.commands) == [] + + - name: Override device configuration of all interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.asa.asa_acls: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result.commands|length == 0 + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + - include_tasks: _remove_og_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/parsed.yaml new file mode 100644 index 00000000..af24ffa4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START asa_acls parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse the commands for provided configuration + become: true + register: result + cisco.asa.asa_acls: + running_config: "{{ lookup('file', '_parsed.cfg') }}" + state: parsed + +- assert: + that: + - result.changed == false + - parsed['config']['acls']|symmetric_difference(result.parsed.acls) == [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/rendered.yaml new file mode 100644 index 00000000..6a448b9e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/rendered.yaml @@ -0,0 +1,112 @@ +--- +- debug: + msg: Start asa_acls rendered integration tests ansible_connection={{ ansible_connection + }} + +- block: + + - name: Rendered the provided configuration with the exisiting running configuration + register: result + cisco.asa.asa_acls: + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol: icmp + protocol_options: + icmp: + alternate_address: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + log: errors + - grant: deny + line: 3 + protocol: tcp + protocol_options: + tcp: true + source: + host: 198.51.110.0 + destination: + any: true + port_protocol: + eq: www + log: default + - grant: deny + line: 4 + protocol: tcp + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + any: true + destination: + any: true + port_protocol: + eq: www + log: errors + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + interface: management + destination: + interface: management + port_protocol: + eq: www + log: warnings + - name: test_R1_traffic + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: rendered + + - assert: + that: + - result.changed == false + - result.rendered|symmetric_difference(merged.commands) == [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/replaced.yaml new file mode 100644 index 00000000..16849c8f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/replaced.yaml @@ -0,0 +1,83 @@ +--- +- debug: + msg: START Replaced asa_acls state for integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_network_og.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Replaces device configuration of listed interfaces with provided configuration + register: result + cisco.asa.asa_acls: &id001 + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol: tcp + protocol_options: + tcp: true + source: + address: 192.0.3.0 + netmask: 255.255.255.0 + destination: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + state: replaced + + - assert: + that: + - result.commands|length == 6 + - result.changed == true + - result.commands|symmetric_difference(replaced.commands) == [] + + - name: Replaces device configuration of listed interfaces with provided configuration + (IDEMPOTENT) + register: result + cisco.asa.asa_acls: *id001 + + - name: Assert that task was idempotent + assert: + that: + - result.commands|length == 0 + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml + - include_tasks: _remove_og_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/rtt.yaml new file mode 100644 index 00000000..3fec4608 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/tests/cli/rtt.yaml @@ -0,0 +1,139 @@ +--- +- debug: + msg: START asa_acls round trip integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_network_og.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Apply the provided configuration (base config) + register: base_config + cisco.asa.asa_acls: + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + log: default + - grant: deny + line: 2 + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + log: errors + - name: test_global_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + any: true + destination: + any: true + port_protocol: + eq: www + log: errors + - name: test_R1_traffic + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + inactive: true + state: merged + + - name: Gather ACLs facts + cisco.asa.asa_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - acls + + - name: Apply the configuration which need to be reverted + register: result + cisco.asa.asa_acls: + config: + acls: + - name: test_access + acl_type: extended + aces: + - grant: deny + line: 1 + protocol_options: + tcp: true + source: + address: 192.0.4.0 + netmask: 255.255.255.0 + port_protocol: + eq: telnet + destination: + address: 192.0.5.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + - grant: deny + line: 2 + protocol_options: + tcp: true + source: + object_group: test_og_network + destination: + object_group: test_network_og + port_protocol: + eq: www + log: default + state: overridden + + - assert: + that: + - result.commands|length == 6 + - result.changed == true + - result.commands|symmetric_difference(overridden.commands) == [] + + - name: Revert back to base config using facts round trip + register: revert + cisco.asa.asa_acls: + config: "{{ ansible_facts['network_resources']['acls'] }}" + state: overridden + + - assert: + that: + - revert.commands|length == 6 + - revert.changed == true + - revert.commands|symmetric_difference(rtt.commands) == [] + always: + + - include_tasks: _remove_config.yaml + - include_tasks: _remove_og_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/vars/main.yaml new file mode 100644 index 00000000..281cb8d6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_acls/vars/main.yaml @@ -0,0 +1,158 @@ +--- +deleted: + commands: + - no access-list test_global_access line 1 extended deny tcp any any eq www log errors + - no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors + - no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +delete_all: + commands: + - no access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + - no access-list test_global_access line 1 extended deny tcp any any eq www log errors + - no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors + - no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default +merged: + commands: + - access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + - access-list test_access line 2 extended deny icmp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 alternate-address log errors + - access-list test_access line 3 extended deny tcp host 198.51.110.0 any eq www log default + - access-list test_access line 4 extended deny tcp object-group test_og_network object-group test_network_og eq www log default + - access-list test_global_access line 1 extended deny tcp any any eq www log errors + - access-list test_global_access line 2 extended deny tcp interface management interface management eq www log warnings + - access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive +replaced: + commands: + - no access-list test_global_access line 1 extended deny tcp any any eq www log errors + - no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors + - no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + - access-list test_access line 1 extended deny tcp 192.0.3.0 255.255.255.0 192.0.4.0 255.255.255.0 eq www log default + - access-list test_access line 2 extended deny tcp object-group test_og_network object-group test_network_og eq www log default + - access-list test_global_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www +overridden: + commands: + - no access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive + - no access-list test_global_access line 1 extended deny tcp any any eq www log errors + - no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors + - no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + - access-list test_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www + - access-list test_access line 2 extended deny tcp object-group test_og_network object-group test_network_og eq www log default +gathered: + config: + acls: + - aces: + - destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + grant: deny + line: 1 + log: default + protocol: tcp + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + - destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + grant: deny + line: 2 + log: errors + protocol: igrp + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + acl_type: extended + name: test_access + - aces: + - destination: + any: true + port_protocol: + eq: www + grant: deny + line: 1 + log: errors + protocol: tcp + protocol_options: + tcp: true + source: + any: true + acl_type: extended + name: test_global_access + - aces: + - destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + grant: deny + inactive: true + line: 1 + protocol: tcp + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + acl_type: extended + name: test_R1_traffic +parsed: + config: + acls: + - aces: + - destination: + address: 192.0.3.0 + netmask: 255.255.255.0 + port_protocol: + eq: www + grant: deny + line: 1 + log: default + protocol: tcp + protocol_options: + tcp: true + source: + address: 192.0.2.0 + netmask: 255.255.255.0 + - destination: + address: 198.51.110.0 + netmask: 255.255.255.0 + grant: deny + line: 2 + log: errors + protocol: igrp + protocol_options: + igrp: true + source: + address: 198.51.100.0 + netmask: 255.255.255.0 + acl_type: extended + name: test_access + - aces: + - destination: + address: 2001:fc8:0:4::/64 + port_protocol: + eq: telnet + grant: deny + inactive: true + line: 1 + protocol: tcp + protocol_options: + tcp: true + source: + address: 2001:db8:0:3::/64 + port_protocol: + eq: www + acl_type: extended + name: test_R1_traffic +rtt: + commands: + - no access-list test_access line 2 extended deny tcp object-group test_og_network object-group test_network_og eq www log default + - no access-list test_access line 1 extended deny tcp 192.0.4.0 255.255.255.0 eq telnet 192.0.5.0 255.255.255.0 eq www + - access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default + - access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors + - access-list test_global_access line 1 extended deny tcp any any eq www log errors + - access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tasks/cli.yaml new file mode 100644 index 00000000..05ca0d6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tasks/cli.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tasks/main.yaml new file mode 100644 index 00000000..a3db933e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/bad_operator.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/bad_operator.yaml new file mode 100644 index 00000000..6ba1e96a --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/bad_operator.yaml @@ -0,0 +1,20 @@ +--- +- debug: msg="START cli/bad_operator.yaml" + +- name: test bad operator + register: result + ignore_errors: true + cisco.asa.asa_command: + commands: + - show version + - show interfaces GigabitEthernet 0/0 + wait_for: + + - result[0] contains 'Description: Foo' + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END cli/bad_operator.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/contains.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/contains.yaml new file mode 100644 index 00000000..ea8960bd --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/contains.yaml @@ -0,0 +1,19 @@ +--- +- debug: msg="START cli/contains.yaml" + +- name: test contains operator + register: result + cisco.asa.asa_command: + commands: + - show version + - show interface + wait_for: + - result[0] contains 'Cisco Adaptive Security Appliance Software Version' + - result[1] contains 'Hardware' + +- assert: + that: + - result.changed == false + - result.stdout is defined + +- debug: msg="END cli/contains.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/invalid.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/invalid.yaml new file mode 100644 index 00000000..2cc9c6e7 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/invalid.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/invalid.yaml" + +- name: run invalid command + register: result + ignore_errors: true + cisco.asa.asa_command: + commands: + - show foo + +- assert: + that: + - result.failed + +- name: run commands that include invalid command + register: result + ignore_errors: true + cisco.asa.asa_command: + commands: + - show version + - show foo + +- assert: + that: + - result.failed + ignore_errors: true + +- debug: msg="END cli/invalid.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/output.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/output.yaml new file mode 100644 index 00000000..73a8780d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/output.yaml @@ -0,0 +1,28 @@ +--- +- debug: msg="START cli/output.yaml" + +- name: get output for single command + register: result + cisco.asa.asa_command: + commands: + - show version + +- assert: + that: + - result.changed == false + - result.stdout is defined + +- name: get output for multiple commands + register: result + cisco.asa.asa_command: + commands: + - show version + - show interface + +- assert: + that: + - result.changed == false + - result.stdout is defined + - result.stdout | length == 2 + +- debug: msg="END cli/output.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/timeout.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/timeout.yaml new file mode 100644 index 00000000..10f2e636 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_command/tests/cli/timeout.yaml @@ -0,0 +1,18 @@ +--- +- debug: msg="START cli/timeout.yaml" + +- name: test bad condition + register: result + ignore_errors: true + cisco.asa.asa_command: + commands: + - show version + wait_for: + - result[0] contains bad_value_string + +- assert: + that: + - result.failed == true + - result.msg is defined + +- debug: msg="END cli/timeout.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/cli.yaml new file mode 100644 index 00000000..05ca0d6b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/cli.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/main.yaml new file mode 100644 index 00000000..62cc1ae1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/main.yaml @@ -0,0 +1,7 @@ +--- +- include: cli.yaml + tags: + - cli + +- include: redirection.yaml + when: ansible_version.full is version('2.10.0', '>=') diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/redirection.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/redirection.yaml new file mode 100644 index 00000000..922d23fe --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tasks/redirection.yaml @@ -0,0 +1,18 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/redirection' + patterns: '{{ testcase }}.yaml' + register: test_cases + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/templates/basic/config.j2 b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/templates/basic/config.j2 new file mode 100644 index 00000000..779b731e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/templates/basic/config.j2 @@ -0,0 +1,3 @@ +object-group network OG-ANSIBLE-TEMPLATE + description this is a test + network-object host 192.168.99.12 diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/templates/defaults/config.j2 b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/templates/defaults/config.j2 new file mode 100644 index 00000000..762e73de --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/templates/defaults/config.j2 @@ -0,0 +1,4 @@ +object-group network OG-ANSIBLE-TEMPLATE-DEFAULT + description this is a test + network-object 10.0.0.0 255.255.255.0 + network-object 10.1.0.0 255.255.255.0 diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/backup.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/backup.yaml new file mode 100644 index 00000000..ef6dd275 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/backup.yaml @@ -0,0 +1,50 @@ +--- +- debug: msg="START cli/backup.yaml" + +- name: setup + ignore_errors: true + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE + +- name: collect any backup files + find: + paths: '{{ role_path }}/backup' + pattern: '{{ inventory_hostname_short }}_config*' + register: backup_files + connection: local + +- name: delete backup files + file: + path: '{{ item.path }}' + state: absent + with_items: '{{backup_files.files|default([])}}' + +- name: configure device with config + register: result + cisco.asa.asa_config: + src: basic/config.j2 + backup: true + +- assert: + that: + - result.changed == true + - result.updates is defined + +- name: collect any backup files + find: + paths: '{{ role_path }}/backup' + pattern: '{{ inventory_hostname_short }}_config*' + register: backup_files + connection: local + +- assert: + that: + - backup_files.files is defined + +- name: teardown + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE + +- debug: msg="END cli/backup.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/basic.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/basic.yaml new file mode 100644 index 00000000..e6ea89de --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/basic.yaml @@ -0,0 +1,35 @@ +--- +- debug: msg="START cli/basic.yaml" + +- name: setup + ignore_errors: true + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE + +- name: configure device with config + register: result + cisco.asa.asa_config: + src: basic/config.j2 + +- assert: + that: + - result.changed == true + - result.updates is defined + +- name: check device with config + register: result + cisco.asa.asa_config: + src: basic/config.j2 + +- assert: + that: + - result.changed == false + - result.updates is not defined + +- name: teardown + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE + +- debug: msg="END cli/basic.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/defaults.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/defaults.yaml new file mode 100644 index 00000000..f6583293 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/defaults.yaml @@ -0,0 +1,41 @@ +--- +- debug: msg="START cli/defaults.yaml" + +- name: setup + ignore_errors: true + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT + +- name: configure device with defaults included + register: result + cisco.asa.asa_config: + src: defaults/config.j2 + defaults: true + +- debug: var=result + +- assert: + that: + - result.changed == true + - result.updates is defined + +- name: check device with defaults included + register: result + cisco.asa.asa_config: + src: defaults/config.j2 + defaults: true + +- debug: var=result + +- assert: + that: + - result.changed == false + - result.updates is not defined + +- name: teardown + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT + +- debug: msg="END cli/defaults.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/force.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/force.yaml new file mode 100644 index 00000000..927d1485 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/force.yaml @@ -0,0 +1,37 @@ +--- +- debug: msg="START cli/force.yaml" + +- name: setup + ignore_errors: true + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT + +- name: configure device with config + register: result + cisco.asa.asa_config: + src: basic/config.j2 + match: none + +- assert: + that: + - result.changed == true + - result.updates is defined + +- name: check device with config + register: result + cisco.asa.asa_config: + src: basic/config.j2 + match: none + +- assert: + that: + - result.changed == true + - result.updates is defined + +- name: teardown + cisco.asa.asa_config: + commands: + - no object-group network OG-ANSIBLE-TEMPLATE-DEFAULT + +- debug: msg="END cli/force.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/more_system.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/more_system.yaml new file mode 100644 index 00000000..24d8d114 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/more_system.yaml @@ -0,0 +1,34 @@ +--- +- debug: msg="START cli/more_system.yaml" + +- name: Prepare tunnel-group + cisco.asa.asa_config: + before: tunnel-group 192.0.2.1 type ipsec-l2l + lines: + - tunnel-group 192.0.2.1 ipsec-attributes + +- name: Setup tunnel-group + cisco.asa.asa_config: + parents: tunnel-group 192.0.2.1 ipsec-attributes + lines: + - ikev1 pre-shared-key abc123 + passwords: true + +- name: Test idempotency + register: result + cisco.asa.asa_config: + parents: tunnel-group 192.0.2.1 ipsec-attributes + lines: + - ikev1 pre-shared-key abc123 + passwords: true + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - clear configure tunnel-group 192.0.2.1 + +- debug: msg="END cli/more_system.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/removal_error.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/removal_error.yaml new file mode 100644 index 00000000..a6357d67 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/removal_error.yaml @@ -0,0 +1,39 @@ +--- +- debug: msg="START cli/removal_error.yaml" + +- name: setup + ignore_errors: true + cisco.asa.asa_config: + commands: + - no object-group network OGA-GOOGLE-DNS + +- name: configure test object-group + register: result + cisco.asa.asa_config: + parents: object-group network OGA-GOOGLE-DNS + lines: network-object host 8.8.8.8 + +- name: configure test access-list + cisco.asa.asa_config: + lines: access-list ANSIBLE-DNS extended permit udp any object-group OGA-GOOGLE-DNS + eq domain + +- name: try to remove object-group (should fail) + ignore_errors: true + register: result + cisco.asa.asa_config: + commands: + - no object-group network OGA-GOOGLE-DNS + +- name: Last command should fail + assert: + that: + - result.failed == true + +- name: teardown + cisco.asa.asa_config: + commands: + - clear configure access-list ANSIBLE-DNS + - no object-group network OGA-GOOGLE-DNS + +- debug: msg="END cli/removal_error.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel.yaml new file mode 100644 index 00000000..17ff240c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel.yaml @@ -0,0 +1,40 @@ +--- +- debug: msg="START cli/sublevel.yaml" + +- name: setup test + cisco.asa.asa_config: + lines: + - no object-group network OG-ANSIBLE-SUBLEVEL + +- name: configure sub level command + register: result + cisco.asa.asa_config: + lines: + - network-object host 192.168.10.1 + parents: + - object-group network OG-ANSIBLE-SUBLEVEL + +- assert: + that: + - result.changed == true + - "'object-group network OG-ANSIBLE-SUBLEVEL' in result.updates" + - "'network-object host 192.168.10.1' in result.updates" + +- name: configure sub level command idempotent check + register: result + cisco.asa.asa_config: + lines: + - network-object host 192.168.10.1 + parents: + - object-group network OG-ANSIBLE-SUBLEVEL + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - no object-group network OG-ANSIBLE-SUBLEVEL + +- debug: msg="END cli/sublevel.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_block.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_block.yaml new file mode 100644 index 00000000..dfd91ca5 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_block.yaml @@ -0,0 +1,62 @@ +--- +- debug: msg="START cli/sublevel_block.yaml" + +- name: setup + register: object_group + cisco.asa.asa_command: + commands: + - show run object-group + +- name: setup + cisco.asa.asa_config: + lines: + - no object-group network OG-ANSIBLE + match: none + +- name: configure sub level command using block replace + register: result + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE + replace: block + after: + - exit + +- assert: + that: + - result.changed == true + - "'object-group network OG-ANSIBLE' in result.updates" + - "'network-object 192.168.10.0 255.255.255.0' in result.updates" + - "'network-object 192.168.20.0 255.255.255.0' in result.updates" + - "'network-object 192.168.30.0 255.255.255.0' in result.updates" + - "'network-object 192.168.40.0 255.255.255.0' in result.updates" + +- name: check sub level command using block replace + register: result + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE + replace: block + after: + - exit + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - no object-group network OG-ANSIBLE + +- debug: msg="END cli/sublevel_block.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_exact.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_exact.yaml new file mode 100644 index 00000000..6dc6032d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_exact.yaml @@ -0,0 +1,67 @@ +--- +- debug: msg="START cli/sublevel_exact.yaml" + +- name: setup + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + - network-object 192.168.50.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE-EXACT + before: + - no object-group network OG-ANSIBLE-EXACT + after: + - exit + +- name: configure sub level command using exact match + register: result + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE-EXACT + after: + - exit + match: exact + +- assert: + that: + - result.changed == true + - "'object-group network OG-ANSIBLE-EXACT' in result.updates" + - "'network-object 192.168.10.0 255.255.255.0' in result.updates" + - "'network-object 192.168.20.0 255.255.255.0' in result.updates" + - "'network-object 192.168.30.0 255.255.255.0' in result.updates" + - "'network-object 192.168.40.0 255.255.255.0' in result.updates" + - "'network-object 192.168.50.0 255.255.255.0' not in result.updates" + +- name: check sub level command using exact match + register: result + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + - network-object 192.168.50.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE-EXACT + after: + - exit + match: exact + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - no object-group network OG-ANSIBLE-EXACT + +- debug: msg="END cli/sublevel_exact.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_strict.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_strict.yaml new file mode 100644 index 00000000..79259e05 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_strict.yaml @@ -0,0 +1,63 @@ +--- +- debug: msg="START cli/sublevel_strict.yaml" + +- name: setup + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + - network-object 192.168.50.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE-STRICT + before: + - no object-group network OG-ANSIBLE-STRICT + after: + - exit + +- name: configure sub level command using strict match + register: result + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.20.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.40.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE-STRICT + match: strict + +- assert: + that: + - result.changed == false + +- name: check sub level command using strict match + register: result + cisco.asa.asa_config: + lines: + - network-object 192.168.10.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + - network-object 192.168.30.0 255.255.255.0 + parents: + - object-group network OG-ANSIBLE-STRICT + after: + - exit + match: strict + +- assert: + that: + - result.changed == true + - "'object-group network OG-ANSIBLE-STRICT' in result.updates" + - "'network-object 192.168.10.0 255.255.255.0' not in result.updates" + - "'network-object 192.168.30.0 255.255.255.0' in result.updates" + - "'network-object 192.168.30.0 255.255.255.0' in result.updates" + - "'network-object 192.168.40.0 255.255.255.0' not in result.updates" + - "'network-object 192.168.50.0 255.255.255.0' not in result.updates" + +- name: teardown + cisco.asa.asa_config: + lines: + - no object-group network OG-ANSIBLE-STRICT + +- debug: msg="END cli/sublevel_strict.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_strict_mul_parents.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_strict_mul_parents.yaml new file mode 100644 index 00000000..9998d7b9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/sublevel_strict_mul_parents.yaml @@ -0,0 +1,70 @@ +--- +- debug: msg="START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection}}" + +- name: setup + cisco.asa.asa_config: + lines: + - class-map c1 + - match default-inspection-traffic + - policy-map p1 + - class c1 + match: none + +- name: configure sub level command using strict match + register: result + cisco.asa.asa_config: + lines: + - inspect ftp + - inspect tftp + parents: + - policy-map p1 + - class c1 + match: strict + +- assert: + that: + - result.changed == true + - "'inspect ftp' in result.updates" + - "'inspect tftp' in result.updates" + +- name: change sub level command order and config with strict match + register: result + cisco.asa.asa_config: + lines: + - inspect tftp + - inspect ftp + parents: + - policy-map p1 + - class c1 + match: strict + +- assert: + that: + - result.changed == true + - "'inspect ftp' in result.updates" + - "'inspect tftp' in result.updates" + +- name: Config sub level command with strict match (Idempotency) + register: result + cisco.asa.asa_config: + lines: + - inspect ftp + - inspect tftp + parents: + - policy-map p1 + - class c1 + match: strict + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - no policy-map p1 + - no class-map c1 + match: strict + +- debug: msg="END cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel.yaml new file mode 100644 index 00000000..62e0b47d --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel.yaml @@ -0,0 +1,35 @@ +--- +- debug: msg="START cli/toplevel.yaml" + +- name: setup + cisco.asa.asa_config: + lines: + - hostname firewall + +- name: configure top level command + register: result + cisco.asa.asa_config: + lines: + - hostname foo + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.updates" + +- name: configure top level command idempotent check + register: result + cisco.asa.asa_config: + lines: + - hostname foo + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - hostname {{ inventory_hostname_short }} + +- debug: msg="END cli/toplevel.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_after.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_after.yaml new file mode 100644 index 00000000..0ea5bf5e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_after.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START cli/toplevel_after.yaml" + +- name: setup + cisco.asa.asa_config: + lines: + - snmp-server contact ansible + - hostname firewall + +- name: configure top level command with before + register: result + cisco.asa.asa_config: + lines: + - hostname foo + after: + - snmp-server contact bar + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.updates" + - "'snmp-server contact bar' in result.updates" + +- name: configure top level command with before idempotent check + register: result + cisco.asa.asa_config: + lines: + - hostname foo + after: + - snmp-server contact foo + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - no snmp-server contact + - hostname {{ inventory_hostname_short }} + +- debug: msg="END cli/toplevel_after.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_before.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_before.yaml new file mode 100644 index 00000000..37341bff --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_before.yaml @@ -0,0 +1,42 @@ +--- +- debug: msg="START cli/toplevel_before.yaml" + +- name: setup + cisco.asa.asa_config: + lines: + - snmp-server contact ansible + - hostname firewall + +- name: configure top level command with before + register: result + cisco.asa.asa_config: + lines: + - hostname foo + before: + - snmp-server contact bar + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.updates" + - "'snmp-server contact bar' in result.updates" + +- name: configure top level command with before idempotent check + register: result + cisco.asa.asa_config: + lines: + - hostname foo + before: + - snmp-server contact foo + +- assert: + that: + - result.changed == false + +- name: teardown + cisco.asa.asa_config: + lines: + - no snmp-server contact + - hostname {{ inventory_hostname_short }} + +- debug: msg="END cli/toplevel_before.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_nonidempotent.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_nonidempotent.yaml new file mode 100644 index 00000000..88382130 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/cli/toplevel_nonidempotent.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START cli/toplevel_nonidempotent.yaml" + +- name: setup + cisco.asa.asa_config: + backup: true + +- name: configure top level command + register: result + cisco.asa.asa_config: + lines: + - hostname foo + match: strict + +- assert: + that: + - result.changed == true + - "'hostname foo' in result.updates" + +- name: configure top level command idempotent check + register: result + cisco.asa.asa_config: + lines: + - hostname foo + match: strict + +- assert: + that: + - result.changed == true + +- name: teardown + cisco.asa.asa_config: + lines: + - hostname {{ inventory_hostname_short }} + +- debug: msg="END cli/toplevel_nonidempotent.yaml" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/redirection/shortname.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/redirection/shortname.yaml new file mode 100644 index 00000000..8c2a03e6 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_config/tests/redirection/shortname.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START redirection/shortname.yaml on connection={{ ansible_connection }}" + +- name: Use src with module alias + register: result + cisco.asa.config: + src: basic/config.j2 + +- assert: + that: + # make sure that the template content was read and not the path + - result.failed == false + +- name: use module alias to take configuration backup + register: result + cisco.asa.config: + backup: true + backup_options: + filename: backup_with_alias.cfg + dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' + +- assert: + that: + - result.changed == true + +- name: check if the backup file exist + find: + paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg' + register: backup_file + connection: local + +- assert: + that: + - backup_file.files is defined + +- debug: msg="END redirection/shortname.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/defaults/main.yaml new file mode 100644 index 00000000..a845c24b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tasks/cli.yaml new file mode 100644 index 00000000..c8efaa17 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tasks/cli.yaml @@ -0,0 +1,17 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: run test cases (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tasks/main.yaml new file mode 100644 index 00000000..a3db933e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/all_facts.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/all_facts.yaml new file mode 100644 index 00000000..f4ce2502 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/all_facts.yaml @@ -0,0 +1,26 @@ +--- +- debug: msg="START cli/all_facts.yaml on connection={{ ansible_connection }}" + +- name: test getting all facts + register: result + cisco.asa.asa_facts: + gather_subset: + - all + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - "'config' in result.ansible_facts.ansible_net_gather_subset" + - "'hardware' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_filesystems is defined + - result.ansible_facts.ansible_net_memfree_mb > 1 + - result.ansible_facts.ansible_net_memtotal_mb > 1 + +- assert: + that: '{{ item.value.spacetotal_kb }} > {{ item.value.spacefree_kb }}' + loop: "{{ lookup('dict', result.ansible_facts.ansible_net_filesystems_info, wantlist=True)\ + \ }}" + +- debug: msg="END cli/all_facts.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/default_facts.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/default_facts.yaml new file mode 100644 index 00000000..cd2e01dc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/default_facts.yaml @@ -0,0 +1,25 @@ +--- +- debug: msg="START cli/default_facts.yaml on connection={{ ansible_connection }}" + +- name: test getting default facts + register: result + cisco.asa.asa_facts: + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - "'hardware' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_filesystems is defined + - "'config' not in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_filesystems is defined + - result.ansible_facts.ansible_net_memtotal_mb > 10 + - result.ansible_facts.ansible_net_config is not defined + +- assert: + that: '{{ item.value.spacetotal_kb }} > {{ item.value.spacefree_kb }}' + loop: "{{ lookup('dict', result.ansible_facts.ansible_net_filesystems_info, wantlist=True)\ + \ }}" + +- debug: msg="END cli/default.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/invalid_subset.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/invalid_subset.yaml new file mode 100644 index 00000000..45371923 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/invalid_subset.yaml @@ -0,0 +1,36 @@ +--- +- debug: msg="START cli/invalid_subset.yaml on connection={{ ansible_connection + }}" + +- name: test invalid subset (foobar) + register: result + ignore_errors: true + cisco.asa.asa_facts: + gather_subset: + - foobar + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.failed == true + - result.msg == 'Subset must be one of [config, default, hardware], + got foobar' + +- name: test subset specified multiple times + register: result + ignore_errors: true + cisco.asa.asa_facts: + gather_subset: + - '!hardware' + - hardware + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - result.failed == true + - result.msg == 'Bad subset' + ignore_errors: true + +- debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/not_hardware.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/not_hardware.yaml new file mode 100644 index 00000000..c21fc46c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_facts/tests/cli/not_hardware.yaml @@ -0,0 +1,22 @@ +--- +- debug: msg="START cli/not_hardware_facts.yaml on connection={{ ansible_connection + }}" + +- name: test not hardware + register: result + cisco.asa.asa_facts: + gather_subset: + - '!hardware' + provider: '{{ cli }}' + +- assert: + that: + - result.changed == false + - "'config' in result.ansible_facts.ansible_net_gather_subset" + - "'default' in result.ansible_facts.ansible_net_gather_subset" + - "'hardware' not in result.ansible_facts.ansible_net_gather_subset" + - result.ansible_facts.ansible_net_filesystems is not defined + - result.ansible_facts.ansible_net_filesystems_info is not defined + +- debug: msg="END cli/not_hardware_facts.yaml on connection={{ ansible_connection + }}" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/defaults/main.yaml new file mode 100644 index 00000000..10c0fabc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/defaults/main.yaml @@ -0,0 +1,2 @@ +--- +testcase: '*' diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tasks/cli.yaml new file mode 100644 index 00000000..a0421f54 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tasks/cli.yaml @@ -0,0 +1,19 @@ +--- +- name: collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + register: test_cases + delegate_to: localhost + +- name: set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tasks/main.yaml new file mode 100644 index 00000000..a3db933e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tests/cli/asa_og.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tests/cli/asa_og.yaml new file mode 100644 index 00000000..1399b0e2 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_og/tests/cli/asa_og.yaml @@ -0,0 +1,516 @@ +--- +- name: remove test config if any + ignore_errors: true + cisco.asa.asa_config: + lines: + - no object-group network ansible_test_0 + - no object-group network ansible_test_1 + - no object-group network ansible_test_2 + - no object-group service ansible_test_3 tcp-udp + - no object-group service ansible_test_4 + - no object-group service ansible_test_5 + +- block: + + - set_fact: + name: ansible_test_0 + host_ip: + - 8.8.8.8 + - 8.8.4.4 + address: + - 10.0.0.0 255.0.0.0 + - 192.168.0.0 255.255.0.0 + - 172.16.0.0 255.255.0.0 + description: th1s_IS-a_D3scrIPt10n_3xaMple- + + - name: STAGE 0 + register: result + cisco.asa.asa_og: &id001 + name: '{{ name }}' + group_type: network-object + state: present + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + description: '{{ description }}' + + - assert: &id002 + that: + - result.changed == true + + - name: idempotence check + register: result + cisco.asa.asa_og: *id001 + + - assert: &id004 + that: + - result.changed == false + + - set_fact: + name: ansible_test_0 + host_ip: + - 8.8.9.9 + address: + - 8.8.8.0 255.255.255.0 + + - name: STAGE 1 + register: result + cisco.asa.asa_og: &id003 + name: '{{ name }}' + group_type: network-object + state: present + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id003 + + - assert: *id004 + + - name: STAGE 1/B + register: result + cisco.asa.asa_og: + name: '{{ name }}' + group_type: network-object + state: present + + - assert: *id004 + + - set_fact: + name: ansible_test_1 + host_ip: + - 8.8.9.9 + address: + - 8.8.8.0 255.255.255.0 + + - name: STAGE 2 + register: result + cisco.asa.asa_og: &id005 + name: '{{ name }}' + group_type: network-object + state: present + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id005 + + - assert: *id004 + + - name: STAGE 2b + register: result + cisco.asa.asa_og: &id006 + name: '{{ name }}' + group_type: network-object + state: present + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id006 + + - assert: *id004 + + - set_fact: + name: ansible_test_0 + host_ip: + - 8.8.8.8 + - 8.8.4.4 + address: + - 10.0.0.0 255.0.0.0 + - 192.168.0.0 255.255.0.0 + - 172.16.0.0 255.255.0.0 + description: th1s_IS-a_D3scrIPt10n_3xaMple- + + - name: STAGE 3 + register: result + cisco.asa.asa_og: &id007 + name: '{{ name }}' + group_type: network-object + state: absent + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id007 + + - assert: *id004 + + - set_fact: + name: ansible_test_2 + host_ip: + - 8.8.8.8 + - 8.8.4.4 + address: + - 10.0.0.0 255.0.0.0 + - 192.168.0.0 255.255.0.0 + - 172.16.0.0 255.255.0.0 + description: th1s_IS-a_D3scrIPt10n_3xaMple- + + - name: STAGE 4 + register: result + cisco.asa.asa_og: &id008 + name: '{{ name }}' + group_type: network-object + state: replace + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id008 + + - assert: *id004 + + - set_fact: + name: ansible_test_2 + host_ip: + - 8.8.8.8 + address: + - 10.0.0.0 255.0.0.0 + - 1.0.0.0 255.255.0.0 + description: th1s_IS-a_D3scrIPt10n_3xaMple- + + - name: STAGE 5 + register: result + cisco.asa.asa_og: &id009 + name: '{{ name }}' + group_type: network-object + state: replace + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id009 + + - assert: *id004 + + - set_fact: + name: ansible_test_2 + host_ip: + - 9.9.9.9 + - 8.8.8.8 + description: th1s_IS-a_D3scrIPt10n_3xaMple- + + - name: STAGE 6 + register: result + cisco.asa.asa_og: &id010 + name: '{{ name }}' + group_type: network-object + state: replace + host_ip: '{{ host_ip }}' + ip_mask: '{{ address }}' + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id010 + + - assert: *id004 + + - set_fact: + name: ansible_test_3 + port_eq: + - www + - '1024' + description: th1s_IS-a_D3scrIPt10n_3xaMple- + port_range: + - 1024 10024 + + - name: STAGE 7 + register: result + cisco.asa.asa_og: &id011 + name: '{{ name }}' + protocol: tcp-udp + port_eq: '{{ port_eq }}' + port_range: '{{ port_range }}' + group_type: port-object + state: present + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id011 + + - assert: *id004 + + - set_fact: + name: ansible_test_3 + port_eq: + - talk + - '65535' + description: th1s_IS-a_D3scrIPt10n_3xaMple- + port_range: + - 1 100 + + - name: STAGE 8 + register: result + cisco.asa.asa_og: &id012 + name: '{{ name }}' + protocol: tcp-udp + port_eq: '{{ port_eq }}' + port_range: '{{ port_range }}' + group_type: port-object + state: present + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id012 + + - assert: *id004 + + - name: STAGE 9 + register: result + cisco.asa.asa_og: &id013 + name: '{{ name }}' + protocol: tcp-udp + port_eq: '{{ port_eq }}' + port_range: '{{ port_range }}' + group_type: port-object + state: absent + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id013 + + - assert: *id004 + + - set_fact: + name: ansible_test_3 + port_eq: + - talk + - '65535' + description: th1s_IS-a_D3scrIPt10n_3xaMple- + port_range: + - 1 100 + + - name: STAGE 10 + register: result + cisco.asa.asa_og: &id014 + name: '{{ name }}' + protocol: tcp-udp + port_eq: '{{ port_eq }}' + port_range: '{{ port_range }}' + group_type: port-object + state: replace + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id014 + + - assert: *id004 + + - set_fact: + name: ansible_test_3 + port_eq: + - talk + - www + - kerberos + description: th1s_ISWhatitIS + port_range: + - 1024 1234 + + - name: STAGE 11 + register: result + cisco.asa.asa_og: &id015 + name: '{{ name }}' + protocol: tcp-udp + port_eq: '{{ port_eq }}' + port_range: '{{ port_range }}' + group_type: port-object + state: replace + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id015 + + - assert: *id004 + + - set_fact: + name: ansible_test_4 + service_cfg: + - tcp destination eq 8080 + - tcp destination eq www + description: th1s_ISWhatitIS + + - name: STAGE 12 + register: result + cisco.asa.asa_og: &id016 + name: '{{ name }}' + service_cfg: '{{ service_cfg }}' + group_type: service-object + state: present + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id016 + + - assert: *id004 + + - set_fact: + name: ansible_test_4 + service_cfg: + - tcp destination range 1234 5678 + - tcp destination range 5678 6789 + description: th1s_ISWhatitIS + + - name: STAGE 13 + register: result + cisco.asa.asa_og: &id017 + name: '{{ name }}' + service_cfg: '{{ service_cfg }}' + group_type: service-object + state: present + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id017 + + - assert: *id004 + + - set_fact: + name: ansible_test_4 + service_cfg: + - tcp destination range 1234 5678 + - tcp destination range 5678 6789 + description: th1s_ISWhatitIS + + - name: STAGE 14 + register: result + cisco.asa.asa_og: &id018 + name: '{{ name }}' + service_cfg: '{{ service_cfg }}' + group_type: service-object + state: absent + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id018 + + - assert: *id004 + + - set_fact: + name: ansible_test_5 + service_cfg: + - tcp destination range 1234 5678 + - tcp destination range 5678 6789 + description: th1s_ISWhatitIS + + - name: STAGE 15 + register: result + cisco.asa.asa_og: &id019 + name: '{{ name }}' + service_cfg: '{{ service_cfg }}' + group_type: service-object + state: replace + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id019 + + - assert: *id004 + + - set_fact: + name: ansible_test_5 + service_cfg: + - tcp destination range 1234 5678 + - tcp destination range 5678 6789 + - tcp destination eq www + description: th1s_ISWhatitIS + + - name: STAGE 16 + register: result + cisco.asa.asa_og: &id020 + name: '{{ name }}' + service_cfg: '{{ service_cfg }}' + group_type: service-object + state: replace + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id020 + + - assert: *id004 + + - set_fact: + name: ansible_test_5 + service_cfg: + - tcp destination eq 8080 + description: th1s_ISWhatitIS + + - name: STAGE 17 + register: result + cisco.asa.asa_og: &id021 + name: '{{ name }}' + service_cfg: '{{ service_cfg }}' + group_type: service-object + state: replace + description: '{{ description }}' + + - assert: *id002 + + - name: idempotence check + register: result + cisco.asa.asa_og: *id021 + + - assert: *id004 + + always: + - name: remove test config if any + ignore_errors: true + cisco.asa.asa_config: + lines: + - no object-group network ansible_test_0 + - no object-group network ansible_test_1 + - no object-group network ansible_test_2 + - no object-group service ansible_test_3 tcp-udp + - no object-group service ansible_test_4 + - no object-group service ansible_test_5 diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/defaults/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/defaults/main.yaml new file mode 100644 index 00000000..852a6bee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/defaults/main.yaml @@ -0,0 +1,3 @@ +--- +testcase: '[^_].*' +test_items: [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tasks/cli.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tasks/cli.yaml new file mode 100644 index 00000000..4a37ae1f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tasks/cli.yaml @@ -0,0 +1,21 @@ +--- +- name: Collect all cli test cases + find: + paths: '{{ role_path }}/tests/cli' + patterns: '{{ testcase }}.yaml' + use_regex: true + register: test_cases + delegate_to: localhost + +- name: Set test_items + set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + delegate_to: localhost + +- name: Run test case (connection=ansible.netcommon.network_cli) + include: '{{ test_case_to_run }}' + vars: + ansible_connection: ansible.netcommon.network_cli + with_items: '{{ test_items }}' + loop_control: + loop_var: test_case_to_run + tags: connection_network_cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tasks/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tasks/main.yaml new file mode 100644 index 00000000..a3db933e --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tasks/main.yaml @@ -0,0 +1,4 @@ +--- +- include: cli.yaml + tags: + - cli diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_parsed.cfg b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_parsed.cfg new file mode 100644 index 00000000..ead97272 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_parsed.cfg @@ -0,0 +1,8 @@ +object-group network test_og_network + description test_og_network + network-object host 192.0.2.1 + network-object 192.0.2.0 255.255.255.0 +object-group network test_network_og + network-object 2001:db8:3::/64 +object-group service test_og_service + service-object tcp-udp
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_populate_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_populate_config.yaml new file mode 100644 index 00000000..ec02e549 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_populate_config.yaml @@ -0,0 +1,45 @@ +--- +- name: Populate Config + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: merged diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_remove_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_remove_config.yaml new file mode 100644 index 00000000..53a5bb95 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/_remove_config.yaml @@ -0,0 +1,4 @@ +--- +- name: Remove Config + cisco.asa.asa_ogs: + state: deleted diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/deleted.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/deleted.yaml new file mode 100644 index 00000000..921ea76c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/deleted.yaml @@ -0,0 +1,61 @@ +--- +- debug: + msg: Start asa_ogs deleted integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- include_tasks: _populate_config.yaml + +- block: + + - name: Delete given module attributes + register: result + cisco.asa.asa_ogs: &id001 + config: + - object_type: network + object_groups: + - name: test_og_network + - object_type: security + object_groups: + - name: test_og_security + state: deleted + + - assert: + that: + - result.commands|length == 2 + - result.changed == true + - result.commands|symmetric_difference(deleted.commands) == [] + + - name: Delete given module attributes (IDEMPOTENT) + register: result + cisco.asa.asa_ogs: *id001 + + - assert: + that: + - result.changed == false + + - include_tasks: _populate_config.yaml + + - name: Delete ALL configured module attributes + register: result + cisco.asa.asa_ogs: + state: deleted + + - assert: + that: + - result.commands|length == 4 + - result.changed == true + - result.commands|symmetric_difference(delete_all.commands) == [] + + - name: Delete ALL configured module attributes (IDEMPOTENT) + register: result + cisco.asa.asa_ogs: + state: deleted + + - assert: + that: + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/empty_config.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/empty_config.yaml new file mode 100644 index 00000000..3b0deb5c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/empty_config.yaml @@ -0,0 +1,60 @@ +--- +- debug: + msg: START asa_ogs empty_config.yaml integration tests on connection={{ + ansible_connection }} + +- name: Merged with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_ogs: + config: + state: merged + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state merged' + +- name: Replaced with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_ogs: + config: + state: replaced + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state replaced' + +- name: Overridden with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_ogs: + config: + state: overridden + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state overridden' + +- name: Rendered with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_ogs: + config: + state: rendered + +- assert: + that: + - result.msg == 'value of config parameter must not be empty for state rendered' + +- name: Parsed with empty config should give appropriate error message + register: result + ignore_errors: true + cisco.asa.asa_ogs: + running_config: + state: parsed + +- assert: + that: + - result.msg == 'value of running_config parameter must not be empty for state + parsed' diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/gathered.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/gathered.yaml new file mode 100644 index 00000000..21f404c3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/gathered.yaml @@ -0,0 +1,63 @@ +--- +- debug: + msg: START asa_ogs gathered integration tests on connection={{ ansible_connection + }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Populate Config for Gather facts + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + address: + - 192.0.2.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + tag: + - 10 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: merged + + - name: Gather the provided configuration with the exisiting running configuration + register: result + cisco.asa.asa_ogs: + config: + state: gathered + + - name: Assert + assert: + that: + - gathered['config'] | symmetric_difference(result.gathered) == [] + - result['changed'] == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/merged.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/merged.yaml new file mode 100644 index 00000000..aac3b3ff --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/merged.yaml @@ -0,0 +1,73 @@ +--- +- debug: + msg: Start asa_ogs merged integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Merge the provided configuration with the exisiting running configuration + register: result + cisco.asa.asa_ogs: &id001 + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: merged + + - assert: + that: + - result.commands|length == 21 + - result.changed == true + - result.commands|symmetric_difference(merged.commands) == [] + + - name: Merge the provided configuration with the exisiting running configuration + (IDEMPOTENT) + register: result + cisco.asa.asa_ogs: *id001 + + - assert: + that: + - result.commands|length == 0 + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/overridden.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/overridden.yaml new file mode 100644 index 00000000..d153a9ae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/overridden.yaml @@ -0,0 +1,52 @@ +--- +- debug: + msg: Start asa_ogs overridden integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Overridden module attributes of given object-group + become: true + register: result + cisco.asa.asa_ogs: &id001 + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_override + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: overridden + + - assert: + that: + - result.commands|length == 15 + - result.changed == true + - result.commands|symmetric_difference(overridden.commands) == [] + + - name: Overridden module attributes of given object-group (IDEMPOTENT) + become: true + register: result + cisco.asa.asa_ogs: *id001 + + - assert: + that: + - result.commands|length == 0 + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/parsed.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/parsed.yaml new file mode 100644 index 00000000..638a9ed4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/parsed.yaml @@ -0,0 +1,16 @@ +--- +- debug: + msg: START asa_ogs parsed integration tests on connection={{ ansible_connection + }} + +- name: Parse the commands for provided configuration + become: true + register: result + cisco.asa.asa_ogs: + running_config: "{{ lookup('file', '_parsed.cfg') }}" + state: parsed + +- assert: + that: + - result.changed == false + - parsed['config']|symmetric_difference(result.parsed) == [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/rendered.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/rendered.yaml new file mode 100644 index 00000000..d7098b76 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/rendered.yaml @@ -0,0 +1,58 @@ +--- +- debug: + msg: Start asa_ogs rendered integration tests ansible_connection={{ + ansible_connection }} + +- block: + + - name: Render the commands for provided configuration + become: true + register: result + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: rendered + + - assert: + that: + - result.changed == false + - result.rendered|symmetric_difference(merged.commands) == [] diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/replaced.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/replaced.yaml new file mode 100644 index 00000000..990f12c9 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/replaced.yaml @@ -0,0 +1,52 @@ +--- +- debug: + msg: Start asa_ogs replced integration tests ansible_connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml +- include_tasks: _populate_config.yaml + +- block: + + - name: Replace module attributes of given object-group + become: true + register: result + cisco.asa.asa_ogs: &id001 + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_replace + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: replaced + + - assert: + that: + - result.commands|length == 12 + - result.changed == true + - result.commands|symmetric_difference(replaced.commands) == [] + + - name: Replace module attributes of given object-group (IDEMPOTENT) + become: true + register: result + cisco.asa.asa_ogs: *id001 + + - assert: + that: + - result.commands|length == 0 + - result.changed == false + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/rtt.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/rtt.yaml new file mode 100644 index 00000000..7733ae0f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/tests/cli/rtt.yaml @@ -0,0 +1,106 @@ +--- +- debug: + msg: START asa_ogs round trip integration tests on connection={{ + ansible_connection }} + +- include_tasks: _remove_config.yaml + +- block: + + - name: Apply the provided configuration (Base config) + register: base_config + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network + network_object: + host: + - 192.0.2.1 + - 192.0.2.2 + address: + - 192.0.2.0 255.255.255.0 + - 198.51.100.0 255.255.255.0 + - name: test_network_og + description: test_network_og + network_object: + host: + - 192.0.3.1 + - 192.0.3.2 + ipv6_address: + - 2001:db8:3::/64 + - object_type: security + object_groups: + - name: test_og_security + description: test_security + security_group: + sec_name: + - test_1 + - test_2 + tag: + - 10 + - 20 + - object_type: user + object_groups: + - name: test_og_user + description: test_user + user_object: + user: + - name: new_user_1 + domain: LOCAL + - name: new_user_2 + domain: LOCAL + state: merged + + - name: Gather Object group facts + cisco.asa.asa_facts: + gather_subset: + - '!all' + - '!min' + gather_network_resources: + - ogs + + - name: Apply the provided configuration (config to be reverted) + register: result + cisco.asa.asa_ogs: + config: + - object_type: network + object_groups: + - name: test_og_network + description: test_og_network_override + network_object: + host: + - 192.0.3.1 + address: + - 192.0.3.0 255.255.255.0 + - object_type: protocol + object_groups: + - name: test_og_protocol + description: test_og_protocol + protocol_object: + protocol: + - tcp + - udp + state: overridden + + - assert: + that: + - result.commands|length == 15 + - result.changed == true + - result.commands|symmetric_difference(overridden.commands) == [] + + - name: Revert back to base config using facts round trip + register: revert + cisco.asa.asa_ogs: + config: "{{ ansible_facts['network_resources']['ogs'] }}" + state: overridden + + - assert: + that: + - revert.commands|length == 24 + - revert.changed == true + - revert.commands|symmetric_difference(rtt.commands) == [] + always: + + - include_tasks: _remove_config.yaml diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/vars/main.yaml b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/vars/main.yaml new file mode 100644 index 00000000..0249da18 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/integration/targets/asa_ogs/vars/main.yaml @@ -0,0 +1,149 @@ +--- +deleted: + commands: + - no object-group network test_og_network + - no object-group security test_og_security +delete_all: + commands: + - no object-group network test_og_network + - no object-group network test_network_og + - no object-group security test_og_security + - no object-group user test_og_user +merged: + commands: + - object-group security test_og_security + - description test_security + - security-group name test_1 + - security-group name test_2 + - security-group tag 10 + - security-group tag 20 + - object-group network test_og_network + - description test_og_network + - network-object 192.0.2.0 255.255.255.0 + - network-object 198.51.100.0 255.255.255.0 + - network-object host 192.0.2.1 + - network-object host 192.0.2.2 + - object-group network test_network_og + - description test_network_og + - network-object host 192.0.3.1 + - network-object host 192.0.3.2 + - network-object 2001:db8:3::/64 + - object-group user test_og_user + - description test_user + - user LOCAL\new_user_1 + - user LOCAL\new_user_2 +replaced: + commands: + - object-group protocol test_og_protocol + - description test_og_protocol + - protocol tcp + - protocol udp + - object-group network test_og_network + - description test_og_network_replace + - no network-object 192.0.2.0 255.255.255.0 + - no network-object 198.51.100.0 255.255.255.0 + - network-object 192.0.3.0 255.255.255.0 + - no network-object host 192.0.2.1 + - no network-object host 192.0.2.2 + - network-object host 192.0.3.1 +overridden: + commands: + - no object-group security test_og_security + - no object-group user test_og_user + - object-group protocol test_og_protocol + - description test_og_protocol + - protocol tcp + - protocol udp + - object-group network test_og_network + - description test_og_network_override + - no network-object 192.0.2.0 255.255.255.0 + - no network-object 198.51.100.0 255.255.255.0 + - network-object 192.0.3.0 255.255.255.0 + - no network-object host 192.0.2.1 + - no network-object host 192.0.2.2 + - network-object host 192.0.3.1 + - no object-group network test_network_og +gathered: + config: + - object_groups: + - description: test_network_og + name: test_network_og + network_object: + host: + - 192.0.3.1 + ipv6_address: + - 2001:db8:3::/64 + - description: test_og_network + name: test_og_network + network_object: + address: + - 192.0.2.0 255.255.255.0 + host: + - 192.0.2.1 + object_type: network + - object_groups: + - description: test_security + name: test_og_security + security_group: + sec_name: + - test_1 + tag: + - "10" + object_type: security + - object_groups: + - description: test_user + name: test_og_user + user_object: + user: + - domain: LOCAL + name: new_user_1 + - domain: LOCAL + name: new_user_2 + object_type: user +parsed: + config: + - object_groups: + - name: test_network_og + network_object: + ipv6_address: + - 2001:db8:3::/64 + - description: test_og_network + name: test_og_network + network_object: + address: + - 192.0.2.0 255.255.255.0 + host: + - 192.0.2.1 + object_type: network + - object_groups: + - name: test_og_service + service_object: + protocol: + - tcp-udp + object_type: service +rtt: + commands: + - no object-group protocol test_og_protocol + - object-group security test_og_security + - description test_security + - security-group name test_2 + - security-group name test_1 + - security-group tag 10 + - security-group tag 20 + - object-group network test_og_network + - description test_og_network + - no network-object 192.0.3.0 255.255.255.0 + - network-object 192.0.2.0 255.255.255.0 + - network-object 198.51.100.0 255.255.255.0 + - no network-object host 192.0.3.1 + - network-object host 192.0.2.1 + - network-object host 192.0.2.2 + - object-group network test_network_og + - description test_network_og + - network-object host 192.0.3.1 + - network-object host 192.0.3.2 + - network-object 2001:db8:3::/64 + - object-group user test_og_user + - description test_user + - user LOCAL\new_user_1 + - user LOCAL\new_user_2 diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/ignore-2.10.txt b/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/ignore-2.10.txt new file mode 100644 index 00000000..3d2a4f58 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/ignore-2.10.txt @@ -0,0 +1 @@ +plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/ignore-2.9.txt b/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/ignore-2.9.txt new file mode 100644 index 00000000..f7c35cc1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/ignore-2.9.txt @@ -0,0 +1,5 @@ +plugins/modules/asa_acl.py validate-modules:deprecation-mismatch +plugins/modules/asa_acl.py validate-modules:invalid-documentation +plugins/modules/asa_og.py validate-modules:deprecation-mismatch +plugins/modules/asa_og.py validate-modules:invalid-documentation +plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/requirements.txt b/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/requirements.txt new file mode 100644 index 00000000..3e3a9669 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/sanity/requirements.txt @@ -0,0 +1,4 @@ +packaging # needed for update-bundled and changelog +sphinx ; python_version >= '3.5' # docs build requires python 3+ +sphinx-notfound-page ; python_version >= '3.5' # docs build requires python 3+ +straight.plugin ; python_version >= '3.5' # needed for hacking/build-ansible.py which will host changelog generation and requires python 3+ diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/builtins.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/builtins.py new file mode 100644 index 00000000..bfc8adfb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/builtins.py @@ -0,0 +1,34 @@ +# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +# +# Compat for python2.7 +# + +# One unittest needs to import builtins via __import__() so we need to have +# the string that represents it +try: + import __builtin__ +except ImportError: + BUILTINS = "builtins" +else: + BUILTINS = "__builtin__" diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/mock.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/mock.py new file mode 100644 index 00000000..2ea98a17 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/mock.py @@ -0,0 +1,128 @@ +# pylint: skip-file +# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +""" +Compat module for Python3.x's unittest.mock module +""" +import sys + +# Python 2.7 + +# Note: Could use the pypi mock library on python3.x as well as python2.x. It +# is the same as the python3 stdlib mock library + +try: + # Allow wildcard import because we really do want to import all of mock's + # symbols into this compat shim + # pylint: disable=wildcard-import,unused-wildcard-import + from unittest.mock import * +except ImportError: + # Python 2 + # pylint: disable=wildcard-import,unused-wildcard-import + try: + from mock import * + except ImportError: + print("You need the mock library installed on python2.x to run tests") + + +# Prior to 3.4.4, mock_open cannot handle binary read_data +if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): + file_spec = None + + def _iterate_read_data(read_data): + # Helper for mock_open: + # Retrieve lines from read_data via a generator so that separate calls to + # readline, read, and readlines are properly interleaved + sep = b"\n" if isinstance(read_data, bytes) else "\n" + data_as_list = [l + sep for l in read_data.split(sep)] + + if data_as_list[-1] == sep: + # If the last line ended in a newline, the list comprehension will have an + # extra entry that's just a newline. Remove this. + data_as_list = data_as_list[:-1] + else: + # If there wasn't an extra newline by itself, then the file being + # emulated doesn't have a newline to end the last line remove the + # newline that our naive format() added + data_as_list[-1] = data_as_list[-1][:-1] + + for line in data_as_list: + yield line + + def mock_open(mock=None, read_data=""): + """ + A helper function to create a mock to replace the use of `open`. It works + for `open` called directly or used as a context manager. + + The `mock` argument is the mock object to configure. If `None` (the + default) then a `MagicMock` will be created for you, with the API limited + to methods or attributes available on standard file handles. + + `read_data` is a string for the `read` methoddline`, and `readlines` of the + file handle to return. This is an empty string by default. + """ + + def _readlines_side_effect(*args, **kwargs): + if handle.readlines.return_value is not None: + return handle.readlines.return_value + return list(_data) + + def _read_side_effect(*args, **kwargs): + if handle.read.return_value is not None: + return handle.read.return_value + return type(read_data)().join(_data) + + def _readline_side_effect(): + if handle.readline.return_value is not None: + while True: + yield handle.readline.return_value + for line in _data: + yield line + + global file_spec + if file_spec is None: + import _io + + file_spec = list( + set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))) + ) + + if mock is None: + mock = MagicMock(name="open", spec=open) + + handle = MagicMock(spec=file_spec) + handle.__enter__.return_value = handle + + _data = _iterate_read_data(read_data) + + handle.write.return_value = None + handle.read.return_value = None + handle.readline.return_value = None + handle.readlines.return_value = None + + handle.read.side_effect = _read_side_effect + handle.readline.side_effect = _readline_side_effect() + handle.readlines.side_effect = _readlines_side_effect + + mock.return_value = handle + return mock diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/unittest.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/unittest.py new file mode 100644 index 00000000..df3379b8 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/compat/unittest.py @@ -0,0 +1,39 @@ +# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +""" +Compat module for Python2.7's unittest module +""" + +import sys + +# Allow wildcard import because we really do want to import all of +# unittests's symbols into this compat shim +# pylint: disable=wildcard-import,unused-wildcard-import +if sys.version_info < (2, 7): + try: + # Need unittest2 on python2.6 + from unittest2 import * + except ImportError: + print("You need unittest2 installed on python2.6.x to run tests") +else: + from unittest import * diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/loader.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/loader.py new file mode 100644 index 00000000..c21188ee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/loader.py @@ -0,0 +1,116 @@ +# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import os + +from ansible.errors import AnsibleParserError +from ansible.parsing.dataloader import DataLoader +from ansible.module_utils._text import to_bytes, to_text + + +class DictDataLoader(DataLoader): + def __init__(self, file_mapping=None): + file_mapping = {} if file_mapping is None else file_mapping + assert type(file_mapping) == dict + + super(DictDataLoader, self).__init__() + + self._file_mapping = file_mapping + self._build_known_directories() + self._vault_secrets = None + + def load_from_file(self, path, cache=True, unsafe=False): + path = to_text(path) + if path in self._file_mapping: + return self.load(self._file_mapping[path], path) + return None + + # TODO: the real _get_file_contents returns a bytestring, so we actually convert the + # unicode/text it's created with to utf-8 + def _get_file_contents(self, path): + path = to_text(path) + if path in self._file_mapping: + return (to_bytes(self._file_mapping[path]), False) + else: + raise AnsibleParserError("file not found: %s" % path) + + def path_exists(self, path): + path = to_text(path) + return path in self._file_mapping or path in self._known_directories + + def is_file(self, path): + path = to_text(path) + return path in self._file_mapping + + def is_directory(self, path): + path = to_text(path) + return path in self._known_directories + + def list_directory(self, path): + ret = [] + path = to_text(path) + for x in list(self._file_mapping.keys()) + self._known_directories: + if x.startswith(path): + if os.path.dirname(x) == path: + ret.append(os.path.basename(x)) + return ret + + def is_executable(self, path): + # FIXME: figure out a way to make paths return true for this + return False + + def _add_known_directory(self, directory): + if directory not in self._known_directories: + self._known_directories.append(directory) + + def _build_known_directories(self): + self._known_directories = [] + for path in self._file_mapping: + dirname = os.path.dirname(path) + while dirname not in ("/", ""): + self._add_known_directory(dirname) + dirname = os.path.dirname(dirname) + + def push(self, path, content): + rebuild_dirs = False + if path not in self._file_mapping: + rebuild_dirs = True + + self._file_mapping[path] = content + + if rebuild_dirs: + self._build_known_directories() + + def pop(self, path): + if path in self._file_mapping: + del self._file_mapping[path] + self._build_known_directories() + + def clear(self): + self._file_mapping = dict() + self._known_directories = [] + + def get_basedir(self): + return os.getcwd() + + def set_vault_secrets(self, vault_secrets): + self._vault_secrets = vault_secrets diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/path.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/path.py new file mode 100644 index 00000000..3bd0cdee --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/path.py @@ -0,0 +1,10 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +from ansible_collections.cisco.asa.tests.unit.compat.mock import MagicMock +from ansible.utils.path import unfrackpath + + +mock_unfrackpath_noop = MagicMock( + spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x +) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/procenv.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/procenv.py new file mode 100644 index 00000000..e02cae04 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/procenv.py @@ -0,0 +1,94 @@ +# (c) 2016, Matt Davis <mdavis@ansible.com> +# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com> +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import sys +import json + +from contextlib import contextmanager +from io import BytesIO, StringIO +from ansible_collections.cisco.asa.tests.unit.compat import unittest +from ansible.module_utils.six import PY3 +from ansible.module_utils._text import to_bytes + + +@contextmanager +def swap_stdin_and_argv(stdin_data="", argv_data=tuple()): + """ + context manager that temporarily masks the test runner's values for stdin and argv + """ + real_stdin = sys.stdin + real_argv = sys.argv + + if PY3: + fake_stream = StringIO(stdin_data) + fake_stream.buffer = BytesIO(to_bytes(stdin_data)) + else: + fake_stream = BytesIO(to_bytes(stdin_data)) + + try: + sys.stdin = fake_stream + sys.argv = argv_data + + yield + finally: + sys.stdin = real_stdin + sys.argv = real_argv + + +@contextmanager +def swap_stdout(): + """ + context manager that temporarily replaces stdout for tests that need to verify output + """ + old_stdout = sys.stdout + + if PY3: + fake_stream = StringIO() + else: + fake_stream = BytesIO() + + try: + sys.stdout = fake_stream + + yield fake_stream + finally: + sys.stdout = old_stdout + + +class ModuleTestCase(unittest.TestCase): + def setUp(self, module_args=None): + if module_args is None: + module_args = { + "_ansible_remote_tmp": "/tmp", + "_ansible_keep_remote_files": False, + } + + args = json.dumps(dict(ANSIBLE_MODULE_ARGS=module_args)) + + # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually + self.stdin_swap = swap_stdin_and_argv(stdin_data=args) + self.stdin_swap.__enter__() + + def tearDown(self): + # unittest doesn't have a clean place to use a context manager, so we have to enter/exit manually + self.stdin_swap.__exit__(None, None, None) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/vault_helper.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/vault_helper.py new file mode 100644 index 00000000..b34ae134 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/vault_helper.py @@ -0,0 +1,42 @@ +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible.module_utils._text import to_bytes + +from ansible.parsing.vault import VaultSecret + + +class TextVaultSecret(VaultSecret): + """A secret piece of text. ie, a password. Tracks text encoding. + + The text encoding of the text may not be the default text encoding so + we keep track of the encoding so we encode it to the same bytes.""" + + def __init__(self, text, encoding=None, errors=None, _bytes=None): + super(TextVaultSecret, self).__init__() + self.text = text + self.encoding = encoding or "utf-8" + self._bytes = _bytes + self.errors = errors or "strict" + + @property + def bytes(self): + """The text encoded with encoding, unless we specifically set _bytes.""" + return self._bytes or to_bytes( + self.text, encoding=self.encoding, errors=self.errors + ) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/yaml_helper.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/yaml_helper.py new file mode 100644 index 00000000..5df30aae --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/mock/yaml_helper.py @@ -0,0 +1,167 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import io +import yaml + +from ansible.module_utils.six import PY3 +from ansible.parsing.yaml.loader import AnsibleLoader +from ansible.parsing.yaml.dumper import AnsibleDumper + + +class YamlTestUtils(object): + """Mixin class to combine with a unittest.TestCase subclass.""" + + def _loader(self, stream): + """Vault related tests will want to override this. + + Vault cases should setup a AnsibleLoader that has the vault password.""" + return AnsibleLoader(stream) + + def _dump_stream(self, obj, stream, dumper=None): + """Dump to a py2-unicode or py3-string stream.""" + if PY3: + return yaml.dump(obj, stream, Dumper=dumper) + else: + return yaml.dump(obj, stream, Dumper=dumper, encoding=None) + + def _dump_string(self, obj, dumper=None): + """Dump to a py2-unicode or py3-string""" + if PY3: + return yaml.dump(obj, Dumper=dumper) + else: + return yaml.dump(obj, Dumper=dumper, encoding=None) + + def _dump_load_cycle(self, obj): + # Each pass though a dump or load revs the 'generation' + # obj to yaml string + string_from_object_dump = self._dump_string(obj, dumper=AnsibleDumper) + + # wrap a stream/file like StringIO around that yaml + stream_from_object_dump = io.StringIO(string_from_object_dump) + loader = self._loader(stream_from_object_dump) + # load the yaml stream to create a new instance of the object (gen 2) + obj_2 = loader.get_data() + + # dump the gen 2 objects directory to strings + string_from_object_dump_2 = self._dump_string( + obj_2, dumper=AnsibleDumper + ) + + # The gen 1 and gen 2 yaml strings + self.assertEqual(string_from_object_dump, string_from_object_dump_2) + # the gen 1 (orig) and gen 2 py object + self.assertEqual(obj, obj_2) + + # again! gen 3... load strings into py objects + stream_3 = io.StringIO(string_from_object_dump_2) + loader_3 = self._loader(stream_3) + obj_3 = loader_3.get_data() + + string_from_object_dump_3 = self._dump_string( + obj_3, dumper=AnsibleDumper + ) + + self.assertEqual(obj, obj_3) + # should be transitive, but... + self.assertEqual(obj_2, obj_3) + self.assertEqual(string_from_object_dump, string_from_object_dump_3) + + def _old_dump_load_cycle(self, obj): + """Dump the passed in object to yaml, load it back up, dump again, compare.""" + stream = io.StringIO() + + yaml_string = self._dump_string(obj, dumper=AnsibleDumper) + self._dump_stream(obj, stream, dumper=AnsibleDumper) + + yaml_string_from_stream = stream.getvalue() + + # reset stream + stream.seek(0) + + loader = self._loader(stream) + # loader = AnsibleLoader(stream, vault_password=self.vault_password) + obj_from_stream = loader.get_data() + + stream_from_string = io.StringIO(yaml_string) + loader2 = self._loader(stream_from_string) + # loader2 = AnsibleLoader(stream_from_string, vault_password=self.vault_password) + obj_from_string = loader2.get_data() + + stream_obj_from_stream = io.StringIO() + stream_obj_from_string = io.StringIO() + + if PY3: + yaml.dump( + obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper + ) + yaml.dump( + obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper + ) + else: + yaml.dump( + obj_from_stream, + stream_obj_from_stream, + Dumper=AnsibleDumper, + encoding=None, + ) + yaml.dump( + obj_from_stream, + stream_obj_from_string, + Dumper=AnsibleDumper, + encoding=None, + ) + + yaml_string_stream_obj_from_stream = stream_obj_from_stream.getvalue() + yaml_string_stream_obj_from_string = stream_obj_from_string.getvalue() + + stream_obj_from_stream.seek(0) + stream_obj_from_string.seek(0) + + if PY3: + yaml_string_obj_from_stream = yaml.dump( + obj_from_stream, Dumper=AnsibleDumper + ) + yaml_string_obj_from_string = yaml.dump( + obj_from_string, Dumper=AnsibleDumper + ) + else: + yaml_string_obj_from_stream = yaml.dump( + obj_from_stream, Dumper=AnsibleDumper, encoding=None + ) + yaml_string_obj_from_string = yaml.dump( + obj_from_string, Dumper=AnsibleDumper, encoding=None + ) + + assert yaml_string == yaml_string_obj_from_stream + assert ( + yaml_string + == yaml_string_obj_from_stream + == yaml_string_obj_from_string + ) + assert ( + yaml_string + == yaml_string_obj_from_stream + == yaml_string_obj_from_string + == yaml_string_stream_obj_from_stream + == yaml_string_stream_obj_from_string + ) + assert obj == obj_from_stream + assert obj == obj_from_string + assert obj == yaml_string_obj_from_stream + assert obj == yaml_string_obj_from_string + assert ( + obj + == obj_from_stream + == obj_from_string + == yaml_string_obj_from_stream + == yaml_string_obj_from_string + ) + return { + "obj": obj, + "yaml_string": yaml_string, + "yaml_string_from_stream": yaml_string_from_stream, + "obj_from_stream": obj_from_stream, + "obj_from_string": obj_from_string, + "yaml_string_obj_from_string": yaml_string_obj_from_string, + } diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/conftest.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/conftest.py new file mode 100644 index 00000000..e19a1e04 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/conftest.py @@ -0,0 +1,40 @@ +# Copyright (c) 2017 Ansible Project +# 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 + +import json + +import pytest + +from ansible.module_utils.six import string_types +from ansible.module_utils._text import to_bytes +from ansible.module_utils.common._collections_compat import MutableMapping + + +@pytest.fixture +def patch_ansible_module(request, mocker): + if isinstance(request.param, string_types): + args = request.param + elif isinstance(request.param, MutableMapping): + if "ANSIBLE_MODULE_ARGS" not in request.param: + request.param = {"ANSIBLE_MODULE_ARGS": request.param} + if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]: + request.param["ANSIBLE_MODULE_ARGS"][ + "_ansible_remote_tmp" + ] = "/tmp" + if ( + "_ansible_keep_remote_files" + not in request.param["ANSIBLE_MODULE_ARGS"] + ): + request.param["ANSIBLE_MODULE_ARGS"][ + "_ansible_keep_remote_files" + ] = False + args = json.dumps(request.param) + else: + raise Exception( + "Malformed data to the patch_ansible_module pytest fixture" + ) + + mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args)) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/asa_module.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/asa_module.py new file mode 100644 index 00000000..b86ebbb1 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/asa_module.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +import os +import json + +from ansible_collections.cisco.asa.tests.unit.modules.utils import ( + AnsibleExitJson, + AnsibleFailJson, + ModuleTestCase, +) + + +fixture_path = os.path.join(os.path.dirname(__file__), "fixtures") +fixture_data = {} + + +def load_fixture(name): + path = os.path.join(fixture_path, name) + + if path in fixture_data: + return fixture_data[path] + + with open(path) as f: + data = f.read() + + try: + data = json.loads(data) + except Exception: + pass + + fixture_data[path] = data + return data + + +class TestAsaModule(ModuleTestCase): + def execute_module( + self, + failed=False, + changed=False, + commands=None, + sort=True, + defaults=False, + ): + + self.load_fixtures(commands) + + if failed: + result = self.failed() + self.assertTrue(result["failed"], result) + else: + result = self.changed(changed) + self.assertEqual(result["changed"], changed, result) + + if commands is not None: + if sort: + self.assertEqual( + sorted(commands), + sorted(result["commands"]), + result["commands"], + ) + else: + self.assertEqual( + commands, result["commands"], result["commands"] + ) + + return result + + def failed(self): + with self.assertRaises(AnsibleFailJson) as exc: + self.module.main() + + result = exc.exception.args[0] + self.assertTrue(result["failed"], result) + return result + + def changed(self, changed=False): + with self.assertRaises(AnsibleExitJson) as exc: + self.module.main() + + result = exc.exception.args[0] + self.assertEqual(result["changed"], changed, result) + return result + + def load_fixtures(self, commands=None): + pass diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/__init__.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/__init__.py diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_acls_config.cfg b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_acls_config.cfg new file mode 100644 index 00000000..a40a861f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_acls_config.cfg @@ -0,0 +1,11 @@ +access-list cached ACL log flows: total 0, denied 0 (deny-flow-max 4096) + alert-interval 300 +access-list test_global_access; 1 elements; name hash: 0xaa83124c +access-list test_global_access line 1 extended deny tcp any any eq www log errors interval 300 (hitcnt=0) 0x849e9e8f +access-list test_global_access line 2 remark test global remark +access-list test_access; 2 elements; name hash: 0x96b5d78b +access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default (hitcnt=0) 0xdc46eb6e +access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors interval 300 (hitcnt=0) 0x831d8948 +access-list test_access line 3 extended permit ip host 192.0.2.2 any interval 300 (hitcnt=0) 0x831d897d +access-list test_R1_traffic; 1 elements; name hash: 0x2c20a0c +access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive (hitcnt=0) (inactive) 0x11821a52
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_dir b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_dir new file mode 100644 index 00000000..cd8caa3f --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_dir @@ -0,0 +1,10 @@ + +Directory of disk0:/ + +11 drwx 4096 04:49:48 May 16 2019 smart-log +7 -rwx 0 05:56:43 Nov 22 2019 use_ttyS0 +8 drwx 4096 04:45:10 May 16 2019 log +13 drwx 4096 04:49:52 May 16 2019 coredumpinfo + +1 file(s) total size: 0 bytes +8571076608 bytes total (8549351424 bytes free/99% free)
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_show_memory b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_show_memory new file mode 100644 index 00000000..13bea8cb --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_show_memory @@ -0,0 +1,14 @@ +Free memory: 7176970240 bytes (84%) +Used memory: 2590688668 bytes (16%) +------------- ------------------ +Total memory: 8589934592 bytes (100%) + +Virtual platform memory +----------------------- +Provisioned 8192 MB +Allowed 4096 MB + +Note: Free memory is the free system memory. Additional memory may + be available from memory pools internal to the firewall process. + Use 'show memory detail' to see this information, but use it + with care since it may cause CPU hogs and packet loss under load.
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_show_version b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_show_version new file mode 100644 index 00000000..d652d7be --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_facts_show_version @@ -0,0 +1,50 @@ + +Cisco Adaptive Security Appliance Software Version 9.10(1)11 +Firepower Extensible Operating System Version 2.4(1.227) +Device Manager Version 7.10(1) + +Compiled on Thu 21-Feb-19 14:10 PST by builders +System image file is "boot:/asa9101-11-smp-k8.bin" +Config file at boot was "startup-config" + +ciscoasa up 21 days 7 hours + +Hardware: ASAv, 8192 MB RAM, CPU Xeon E5 series 2300 MHz, 1 CPU (2 cores) +Model Id: ASAv10 +Internal ATA Compact Flash, 10240MB +Slot 1: ATA Compact Flash, 10240MB +BIOS Flash Firmware Hub @ 0x0, 0KB + + + 0: Ext: Management0/0 : address is 02ac.8ef2.59aa, irq 0 + 1: Ext: GigabitEthernet0/0 : address is 024e.1f85.94da, irq 0 + +License mode: AWS Licensing +License state: LICENSED + +Licensed features for this platform: +Maximum VLANs : 50 +Inside Hosts : Unlimited +Failover : Active/Standby +Encryption-DES : Enabled +Encryption-3DES-AES : Enabled +Security Contexts : 0 +Carrier : Enabled +AnyConnect Premium Peers : 250 +AnyConnect Essentials : Disabled +Other VPN Peers : 250 +Total VPN Peers : 250 +AnyConnect for Mobile : Enabled +AnyConnect for Cisco VPN Phone : Enabled +Advanced Endpoint Assessment : Enabled +Shared License : Disabled +Total TLS Proxy Sessions : 498 +Botnet Traffic Filter : Enabled +Cluster : Disabled + +Serial Number: 9AWFX1S46VQ + +Image type : Release +Key version : A + +Configuration last modified by enable_15 at 06:41:15.559 UTC Fri Nov 22 2019
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_og_config.cfg b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_og_config.cfg new file mode 100644 index 00000000..27f22120 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_og_config.cfg @@ -0,0 +1,5 @@ +object-group network test_nets +description ansible_test object-group description +network-object host 8.8.8.8 +network-object 192.168.0.0 255.255.0.0 +group-object awx_lon diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_ogs_config.cfg b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_ogs_config.cfg new file mode 100644 index 00000000..6f5025fc --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/fixtures/asa_ogs_config.cfg @@ -0,0 +1,7 @@ +object-group network test_og_network + description test_og_network + network-object host 192.0.2.1 + network-object 192.0.2.0 255.255.255.0 +object-group service test_og_service + service-object ipinip + service-object tcp-udp
\ No newline at end of file diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_acls.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_acls.py new file mode 100644 index 00000000..ef5ea440 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_acls.py @@ -0,0 +1,568 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# 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 + +import sys + +import pytest + +# These tests and/or the module under test are unstable on Python 3.5. +# See: https://app.shippable.com/github/ansible/ansible/runs/161331/15/tests +# This is most likely due to CPython 3.5 not maintaining dict insertion order. +pytestmark = pytest.mark.skipif( + sys.version_info[:2] == (3, 5), + reason="Tests and/or module are unstable on Python 3.5.", +) + +from ansible_collections.cisco.asa.tests.unit.compat.mock import patch +from ansible_collections.cisco.asa.plugins.modules import asa_acls +from ansible_collections.cisco.asa.tests.unit.modules.utils import ( + set_module_args, +) +from .asa_module import TestAsaModule, load_fixture + + +class TestAsaAclsModule(TestAsaModule): + module = asa_acls + + def setUp(self): + super(TestAsaAclsModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." + "get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module." + "get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_edit_config = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.providers.providers.CliProvider.edit_config" + ) + self.edit_config = self.mock_edit_config.start() + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.acls.acls." + "AclsFacts.get_acls_config" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestAsaAclsModule, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_edit_config.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + return load_fixture("asa_acls_config.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_asa_acls_merged(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + aces=[ + dict( + destination=dict( + object_group="test_network_og", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=2, + log="default", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + object_group="test_og_network" + ), + ) + ], + acl_type="extended", + name="test_global_access", + ) + ] + ), + state="merged", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "access-list test_global_access line 2 extended deny tcp object-group test_og_network object-group test_network_og eq www log default" + ] + self.assertEqual(result["commands"], commands) + + def test_asa_acls_merged_idempotent(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + aces=[ + dict( + destination=dict( + any="true", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="errors", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict(any="true"), + ), + dict(line=2, remark="test global remark"), + ], + acl_type="extended", + name="test_global_access", + ), + dict( + aces=[ + dict( + destination=dict( + address="192.0.3.0", + netmask="255.255.255.0", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="default", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="192.0.2.0", + netmask="255.255.255.0", + ), + ), + dict( + destination=dict( + address="198.51.110.0", + netmask="255.255.255.0", + ), + grant="deny", + line=2, + log="errors", + protocol="igrp", + protocol_options=dict(igrp="true"), + source=dict( + address="198.51.100.0", + netmask="255.255.255.0", + ), + ), + dict( + destination=dict(any="true"), + grant="permit", + line=3, + protocol="ip", + protocol_options=dict(ip="true"), + source=dict(host="192.0.2.2"), + ), + ], + acl_type="extended", + name="test_access", + ), + dict( + aces=[ + dict( + destination=dict( + address="2001:fc8:0:4::/64", + port_protocol=dict(eq="telnet"), + ), + grant="deny", + inactive="true", + line=1, + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="2001:db8:0:3::/64", + port_protocol=dict(eq="www"), + ), + ) + ], + acl_type="extended", + name="test_R1_traffic", + ), + ] + ), + state="merged", + ) + ) + self.execute_module(changed=False, commands=[], sort=True) + + def test_asa_acls_replaced(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + name="test_access", + acl_type="extended", + aces=[ + dict( + destination=dict( + address="198.51.102.0", + netmask="255.255.255.0", + ), + grant="deny", + line=1, + log="default", + protocol="igrp", + protocol_options=dict(igrp="true"), + source=dict( + address="198.51.101.0", + netmask="255.255.255.0", + ), + time_range="temp", + ) + ], + ) + ] + ), + state="replaced", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "no access-list test_access line 3 extended permit ip host 192.0.2.2 any", + "no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors", + "no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default", + "access-list test_access line 1 extended deny igrp 198.51.101.0 255.255.255.0 198.51.102.0 255.255.255.0 log default time-range temp", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_acls_replaced_idempotent(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + aces=[ + dict( + destination=dict( + any="true", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="errors", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict(any="true"), + ), + dict(line=2, remark="test global remark"), + ], + acl_type="extended", + name="test_global_access", + ), + dict( + aces=[ + dict( + destination=dict( + address="192.0.3.0", + netmask="255.255.255.0", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="default", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="192.0.2.0", + netmask="255.255.255.0", + ), + ), + dict( + destination=dict( + address="198.51.110.0", + netmask="255.255.255.0", + ), + grant="deny", + line=2, + log="errors", + protocol="igrp", + protocol_options=dict(igrp="true"), + source=dict( + address="198.51.100.0", + netmask="255.255.255.0", + ), + ), + dict( + destination=dict(any="true"), + grant="permit", + line=3, + protocol="ip", + protocol_options=dict(ip="true"), + source=dict(host="192.0.2.2"), + ), + ], + acl_type="extended", + name="test_access", + ), + dict( + aces=[ + dict( + destination=dict( + address="2001:fc8:0:4::/64", + port_protocol=dict(eq="telnet"), + ), + grant="deny", + inactive="true", + line=1, + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="2001:db8:0:3::/64", + port_protocol=dict(eq="www"), + ), + ) + ], + acl_type="extended", + name="test_R1_traffic", + ), + ] + ), + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[], sort=True) + + def test_asa_acls_overridden(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + name="test_global_access", + acl_type="extended", + aces=[ + dict( + destination=dict( + address="198.51.110.0", + netmask="255.255.255.0", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="errors", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="198.51.100.0", + netmask="255.255.255.0", + ), + ) + ], + ) + ] + ), + state="overridden", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "no access-list test_global_access line 2 remark test global remark", + "no access-list test_global_access line 1 extended deny tcp any any eq www log errors", + "no access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive", + "no access-list test_access line 3 extended permit ip host 192.0.2.2 any", + "no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors", + "no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default", + "access-list test_global_access line 1 extended deny tcp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 eq www log errors", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_acls_overridden_idempotent(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + aces=[ + dict( + destination=dict( + any="true", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="errors", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict(any="true"), + ), + dict(line=2, remark="test global remark"), + ], + acl_type="extended", + name="test_global_access", + ), + dict( + aces=[ + dict( + destination=dict( + address="192.0.3.0", + netmask="255.255.255.0", + port_protocol=dict(eq="www"), + ), + grant="deny", + line=1, + log="default", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="192.0.2.0", + netmask="255.255.255.0", + ), + ), + dict( + destination=dict( + address="198.51.110.0", + netmask="255.255.255.0", + ), + grant="deny", + line=2, + log="errors", + protocol="igrp", + protocol_options=dict(igrp="true"), + source=dict( + address="198.51.100.0", + netmask="255.255.255.0", + ), + ), + dict( + destination=dict(any="true"), + grant="permit", + line=3, + protocol="ip", + protocol_options=dict(ip="true"), + source=dict(host="192.0.2.2"), + ), + ], + acl_type="extended", + name="test_access", + ), + dict( + aces=[ + dict( + destination=dict( + address="2001:fc8:0:4::/64", + port_protocol=dict(eq="telnet"), + ), + grant="deny", + inactive="true", + line=1, + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="2001:db8:0:3::/64", + port_protocol=dict(eq="www"), + ), + ) + ], + acl_type="extended", + name="test_R1_traffic", + ), + ] + ), + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[], sort=True) + + def test_asa_acls_delete_by_acl(self): + set_module_args( + dict( + config=dict( + acls=[ + dict(name="test_global_access"), + dict(name="test_R1_traffic"), + ] + ), + state="deleted", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "no access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive", + "no access-list test_global_access line 2 remark test global remark", + "no access-list test_global_access line 1 extended deny tcp any any eq www log errors", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_acls_deleted_all(self): + set_module_args(dict(state="deleted")) + result = self.execute_module(changed=True) + commands = [ + "no access-list test_R1_traffic line 1 extended deny tcp 2001:db8:0:3::/64 eq www 2001:fc8:0:4::/64 eq telnet inactive", + "no access-list test_access line 3 extended permit ip host 192.0.2.2 any", + "no access-list test_access line 2 extended deny igrp 198.51.100.0 255.255.255.0 198.51.110.0 255.255.255.0 log errors", + "no access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 eq www log default", + "no access-list test_global_access line 2 remark test global remark", + "no access-list test_global_access line 1 extended deny tcp any any eq www log errors", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_acls_rendered(self): + set_module_args( + dict( + config=dict( + acls=[ + dict( + name="test_access", + acl_type="extended", + aces=[ + dict( + destination=dict( + address="192.0.3.0", + netmask="255.255.255.0", + ), + grant="deny", + line=1, + log="default", + protocol="tcp", + protocol_options=dict(tcp="true"), + source=dict( + address="192.0.2.0", + netmask="255.255.255.0", + ), + ) + ], + ) + ] + ), + state="rendered", + ) + ) + commands = [ + "access-list test_access line 1 extended deny tcp 192.0.2.0 255.255.255.0 192.0.3.0 255.255.255.0 log default" + ] + result = self.execute_module(changed=False) + self.assertEqual(result["rendered"], commands) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_facts.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_facts.py new file mode 100644 index 00000000..46c3f91c --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_facts.py @@ -0,0 +1,100 @@ +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see <http://www.gnu.org/licenses/>. + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.asa.tests.unit.compat.mock import patch +from ansible_collections.cisco.asa.plugins.modules import asa_facts +from ansible_collections.cisco.asa.tests.unit.modules.utils import ( + set_module_args, +) +from .asa_module import TestAsaModule, load_fixture + + +class TestAsaFactsModule(TestAsaModule): + + module = asa_facts + + def setUp(self): + super(TestAsaFactsModule, self).setUp() + self.mock_run_commands = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.legacy.base.run_commands" + ) + self.run_commands = self.mock_run_commands.start() + + self.mock_get_resource_connection = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.facts.facts.get_resource_connection" + ) + self.get_resource_connection = ( + self.mock_get_resource_connection.start() + ) + + self.mock_get_capabilities = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.legacy.base.get_capabilities" + ) + self.get_capabilities = self.mock_get_capabilities.start() + self.get_capabilities.return_value = { + "device_info": { + "network_os": "asa", + "network_os_hostname": "ciscoasa", + "network_os_image": "flash0:/vasa-adventerprisek9-m", + "network_os_version": "9.10(1)11", + }, + "network_api": "cliconf", + } + + def tearDown(self): + super(TestAsaFactsModule, self).tearDown() + self.mock_run_commands.stop() + self.mock_get_capabilities.stop() + + def load_fixtures(self, commands=None): + def load_from_file(*args, **kwargs): + commands = kwargs["commands"] + output = list() + + for command in commands: + filename = str(command).split(" | ")[0].replace(" ", "_") + output.append(load_fixture("asa_facts_%s" % filename)) + return output + + self.run_commands.side_effect = load_from_file + + def test_asa_facts_stacked(self): + set_module_args(dict(gather_subset="default")) + result = self.execute_module() + self.assertEqual( + result["ansible_facts"]["ansible_net_serialnum"], "9AWFX1S46VQ" + ) + self.assertEqual(result["ansible_facts"]["ansible_net_system"], "asa") + + def test_asa_facts_filesystems_info(self): + set_module_args(dict(gather_subset="hardware")) + result = self.execute_module() + self.assertEqual( + result["ansible_facts"]["ansible_net_filesystems_info"]["disk0:"][ + "spacetotal_kb" + ], + 8370192.0, + ) + self.assertEqual( + result["ansible_facts"]["ansible_net_filesystems_info"]["disk0:"][ + "spacefree_kb" + ], + 8348976.0, + ) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_og.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_og.py new file mode 100644 index 00000000..938fc291 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_og.py @@ -0,0 +1,126 @@ +# -*- coding: utf-8 -*- + +# (c) 2019, Ansible by Red Hat, inc +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) + +# Make coding more python3-ish +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +from ansible_collections.cisco.asa.tests.unit.compat.mock import patch +from ansible_collections.cisco.asa.plugins.modules import asa_og +from ansible_collections.cisco.asa.tests.unit.modules.utils import ( + set_module_args, +) +from .asa_module import TestAsaModule, load_fixture + + +class TestAsaOgModule(TestAsaModule): + + module = asa_og + + def setUp(self): + super(TestAsaOgModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.cisco.asa.plugins.modules.asa_og.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.cisco.asa.plugins.modules.asa_og.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_connection = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.asa.get_connection" + ) + self.get_connection = self.mock_get_connection.start() + + def tearDown(self): + super(TestAsaOgModule, self).tearDown() + self.mock_get_config.stop() + self.mock_load_config.stop() + + def load_fixtures(self, commands=None): + self.get_config.return_value = load_fixture( + "asa_og_config.cfg" + ).strip() + self.load_config.return_value = dict(diff=None, session="session") + + def test_asa_og_idempotent(self): + set_module_args( + dict( + name="test_nets", + group_type="network-object", + host_ip=["8.8.8.8"], + ip_mask=["192.168.0.0 255.255.0.0"], + group_object=["awx_lon"], + description="ansible_test object-group description", + state="present", + ) + ) + commands = [] + self.execute_module(changed=False, commands=commands) + + def test_asa_og_add(self): + set_module_args( + dict( + name="test_nets", + group_type="network-object", + host_ip=["8.8.8.8", "8.8.4.4"], + ip_mask=["192.168.0.0 255.255.0.0", "10.0.0.0 255.255.255.0"], + group_object=["awx_lon", "awx_ams"], + description="ansible_test object-group description", + state="present", + ) + ) + commands = [ + "object-group network test_nets", + "network-object host 8.8.4.4", + "network-object 10.0.0.0 255.255.255.0", + "group-object awx_ams", + ] + self.execute_module(changed=True, commands=commands) + + def test_asa_og_replace(self): + set_module_args( + dict( + name="test_nets", + group_type="network-object", + host_ip=["8.8.4.4"], + ip_mask=["10.0.0.0 255.255.255.0"], + group_object=["awx_ams"], + description="ansible_test custom description", + state="replace", + ) + ) + commands = [ + "object-group network test_nets", + "description ansible_test custom description", + "no network-object host 8.8.8.8", + "network-object host 8.8.4.4", + "no network-object 192.168.0.0 255.255.0.0", + "network-object 10.0.0.0 255.255.255.0", + "no group-object awx_lon", + "group-object awx_ams", + ] + self.execute_module(changed=True, commands=commands) + + def test_asa_og_remove(self): + set_module_args( + dict( + name="test_nets", + group_type="network-object", + host_ip=["8.8.8.8"], + group_object=["awx_lon"], + state="absent", + ) + ) + commands = [ + "object-group network test_nets", + "no network-object host 8.8.8.8", + "no group-object awx_lon", + ] + self.execute_module(changed=True, commands=commands) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_ogs.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_ogs.py new file mode 100644 index 00000000..ca5f8ec4 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/network/asa/test_asa_ogs.py @@ -0,0 +1,353 @@ +# +# (c) 2019, Ansible by Red Hat, inc +# 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 + +import sys + +import pytest + +# These tests and/or the module under test are unstable on Python 3.5. +# See: https://app.shippable.com/github/ansible/ansible/runs/161331/15/tests +# This is most likely due to CPython 3.5 not maintaining dict insertion order. +pytestmark = pytest.mark.skipif( + sys.version_info[:2] == (3, 5), + reason="Tests and/or module are unstable on Python 3.5.", +) + +from ansible_collections.cisco.asa.tests.unit.compat.mock import patch +from ansible_collections.cisco.asa.plugins.modules import asa_ogs +from ansible_collections.cisco.asa.tests.unit.modules.utils import ( + set_module_args, +) +from .asa_module import TestAsaModule, load_fixture + + +class TestAsaOGsModule(TestAsaModule): + module = asa_ogs + + def setUp(self): + super(TestAsaOGsModule, self).setUp() + + self.mock_get_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.get_config" + ) + self.get_config = self.mock_get_config.start() + + self.mock_load_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network.Config.load_config" + ) + self.load_config = self.mock_load_config.start() + + self.mock_get_resource_connection_config = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base." + "get_resource_connection" + ) + self.get_resource_connection_config = ( + self.mock_get_resource_connection_config.start() + ) + + self.mock_get_resource_connection_facts = patch( + "ansible_collections.ansible.netcommon.plugins.module_utils.network.common.resource_module." + "get_resource_connection" + ) + self.get_resource_connection_facts = ( + self.mock_get_resource_connection_facts.start() + ) + + self.mock_edit_config = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.providers.providers.CliProvider.edit_config" + ) + self.edit_config = self.mock_edit_config.start() + + self.mock_execute_show_command = patch( + "ansible_collections.cisco.asa.plugins.module_utils.network.asa.facts.ogs.ogs." + "OGsFacts.get_og_data" + ) + self.execute_show_command = self.mock_execute_show_command.start() + + def tearDown(self): + super(TestAsaOGsModule, self).tearDown() + self.mock_get_resource_connection_config.stop() + self.mock_get_resource_connection_facts.stop() + self.mock_edit_config.stop() + self.mock_get_config.stop() + self.mock_load_config.stop() + self.mock_execute_show_command.stop() + + def load_fixtures(self, commands=None, transport="cli"): + def load_from_file(*args, **kwargs): + return load_fixture("asa_ogs_config.cfg") + + self.execute_show_command.side_effect = load_from_file + + def test_asa_ogs_merged(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + name="test_network_og", + description="test network og", + network_object=dict( + host=["192.0.3.1", "192.0.3.2"], + ipv6_address=["2001:db8:0:3::/64"], + ), + ) + ], + object_type="network", + ) + ], + state="merged", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "object-group network test_network_og", + "description test network og", + "network-object host 192.0.3.1", + "network-object host 192.0.3.2", + "network-object 2001:db8:0:3::/64", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_ogs_merged_idempotent(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + description="test_og_network", + name="test_og_network", + network_object=dict( + host=["192.0.2.1"], + address=["192.0.2.0 255.255.255.0"], + ), + ) + ], + object_type="network", + ), + dict( + object_groups=[ + dict( + name="test_og_service", + service_object=dict( + protocol=["ipinip", "tcp-udp"] + ), + ) + ], + object_type="service", + ), + ], + state="merged", + ) + ) + self.execute_module(changed=False, commands=[], sort=True) + + def test_asa_ogs_replaced(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + name="test_og_network", + description="test_og_network_replace", + network_object=dict( + host=["192.0.3.1"], + address=["192.0.3.0 255.255.255.0"], + ), + ) + ], + object_type="network", + ) + ], + state="replaced", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "object-group network test_og_network", + "description test_og_network_replace", + "no network-object 192.0.2.0 255.255.255.0", + "network-object 192.0.3.0 255.255.255.0", + "no network-object host 192.0.2.1", + "network-object host 192.0.3.1", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_ogs_replaced_idempotent(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + description="test_og_network", + name="test_og_network", + network_object=dict( + host=["192.0.2.1"], + address=["192.0.2.0 255.255.255.0"], + ), + ) + ], + object_type="network", + ), + dict( + object_groups=[ + dict( + name="test_og_service", + service_object=dict( + protocol=["ipinip", "tcp-udp"] + ), + ) + ], + object_type="service", + ), + ], + state="replaced", + ) + ) + self.execute_module(changed=False, commands=[], sort=True) + + def test_asa_ogs_overridden(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + name="test_og_network", + description="test_og_network_override", + network_object=dict( + host=["192.0.3.1"], + address=["192.0.3.0 255.255.255.0"], + ), + ) + ], + object_type="network", + ) + ], + state="overridden", + ) + ) + result = self.execute_module(changed=True) + commands = [ + "no object-group service test_og_service", + "object-group network test_og_network", + "description test_og_network_override", + "no network-object 192.0.2.0 255.255.255.0", + "network-object 192.0.3.0 255.255.255.0", + "no network-object host 192.0.2.1", + "network-object host 192.0.3.1", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_ogs_overridden_idempotent(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + description="test_og_network", + name="test_og_network", + network_object=dict( + host=["192.0.2.1"], + address=["192.0.2.0 255.255.255.0"], + ), + ) + ], + object_type="network", + ), + dict( + object_groups=[ + dict( + name="test_og_service", + service_object=dict( + protocol=["ipinip", "tcp-udp"] + ), + ) + ], + object_type="service", + ), + ], + state="overridden", + ) + ) + self.execute_module(changed=False, commands=[], sort=True) + + def test_asa_ogs_delete_by_name(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[dict(name="test_og_network")], + object_type="network", + ) + ], + state="deleted", + ) + ) + result = self.execute_module(changed=True) + commands = ["no object-group network test_og_network"] + self.assertEqual(result["commands"], commands) + + def test_asa_ogs_deleted_all(self): + set_module_args(dict(state="deleted")) + result = self.execute_module(changed=True) + commands = [ + "no object-group network test_og_network", + "no object-group service test_og_service", + ] + self.assertEqual(result["commands"], commands) + + def test_asa_ogs_rendered(self): + set_module_args( + dict( + config=[ + dict( + object_groups=[ + dict( + description="test_og_network", + name="test_og_network", + network_object=dict( + host=["192.0.2.1"], + address=["192.0.2.0 255.255.255.0"], + ), + ) + ], + object_type="network", + ), + dict( + object_groups=[ + dict( + name="test_og_service", + service_object=dict( + protocol=["ipinip", "tcp-udp"] + ), + ) + ], + object_type="service", + ), + ], + state="rendered", + ) + ) + commands = [ + "object-group network test_og_network", + "description test_og_network", + "network-object 192.0.2.0 255.255.255.0", + "network-object host 192.0.2.1", + "object-group service test_og_service", + "service-object ipinip", + "service-object tcp-udp", + ] + result = self.execute_module(changed=False) + self.assertEqual(result["rendered"], commands) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/utils.py b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/utils.py new file mode 100644 index 00000000..9258b663 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/modules/utils.py @@ -0,0 +1,51 @@ +from __future__ import absolute_import, division, print_function + +__metaclass__ = type +import json + +from ansible_collections.cisco.asa.tests.unit.compat import unittest +from ansible_collections.cisco.asa.tests.unit.compat.mock import patch +from ansible.module_utils import basic +from ansible.module_utils._text import to_bytes + + +def set_module_args(args): + if "_ansible_remote_tmp" not in args: + args["_ansible_remote_tmp"] = "/tmp" + if "_ansible_keep_remote_files" not in args: + args["_ansible_keep_remote_files"] = False + + args = json.dumps({"ANSIBLE_MODULE_ARGS": args}) + basic._ANSIBLE_ARGS = to_bytes(args) + + +class AnsibleExitJson(Exception): + pass + + +class AnsibleFailJson(Exception): + pass + + +def exit_json(*args, **kwargs): + if "changed" not in kwargs: + kwargs["changed"] = False + raise AnsibleExitJson(kwargs) + + +def fail_json(*args, **kwargs): + kwargs["failed"] = True + raise AnsibleFailJson(kwargs) + + +class ModuleTestCase(unittest.TestCase): + def setUp(self): + self.mock_module = patch.multiple( + basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + ) + self.mock_module.start() + self.mock_sleep = patch("time.sleep") + self.mock_sleep.start() + set_module_args({}) + self.addCleanup(self.mock_module.stop) + self.addCleanup(self.mock_sleep.stop) diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/requirements.txt b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/requirements.txt new file mode 100644 index 00000000..a9772bea --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tests/unit/requirements.txt @@ -0,0 +1,42 @@ +boto3 +placebo +pycrypto +passlib +pypsrp +python-memcached +pytz +pyvmomi +redis +requests +setuptools > 0.6 # pytest-xdist installed via requirements does not work with very old setuptools (sanity_ok) +unittest2 ; python_version < '2.7' +importlib ; python_version < '2.7' +netaddr +ipaddress +netapp-lib +solidfire-sdk-python + +# requirements for F5 specific modules +f5-sdk ; python_version >= '2.7' +f5-icontrol-rest ; python_version >= '2.7' +deepdiff + +# requirement for Fortinet specific modules +pyFMG + +# requirement for aci_rest module +xmljson + +# requirement for winrm connection plugin tests +pexpect + +# requirement for the linode module +linode-python # APIv3 +linode_api4 ; python_version > '2.6' # APIv4 + +# requirement for the gitlab module +python-gitlab +httmock + +# requirment for kubevirt modules +openshift ; python_version >= '2.7' diff --git a/collections-debian-merged/ansible_collections/cisco/asa/tox.ini b/collections-debian-merged/ansible_collections/cisco/asa/tox.ini new file mode 100644 index 00000000..a533ccb3 --- /dev/null +++ b/collections-debian-merged/ansible_collections/cisco/asa/tox.ini @@ -0,0 +1,33 @@ +[tox] +minversion = 1.4.2 +envlist = linters +skipsdist = True + +[testenv] +basepython = python3 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = find {toxinidir} -type f -name "*.py[c|o]" -delete + +[testenv:black] +install_command = pip install {opts} {packages} +commands = + black -v -l79 {toxinidir} + +[testenv:linters] +install_command = pip install {opts} {packages} +commands = + black -v -l79 --check {toxinidir} + flake8 {posargs} + +[testenv:venv] +commands = {posargs} + +[flake8] +# E123, E125 skipped as they are invalid PEP-8. + +show-source = True +ignore = E123,E125,E402,E501,E741,W503 +max-line-length = 160 +builtins = _ +exclude = .git,.tox,tests/unit/compat/ |