├── .github └── workflows │ └── ansible-test.yml ├── .gitignore ├── CHANGELOG.rst ├── CONTRIBUTING.md ├── COPYING ├── README.md ├── changelogs ├── .plugin-cache.yaml ├── changelog.yaml └── config.yaml ├── galaxy.yml ├── meta └── runtime.yml ├── playbooks ├── create_a_record.yaml ├── create_adminuser.yaml ├── create_cname_record.yaml ├── create_dns_view.yml ├── create_dtc_lbdn.yml ├── create_dtc_monitor_http.yaml ├── create_dtc_monitor_icmp.yaml ├── create_dtc_monitor_pdp.yaml ├── create_dtc_monitor_sip.yaml ├── create_dtc_monitor_snmp.yaml ├── create_dtc_monitor_tcp.yaml ├── create_dtc_pool.yml ├── create_dtc_server.yml ├── create_dtc_topology.yml ├── create_extensible_attribute.yaml ├── create_mx_record.yaml ├── create_network.yml ├── create_network_view.yml ├── create_nsgroup_delegation.yml ├── create_nsgroup_forwardingmember.yml ├── create_nsgroup_forwardstubserver.yml ├── create_nsgroup_stubmember.yml ├── create_txt_record.yaml ├── create_zone.yml ├── delete_cname_record.yaml ├── delete_dnsview.yml ├── delete_dtc_monitor_http.yaml ├── delete_dtc_monitor_icmp.yaml ├── delete_dtc_monitor_pdp.yaml ├── delete_dtc_monitor_sip.yaml ├── delete_dtc_monitor_snmp.yaml ├── delete_dtc_monitor_tcp.yaml ├── delete_dtc_topology.yml ├── delete_mx_record.yaml ├── delete_network.yml ├── delete_network_view.yml ├── delete_txt_record.yaml ├── delete_zone.yml ├── restart_services.yml ├── update_a_record.yml └── update_member.yml ├── plugins ├── README.md ├── doc_fragments │ └── nios.py ├── inventory │ └── nios_inventory.py ├── lookup │ ├── nios_lookup.py │ ├── nios_next_ip.py │ ├── nios_next_network.py │ └── nios_next_vlan_id.py ├── module_utils │ ├── api.py │ └── network.py └── modules │ ├── nios_a_record.py │ ├── nios_aaaa_record.py │ ├── nios_adminuser.py │ ├── nios_cname_record.py │ ├── nios_dns_view.py │ ├── nios_dtc_lbdn.py │ ├── nios_dtc_monitor_http.py │ ├── nios_dtc_monitor_icmp.py │ ├── nios_dtc_monitor_pdp.py │ ├── nios_dtc_monitor_sip.py │ ├── nios_dtc_monitor_snmp.py │ ├── nios_dtc_monitor_tcp.py │ ├── nios_dtc_pool.py │ ├── nios_dtc_server.py │ ├── nios_dtc_topology.py │ ├── nios_extensible_attribute.py │ ├── nios_fixed_address.py │ ├── nios_host_record.py │ ├── nios_member.py │ ├── nios_mx_record.py │ ├── nios_naptr_record.py │ ├── nios_network.py │ ├── nios_network_view.py │ ├── nios_nsgroup.py │ ├── nios_nsgroup_delegation.py │ ├── nios_nsgroup_forwardingmember.py │ ├── nios_nsgroup_forwardstubserver.py │ ├── nios_nsgroup_stubmember.py │ ├── nios_ptr_record.py │ ├── nios_range.py │ ├── nios_restartservices.py │ ├── nios_srv_record.py │ ├── nios_txt_record.py │ ├── nios_vlan.py │ └── nios_zone.py ├── requirements.txt └── tests ├── integration └── targets │ ├── nios_a_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_a_record_idempotence.yml │ ├── nios_aaaa_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_aaaa_record_idempotence.yml │ ├── nios_adminuser │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_adminuser_idempotence.yml │ ├── nios_cname_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_cname_record_idempotence.yml │ ├── nios_dns_view │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_dns_view_idempotence.yml │ ├── nios_dtc_monitor_http │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_monitor_http_idempotence.yaml │ ├── nios_dtc_monitor_icmp │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_monitor_icmp_idempotence.yaml │ ├── nios_dtc_monitor_pdp │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_monitor_pdp_idempotence.yaml │ ├── nios_dtc_monitor_sip │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_monitor_sip_idempotence.yaml │ ├── nios_dtc_monitor_snmp │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_monitor_snmp_idempotence.yaml │ ├── nios_dtc_monitor_tcp │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_monitor_tcp_idempotence.yaml │ ├── nios_dtc_topology │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_dtc_topology_idempotence.yaml │ ├── nios_extensible_attribute │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_extensible_attribute.yaml │ ├── nios_host_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_host_record_idempotence.yml │ ├── nios_mx_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_mx_record_idempotence.yml │ ├── nios_naptr_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_naptr_record_idempotence.yml │ ├── nios_network │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_network_idempotence.yml │ ├── nios_network_view │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_network_view_idempotence.yml │ ├── nios_nsgroup_delegation │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_nsgroup_delegation_idempotence.yml │ ├── nios_nsgroup_forwardingmember │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_nsgroup_forwardingmember_idempotence.yml │ ├── nios_nsgroup_forwardstubserver │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_nsgroup_forwardstubserver_idempotence.yml │ ├── nios_nsgroup_stubmember │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_nsgroup_stubmember_idempotence.yml │ ├── nios_ptr_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_ptr_record_idempotence.yml │ ├── nios_srv_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_srv_record_idempotence.yml │ ├── nios_txt_record │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_txt_record_idempotence.yml │ ├── nios_vlan │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yaml │ │ └── nios_vlan_idempotence.yml │ ├── nios_zone │ ├── aliases │ ├── defaults │ │ └── main.yaml │ ├── meta │ │ └── main.yaml │ └── tasks │ │ ├── main.yml │ │ └── nios_zone_idempotence.yml │ └── prepare_nios_tests │ └── tasks │ ├── main.yml │ └── prepare_nios_tests_idempotence.yml ├── requirements.txt └── unit ├── __init__.py ├── compat ├── __init__.py └── mock.py ├── plugins ├── __init__.py ├── module_utils │ ├── __init__.py │ └── test_api.py └── modules │ ├── __init__.py │ ├── fixtures │ └── nios_result.txt │ ├── test_adminuser.py │ ├── test_extensible_attribute.py │ ├── test_nios_a_record.py │ ├── test_nios_aaaa_record.py │ ├── test_nios_cname_record.py │ ├── test_nios_dns_view.py │ ├── test_nios_dtc_monitor_http.py │ ├── test_nios_dtc_monitor_icmp.py │ ├── test_nios_dtc_monitor_pdp.py │ ├── test_nios_dtc_monitor_sip.py │ ├── test_nios_dtc_monitor_snmp.py │ ├── test_nios_dtc_monitor_tcp.py │ ├── test_nios_dtc_topology.py │ ├── test_nios_fixed_address.py │ ├── test_nios_host_record.py │ ├── test_nios_member.py │ ├── test_nios_module.py │ ├── test_nios_mx_record.py │ ├── test_nios_naptr_record.py │ ├── test_nios_network.py │ ├── test_nios_network_view.py │ ├── test_nios_nsgroup.py │ ├── test_nios_ptr_record.py │ ├── test_nios_srv_record.py │ ├── test_nios_vlan.py │ ├── test_nios_zone.py │ └── utils.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | .direnv/ 13 | build/ 14 | develop-eggs/ 15 | dist/ 16 | downloads/ 17 | eggs/ 18 | .eggs/ 19 | lib/ 20 | lib64/ 21 | parts/ 22 | sdist/ 23 | var/ 24 | wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | 58 | # Flask stuff: 59 | instance/ 60 | .webassets-cache 61 | 62 | # Scrapy stuff: 63 | .scrapy 64 | 65 | # Sphinx documentation 66 | docs/_build/ 67 | 68 | # PyBuilder 69 | target/ 70 | 71 | # Jupyter Notebook 72 | .ipynb_checkpoints 73 | 74 | # pyenv 75 | .python-version 76 | 77 | # celery beat schedule file 78 | celerybeat-schedule 79 | 80 | # SageMath parsed files 81 | *.sage.py 82 | 83 | # dotenv 84 | .env 85 | 86 | # virtualenv 87 | .venv 88 | venv/ 89 | ENV/ 90 | 91 | # Spyder project settings 92 | .spyderproject 93 | .spyproject 94 | 95 | # Rope project settings 96 | .ropeproject 97 | 98 | # mkdocs documentation 99 | /site 100 | 101 | # mypy 102 | .mypy_cache/ 103 | infoblox-ansible.code-workspace 104 | 105 | # Ansible sanity test ouput 106 | **/ansible-test-sanity-*.json 107 | 108 | # Dev tools 109 | .vscode/ 110 | 111 | .idea/ -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Hello and welcome! Thank you for being interested in contributing to this project. 4 | 5 | First of all get confident with the [Ansible Collections Overview](https://github.com/ansible-collections/overview). 6 | 7 | We accept pull requests for bugfixes, new features, and other improvements, assuming they pass our review. If you are planning a larger feature or refactoring, please create an issue first to discuss it with us. 8 | 9 | ## :bug: Reporting an issue 10 | 11 | Please [search in the issue list](https://github.com/infobloxopen/infoblox-ansible/issues) and if has not been already reported, [open a new issue](https://github.com/infobloxopen/infoblox-ansible/issues/new) 12 | 13 | ## 🏗 To contribute 14 | 15 | A more extensive walk-through can be found in [Ansible's Contributing to collections](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html#hacking-collections). 16 | 17 | 1. Fork this repo (when checking it out, see [here](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html#contributing-to-collections) for how to place the checkout correctly) 18 | 1. Create a feature branch 19 | 1. Commit and push your code. To make the process faster, please ensure: 20 | 21 | - the tests are green. Tests runs using [GitHub Actions](https://help.github.com/en/actions) 22 | - you added a [changelog fragment](https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to) 23 | 24 | Please note that all PRs that are not strictly documentation, testing, or add a new plugin or module, require a changelog fragment. See [Creating a changelog fragment](https://docs.ansible.com/ansible/latest/community/development_process.html#changelogs-how-to) for information on that. 25 | 26 | Further resources: 27 | 28 | - [Ansible Developer guide: developing collections](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html) 29 | - [Ansible Developer guide](https://docs.ansible.com/ansible/latest/dev_guide/index.html) 30 | 31 | This repository adheres to the [Ansible Community code of conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html) 32 | -------------------------------------------------------------------------------- /changelogs/config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | changelog_filename_template: ../CHANGELOG.rst 3 | changelog_filename_version_depth: 0 4 | changes_file: changelog.yaml 5 | changes_format: combined 6 | ignore_other_fragment_extensions: true 7 | keep_fragments: false 8 | mention_ancestor: true 9 | new_plugins_after_name: removed_features 10 | notesdir: fragments 11 | prelude_section_name: release_summary 12 | prelude_section_title: Release Summary 13 | sanitize_changelog: true 14 | sections: 15 | - - major_changes 16 | - Major Changes 17 | - - minor_changes 18 | - Minor Changes 19 | - - breaking_changes 20 | - Breaking Changes / Porting Guide 21 | - - deprecated_features 22 | - Deprecated Features 23 | - - removed_features 24 | - Removed Features (previously deprecated) 25 | - - security_fixes 26 | - Security Fixes 27 | - - bugfixes 28 | - Bugfixes 29 | - - known_issues 30 | - Known Issues 31 | title: Infoblox.Nios_Modules 32 | trivial_section_name: trivial 33 | use_fqcn: true 34 | -------------------------------------------------------------------------------- /galaxy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ### REQUIRED 3 | 4 | # The namespace of the collection. This can be a company/brand/organization or product namespace under which all 5 | # content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with 6 | # underscores or numbers and cannot contain consecutive underscores 7 | namespace: infoblox 8 | 9 | # The name of the collection. Has the same character restrictions as 'namespace' 10 | name: nios_modules 11 | 12 | # The version of the collection. Must be compatible with semantic versioning 13 | version: 1.8.0 14 | 15 | # The path to the Markdown (.md) readme file. This path is relative to the root of the collection 16 | readme: README.md 17 | 18 | # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) 19 | # @nicks:irc/im.site#channel' 20 | authors: 21 | - Hemanth Kumar (hkumar3@infoblox.com) 22 | - Jeenitkumar Khatri (jkhatri@infoblox.com) 23 | - Jaykumar Chhatbar (jchhatbar@infoblox.com) 24 | 25 | ### OPTIONAL but strongly recommended 26 | 27 | # A short summary description of the collection 28 | description: Infoblox Ansible Collection for vNIOS allows managing your NIOS objects through APIs. 29 | 30 | # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only 31 | # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' 32 | license: 33 | - GPL-3.0-only 34 | 35 | # The path to the license file for the collection. This path is relative to the root of the collection. This key is 36 | # mutually exclusive with 'license' 37 | license_file: "" 38 | 39 | # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character 40 | # requirements as 'namespace' and 'name' 41 | tags: 42 | - infoblox 43 | - nios 44 | - cloud 45 | - networking 46 | 47 | # Collections that this collection requires to be installed for it to be usable. The key of the dict is the 48 | # collection label 'namespace.name'. The value is a version range 49 | # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version 50 | # range specifiers can be set and are separated by ',' 51 | # dependencies: {} 52 | 53 | # The URL of the originating SCM repository 54 | repository: https://github.com/infobloxopen/infoblox-ansible/tree/master 55 | 56 | # The URL to any online docs 57 | documentation: https://github.com/infobloxopen/infoblox-ansible/blob/master/README.md 58 | 59 | # The URL to the homepage of the collection/project 60 | homepage: https://github.com/infobloxopen/infoblox-ansible 61 | 62 | # The URL to the collection issue tracker 63 | issues: https://github.com/infobloxopen/infoblox-ansible/issues 64 | -------------------------------------------------------------------------------- /meta/runtime.yml: -------------------------------------------------------------------------------- 1 | --- 2 | requires_ansible: ">=2.16.0" 3 | -------------------------------------------------------------------------------- /playbooks/create_a_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios A record Test 13 | infoblox.nios_modules.nios_a_record: 14 | name: v55.ansibletestzone.com 15 | view: ansibleDnsView 16 | ipv4: 192.168.11.251 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/create_adminuser.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - hosts: localhost 3 | vars: 4 | nios_provider: 5 | host: 10.1.1.1 6 | username: admin 7 | password: infoblox 8 | wapi_version: "2.12.3" 9 | connection: local 10 | tasks: 11 | - name: Create a new adminuser 12 | infoblox.nios_modules.nios_adminuser: 13 | name: new_user 14 | admin_groups: admin-group 15 | comment: "Created by Ansible" 16 | auth_method: KEYPAIR_PASSWORD 17 | auth_type: LOCAL 18 | use_ssh_keys: true 19 | ssh_keys: 20 | - key_name: "ansiblekey1" 21 | key_type: "RSA" 22 | key_value: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" 23 | - key_name: "ansiblekey3" 24 | key_type: "ECDSA" 25 | key_value: "{{ lookup('file', '~/.ssh/id_ecdsa.pub') }}" 26 | password: "ABCd@1235" 27 | ca_certificate_issuer: 'CN="ib-root-ca"' 28 | client_certificate_serial_number: "1366fbb5e12130a95240f56572083ef65ff341fd" 29 | email: "testuser@abc.com" 30 | enable_certificate_authentication: true 31 | time_zone: 'US/Hawaii' 32 | use_time_zone: true 33 | extattrs: 34 | Site: "USA" 35 | state: present 36 | provider: "{{ nios_provider }}" 37 | 38 | - name: Update the username 39 | infoblox.nios_modules.nios_adminuser: 40 | name: {new_name: ansible_user, old_name: new_user} 41 | admin_groups: admin-group 42 | comment: "Created by Ansible" 43 | auth_method: KEYPAIR_PASSWORD 44 | auth_type: LOCAL 45 | use_ssh_keys: true 46 | ssh_keys: 47 | - key_name: "ansiblekey1" 48 | key_type: "RSA" 49 | key_value: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" 50 | - key_name: "ansiblekey3" 51 | key_type: "ECDSA" 52 | key_value: "{{ lookup('file', '~/.ssh/id_ecdsa.pub') }}" 53 | password: "ABCd@1235" 54 | ca_certificate_issuer: 'CN="ib-root-ca"' 55 | client_certificate_serial_number: "1366fbb5e12130a95240f56572083ef65ff341fd" 56 | email: "testuser@abc.com" 57 | enable_certificate_authentication: true 58 | time_zone: 'US/Hawaii' 59 | use_time_zone: true 60 | extattrs: 61 | Site: "USA" 62 | state: present 63 | provider: "{{ nios_provider }}" 64 | -------------------------------------------------------------------------------- /playbooks/create_cname_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios CNAME record 13 | infoblox.nios_modules.nios_cname_record: 14 | name: cname.ansibletestzone.com 15 | canonical: realhost.ansible.com 16 | view: ansibleDnsView 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/create_dns_view.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create DNS view 13 | infoblox.nios_modules.nios_dns_view: 14 | name: ansibleDnsView 15 | network_view: ansibleCollectionsView 16 | extattrs: 17 | Site: Test Site 18 | comment: Created with Ansible 19 | state: present 20 | provider: "{{ nios_provider }}" 21 | -------------------------------------------------------------------------------- /playbooks/create_dtc_lbdn.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.196.205.10 7 | username: cloudadmin 8 | password: infoblox 9 | wapi_version: "2.12" 10 | 11 | connection: local 12 | tasks: 13 | - name: Create DTC LBDN 14 | infoblox.nios_modules.nios_dtc_lbdn: 15 | name: LBDN1 16 | lb_method: GLOBAL_AVAILABILITY 17 | pools: 18 | - pool: Pool1 19 | ratio: 2 20 | ttl: 100 21 | auth_zones: 22 | - demo.com 23 | patterns: 24 | - "*.demo.com" 25 | types: 26 | - A 27 | comment: Created with Ansible 28 | state: present 29 | provider: "{{ nios_provider }}" 30 | -------------------------------------------------------------------------------- /playbooks/create_dtc_monitor_http.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios DTC HTTPS monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_http: 14 | name: https_monitor 15 | port: 443 16 | secure: true 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/create_dtc_monitor_icmp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios DTC ICMP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_icmp: 14 | name: icmp_monitor 15 | comment: Created with Ansible 16 | state: present 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/create_dtc_monitor_pdp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios DTC PDP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_pdp: 14 | name: pdp_monitor 15 | comment: Created with Ansible 16 | state: present 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/create_dtc_monitor_sip.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios DTC SIP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_sip: 14 | name: sip_monitor 15 | comment: Created with Ansible 16 | state: present 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/create_dtc_monitor_snmp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios DTC SNMP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_snmp: 14 | name: snmp_monitor 15 | comment: Created with Ansible 16 | state: present 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/create_dtc_monitor_tcp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios DTC TCP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_tcp: 14 | name: tcp_monitor 15 | port: 8080 16 | comment: Created with Ansible 17 | state: present 18 | provider: "{{ nios_provider }}" 19 | -------------------------------------------------------------------------------- /playbooks/create_dtc_pool.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.196.205.10 7 | username: cloudadmin 8 | password: infoblox 9 | wapi_version: "2.12" 10 | 11 | connection: local 12 | tasks: 13 | - name: Create DTC Pool 14 | infoblox.nios_modules.nios_dtc_pool: 15 | name: Pool1 16 | lb_preferred_method: ROUND_ROBIN 17 | servers: 18 | - server: Server1 19 | ratio: 1 20 | monitors: 21 | - name: monitor1 22 | type: icmp 23 | comment: Created with Ansible 24 | state: present 25 | provider: "{{ nios_provider }}" 26 | -------------------------------------------------------------------------------- /playbooks/create_dtc_server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.196.205.10 7 | username: cloudadmin 8 | password: infoblox 9 | wapi_version: "2.12" 10 | 11 | connection: local 12 | tasks: 13 | - name: Create DTC server 14 | infoblox.nios_modules.nios_dtc_server: 15 | name: Server1 16 | host: 10.196.200.74 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/create_dtc_topology.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.196.205.10 7 | username: cloudadmin 8 | password: infoblox 9 | wapi_version: "2.12" 10 | 11 | connection: local 12 | tasks: 13 | - name: Create a DTC Topology 14 | infoblox.nios_modules.nios_dtc_topology: 15 | name: a_topology 16 | rules: 17 | - dest_type: POOL 18 | destination_link: web_pool1 19 | return_type: REGULAR 20 | sources: 21 | - source_op: IS 22 | source_type: EA0 23 | source_value: DC1 24 | - dest_type: POOL 25 | destination_link: web_pool2 26 | return_type: REGULAR 27 | sources: 28 | - source_op: IS 29 | source_type: EA0 30 | source_value: DC2 31 | state: present 32 | provider: "{{ nios_provider }}" 33 | -------------------------------------------------------------------------------- /playbooks/create_extensible_attribute.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Configure nios extensible attribute 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.120.1.11 7 | username: admin 8 | password: infoblox 9 | 10 | connection: local 11 | tasks: 12 | - name: Create INT extensible attribute 13 | infoblox.nios_modules.nios_extensible_attribute: 14 | name: integer_ea 15 | type: INTEGER 16 | default_value: 11 17 | comment: Created with Ansible 18 | flags: I 19 | state: present 20 | provider: "{{ nios_provider }}" 21 | -------------------------------------------------------------------------------- /playbooks/create_mx_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios MX record 13 | infoblox.nios_modules.nios_mx_record: 14 | name: mx.ansibletestzone.com 15 | mx: mailhost.ansible.com 16 | view: ansibleDnsView 17 | preference: 0 18 | comment: Created with Ansible 19 | state: present 20 | provider: "{{ nios_provider }}" 21 | -------------------------------------------------------------------------------- /playbooks/create_network.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create network 13 | infoblox.nios_modules.nios_network: 14 | network: 10.0.0.0/24 15 | network_view: ansibleCollectionsView 16 | use_logic_filter_rules: true 17 | logic_filter_rules: 18 | - filter: PXE-UEFI 19 | type: Option 20 | options: 21 | - name: domain-name 22 | value: infoblox-ansible.com 23 | extattrs: 24 | Site: Test Site 25 | comment: Created with Ansible 26 | state: present 27 | provider: "{{ nios_provider }}" 28 | -------------------------------------------------------------------------------- /playbooks/create_network_view.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create network view 13 | infoblox.nios_modules.nios_network_view: 14 | name: ansibleCollectionsView 15 | extattrs: 16 | Site: Test Site 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/create_nsgroup_delegation.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Nameserver Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create infoblox nameserver delegation group 13 | infoblox.nios_modules.nios_nsgroup_delegation: 14 | name: my-delegation-group 15 | delegate_to: 16 | - name: first 17 | address: 192.168.0.10 18 | - name: second 19 | address: 192.168.0.20 20 | comment: this is a delegation nameserver group 21 | extattrs: 22 | Site: Test Site 23 | state: present 24 | provider: "{{ nios_provider }}" 25 | -------------------------------------------------------------------------------- /playbooks/create_nsgroup_forwardingmember.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Nameserver Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create infoblox nameserver forwarding member group with external forwarders 13 | infoblox.nios_modules.nios_nsgroup_forwardingmember: 14 | name: my-forwardingmember-group 15 | comment: this is a forwarding member nameserver group with external forwarders 16 | extattrs: 17 | Site: Test Site 18 | forwarding_servers: 19 | - name: infoblox.cloud-ansible-client-nios-gm 20 | use_override_forwarders: true 21 | forwarders_only: true 22 | forward_to: 23 | - name: ns1 24 | address: 192.168.10.1 25 | - name: ns2 26 | address: 192.168.10.2 27 | - name: infoblox.cloud-ansible-client-nios-mem1 28 | use_override_forwarders: true 29 | forwarders_only: false 30 | forward_to: 31 | - name: ns3 32 | address: 192.168.10.3 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | -------------------------------------------------------------------------------- /playbooks/create_nsgroup_forwardstubserver.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Nameserver Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create infoblox nameserver forward/stub group 13 | infoblox.nios_modules.nios_nsgroup_forwardstubserver: 14 | name: new-forwardstub-group 15 | comment: this is a forward/stub nameserver group 16 | extattrs: 17 | Site: Test Site 18 | external_servers: 19 | - name: first 20 | address: 192.168.0.10 21 | - name: second 22 | address: 192.168.0.20 23 | state: present 24 | provider: "{{ nios_provider }}" 25 | -------------------------------------------------------------------------------- /playbooks/create_nsgroup_stubmember.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Nameserver Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create infoblox nameserver stub member group 13 | infoblox.nios_modules.nios_nsgroup_stubmember: 14 | name: my-stubmember-group 15 | comment: this is a stub member nameserver group 16 | extattrs: 17 | Site: Test Site 18 | stub_members: 19 | - name: infoblox.cloud-ansible-client-nios-gm 20 | - name: infoblox.cloud-ansible-client-nios-mem1 21 | state: present 22 | provider: "{{ nios_provider }}" 23 | -------------------------------------------------------------------------------- /playbooks/create_txt_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Create Nios TXT record 13 | infoblox.nios_modules.nios_txt_record: 14 | name: one.txt.ansibletestzone.com 15 | text: example_text45 16 | view: ansibleDnsView 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/create_zone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | wapi_version: 2.1 10 | 11 | connection: local 12 | tasks: 13 | - name: Create zone 14 | infoblox.nios_modules.nios_zone: 15 | name: ansibletestzone.com 16 | view: ansibleDnsView 17 | extattrs: 18 | Site: Test Site 19 | comment: Created with Ansible 20 | state: present 21 | provider: "{{ nios_provider }}" 22 | -------------------------------------------------------------------------------- /playbooks/delete_cname_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios CNAME record 13 | infoblox.nios_modules.nios_cname_record: 14 | name: cname.ansible.com 15 | canonical: realhost.ansible.com 16 | comment: Created with Ansible 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | -------------------------------------------------------------------------------- /playbooks/delete_dnsview.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete DNS view 13 | infoblox.nios_modules.nios_dns_view: 14 | name: ansibleDnsView 15 | network_view: ansibleNetView 16 | state: absent 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_monitor_http.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios DTC HTTPS monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_http: 14 | name: https_monitor 15 | state: absent 16 | provider: "{{ nios_provider }}" 17 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_monitor_icmp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios DTC ICMP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_icmp: 14 | name: icmp_monitor 15 | state: absent 16 | provider: "{{ nios_provider }}" 17 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_monitor_pdp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios DTC PDP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_pdp: 14 | name: pdp_monitor 15 | state: absent 16 | provider: "{{ nios_provider }}" 17 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_monitor_sip.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios DTC SIP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_sip: 14 | name: sip_monitor 15 | port: 8080 16 | state: absent 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_monitor_snmp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios DTC SNMP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_snmp: 14 | name: snmp_monitor 15 | state: absent 16 | provider: "{{ nios_provider }}" 17 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_monitor_tcp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios DTC TCP monitor Test 13 | infoblox.nios_modules.nios_dtc_monitor_tcp: 14 | name: tcp_monitor 15 | state: absent 16 | provider: "{{ nios_provider }}" 17 | -------------------------------------------------------------------------------- /playbooks/delete_dtc_topology.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.196.205.10 7 | username: cloudadmin 8 | password: infoblox 9 | wapi_version: "2.12" 10 | 11 | connection: local 12 | tasks: 13 | - name: Delete a DTC Topology 14 | infoblox.nios_modules.nios_dtc_topology: 15 | name: a_topology 16 | state: absent 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/delete_mx_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios MX record 13 | infoblox.nios_modules.nios_mx_record: 14 | name: ansible.com 15 | mx: mailhost.ansible.com 16 | preference: 0 17 | comment: Created with Ansible 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/delete_network.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.60.27.4 7 | username: admin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete network 13 | infoblox.nios_modules.nios_network: 14 | network: 10.0.0.0/24 15 | network_view: ansibleNetView 16 | state: absent 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/delete_network_view.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.60.27.4 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete network view 13 | infoblox.nios_modules.nios_network_view: 14 | name: ansibleNetView 15 | state: absent 16 | provider: "{{ nios_provider }}" 17 | -------------------------------------------------------------------------------- /playbooks/delete_txt_record.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete Nios TXT record 13 | infoblox.nios_modules.nios_txt_record: 14 | name: fqdn.txt.ansible.com 15 | text: example_text 16 | view: default 17 | comment: Created with Ansible 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/delete_zone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.36.118.2 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Delete zone 13 | infoblox.nios_modules.nios_zone: 14 | name: ansiblezone.com 15 | view: ansibleDnsView 16 | state: absent 17 | provider: "{{ nios_provider }}" 18 | -------------------------------------------------------------------------------- /playbooks/restart_services.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.196.205.10 7 | username: cloudadmin 8 | password: infoblox 9 | wapi_version: "2.12" 10 | 11 | connection: local 12 | tasks: 13 | - name: Restart Services 14 | infoblox.nios_modules.nios_restartservices: 15 | provider: "{{ nios_provider }}" 16 | -------------------------------------------------------------------------------- /playbooks/update_a_record.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.34.34.175 7 | username: cloudadmin 8 | password: admin 9 | 10 | connection: local 11 | tasks: 12 | - name: Update Nios A record 13 | infoblox.nios_modules.nios_a_record: 14 | name: { new_name: v7.testzone.com, old_name: v7.testzone.com } 15 | view: testDnsView 16 | ipv4: 1.1.11.2 17 | comment: Created with Ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | -------------------------------------------------------------------------------- /playbooks/update_member.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Infoblox Member Configuration 3 | hosts: localhost 4 | vars: 5 | nios_provider: 6 | host: 10.34.10.724 7 | username: admin 8 | password: cloudadmin 9 | connection: local 10 | tasks: 11 | - name: Update member host name 12 | infoblox.nios_modules.nios_member: 13 | host_name: { old_name: block1.localdomain, new_name: member01.localdomain } 14 | master_candidate: false 15 | vip_setting: 16 | - address: 120.0.0.25 17 | subnet_mask: 255.255.255.0 18 | gateway: 120.0.0.1 19 | config_addr_type: IPV4 20 | platform: VNIOS 21 | state: present 22 | provider: "{{ nios_provider }}" 23 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # Collections Plugins Directory 2 | 3 | This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that 4 | is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that 5 | would contain module utils and modules respectively. 6 | 7 | Here is an example directory of the majority of plugins currently supported by Ansible: 8 | 9 | ``` 10 | └── plugins 11 | ├── action 12 | ├── become 13 | ├── cache 14 | ├── callback 15 | ├── cliconf 16 | ├── connection 17 | ├── filter 18 | ├── httpapi 19 | ├── inventory 20 | ├── lookup 21 | ├── module_utils 22 | ├── modules 23 | ├── netconf 24 | ├── shell 25 | ├── strategy 26 | ├── terminal 27 | ├── test 28 | └── vars 29 | ``` 30 | 31 | A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible/2.9/plugins/plugins.html). -------------------------------------------------------------------------------- /plugins/doc_fragments/nios.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright: (c) 2015, Peter Sprygada 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | from __future__ import (absolute_import, division, print_function) 6 | __metaclass__ = type 7 | 8 | 9 | class ModuleDocFragment(object): 10 | 11 | # Standard files documentation fragment 12 | DOCUMENTATION = r''' 13 | options: 14 | provider: 15 | description: 16 | - A dict object containing connection details. 17 | type: dict 18 | suboptions: 19 | host: 20 | description: 21 | - Specifies the DNS host name or address for connecting to the remote 22 | instance of NIOS WAPI over REST 23 | - Value can also be specified using C(INFOBLOX_HOST) environment 24 | variable. 25 | type: str 26 | username: 27 | description: 28 | - Configures the username to use to authenticate the connection to 29 | the remote instance of NIOS. 30 | - Value can also be specified using C(INFOBLOX_USERNAME) environment 31 | variable. 32 | type: str 33 | password: 34 | description: 35 | - Specifies the password to use to authenticate the connection to 36 | the remote instance of NIOS. 37 | - Value can also be specified using C(INFOBLOX_PASSWORD) environment 38 | variable. 39 | type: str 40 | cert: 41 | description: 42 | - Specifies the client certificate file with digest of x509 config 43 | for extra layer secure connection the remote instance of NIOS. 44 | - Value can also be specified using C(INFOBLOX_CERT) environment 45 | variable. 46 | type: str 47 | key: 48 | description: 49 | - Specifies private key file for encryption with the certificate 50 | in order to connect with remote instance of NIOS. 51 | - Value can also be specified using C(INFOBLOX_KEY) environment 52 | variable. 53 | type: str 54 | validate_certs: 55 | description: 56 | - Boolean value to enable or disable verifying SSL certificates 57 | - Value can also be specified using C(INFOBLOX_SSL_VERIFY) environment 58 | variable. 59 | type: bool 60 | default: no 61 | aliases: [ ssl_verify ] 62 | http_request_timeout: 63 | description: 64 | - The amount of time before to wait before receiving a response 65 | - Value can also be specified using C(INFOBLOX_HTTP_REQUEST_TIMEOUT) environment 66 | variable. 67 | type: int 68 | default: 10 69 | max_retries: 70 | description: 71 | - Configures the number of attempted retries before the connection 72 | is declared usable 73 | - Value can also be specified using C(INFOBLOX_MAX_RETRIES) environment 74 | variable. 75 | type: int 76 | default: 3 77 | wapi_version: 78 | description: 79 | - Specifies the version of WAPI to use 80 | - Value can also be specified using C(INFOBLOX_WAPI_VERSION) environment 81 | variable. 82 | - Until ansible 2.8 the default WAPI was 1.4 83 | type: str 84 | default: '2.12.3' 85 | max_results: 86 | description: 87 | - Specifies the maximum number of objects to be returned, 88 | if set to a negative number the appliance will return an error when the 89 | number of returned objects would exceed the setting. 90 | - Value can also be specified using C(INFOBLOX_MAX_RESULTS) environment 91 | variable. 92 | type: int 93 | default: 1000 94 | http_pool_maxsize: 95 | description: 96 | - Insert description here 97 | type: int 98 | default: 10 99 | http_pool_connections: 100 | description: 101 | - Insert decription here 102 | type: int 103 | default: 10 104 | silent_ssl_warnings: 105 | description: 106 | - Insert description here 107 | type: bool 108 | default: True 109 | notes: 110 | - "This module must be run locally, which can be achieved by specifying C(connection: local)." 111 | - Please read the :ref:`nios_guide` for more detailed information on how to use Infoblox with Ansible. 112 | 113 | ''' 114 | -------------------------------------------------------------------------------- /plugins/inventory/nios_inventory.py: -------------------------------------------------------------------------------- 1 | from __future__ import (absolute_import, division, print_function) 2 | __metaclass__ = type 3 | # Copyright (c) 2018-2019 Red Hat, Inc. 4 | # Copyright (c) 2020 Infoblox, Inc. 5 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 6 | 7 | DOCUMENTATION = r''' 8 | name: nios_inventory 9 | author: 10 | - Will Tome (@willtome) 11 | short_description: Infoblox inventory plugin 12 | version_added: "1.0.0" 13 | description: 14 | - This plugin allows you to query the Infoblox Grid for host records and 15 | use the response data to populate the inventory file. 16 | options: 17 | host: 18 | description: 19 | - Specifies the DNS host name or address for connecting to the remote 20 | instance of NIOS WAPI over REST. 21 | - Value can also be specified using C(INFOBLOX_HOST) environment 22 | variable. 23 | type: string 24 | required: True 25 | env: 26 | - name: INFOBLOX_HOST 27 | username: 28 | description: 29 | - Configures the username to use to authenticate the connection to 30 | the remote instance of NIOS. 31 | - Value can also be specified using C(INFOBLOX_USERNAME) environment 32 | variable. 33 | type: string 34 | required: True 35 | env: 36 | - name: INFOBLOX_USERNAME 37 | password: 38 | description: 39 | - Specifies the password to use to authenticate the connection to 40 | the remote instance of NIOS. 41 | - Value can also be specified using C(INFOBLOX_PASSWORD) environment 42 | variable. 43 | type: string 44 | env: 45 | - name: INFOBLOX_PASSWORD 46 | extattrs: 47 | description: 48 | - Allows you to filter the returned host record based on the 49 | extensible attributes assigned to them. 50 | default: {} 51 | type: dict 52 | hostfilter: 53 | description: 54 | - Accepts a key/value pair and uses it to filter the 55 | host records to be returned. 56 | default: {} 57 | type: dict 58 | requirements: 59 | - python >= 3.4 60 | - infoblox-client 61 | ''' 62 | 63 | EXAMPLES = r''' 64 | plugin: infoblox.nios_modules.nios_inventory 65 | host: blox.example.com 66 | username: admin 67 | ''' 68 | 69 | 70 | from ansible.plugins.inventory import BaseInventoryPlugin 71 | from ..module_utils.api import WapiInventory 72 | from ..module_utils.api import normalize_extattrs, flatten_extattrs 73 | from ansible.module_utils.six import iteritems 74 | from ansible.errors import AnsibleError 75 | 76 | 77 | class InventoryModule(BaseInventoryPlugin): 78 | NAME = 'nios_inventory' 79 | 80 | def parse(self, inventory, loader, path, cache=True): # Plugin interface (2) 81 | super(InventoryModule, self).parse(inventory, loader, path) 82 | self._read_config_data(path) 83 | 84 | provider = {'host': self.get_option('host'), 85 | 'username': self.get_option('username'), 86 | 'password': self.get_option('password')} 87 | 88 | wapi = WapiInventory(provider) 89 | 90 | host_filter = self.get_option('hostfilter') 91 | extattrs = normalize_extattrs(self.get_option('extattrs')) 92 | return_fields = ['name', 'view', 'extattrs', 'ipv4addrs'] 93 | 94 | hosts = wapi.get_object('record:host', host_filter, extattrs=extattrs, return_fields=return_fields) or [] 95 | 96 | if not hosts: 97 | raise AnsibleError("host record is not present") 98 | 99 | for host in hosts: 100 | group_name = self.inventory.add_group(host['view']) 101 | host_name = self.inventory.add_host(host['name']) 102 | self.inventory.add_child(group_name, host_name) 103 | 104 | self.inventory.set_variable(host_name, 'view', host['view']) 105 | self.inventory.set_variable(host_name, 'ipv4addrs', [item['ipv4addr'] for item in host['ipv4addrs']]) 106 | 107 | for key, value in iteritems(flatten_extattrs(host['extattrs'])): 108 | self.inventory.set_variable(host_name, key, value) 109 | -------------------------------------------------------------------------------- /plugins/lookup/nios_lookup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2019 Red Hat, Inc. 2 | # Copyright (c) 2020 Infoblox, Inc. 3 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 4 | 5 | 6 | from __future__ import (absolute_import, division, print_function) 7 | 8 | __metaclass__ = type 9 | 10 | DOCUMENTATION = ''' 11 | --- 12 | name: nios_lookup 13 | short_description: Query Infoblox NIOS objects 14 | version_added: "1.0.0" 15 | description: 16 | - Uses the Infoblox WAPI API to fetch NIOS specified objects. This lookup 17 | supports adding additional keywords to filter the return data and specify 18 | the desired set of returned fields. 19 | requirements: 20 | - infoblox-client 21 | 22 | options: 23 | _terms: 24 | description: 25 | - The name of the network object to be returned from the Infoblox appliance. 26 | required: True 27 | type: str 28 | return_fields: 29 | description: The list of field names to return for the specified object. 30 | type: list 31 | elements: str 32 | filter: 33 | description: A dict object that is used to filter the returned objects. 34 | type: dict 35 | extattrs: 36 | description: A dict object that is used to filter based on extensible attributes. 37 | type: dict 38 | ''' 39 | 40 | EXAMPLES = """ 41 | - name: fetch all networkview objects 42 | ansible.builtin.set_fact: 43 | networkviews: "{{ lookup('infoblox.nios_modules.nios_lookup', 'networkview', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" 44 | 45 | - name: fetch the default dns view 46 | ansible.builtin.set_fact: 47 | dns_views: "{{ lookup('infoblox.nios_modules.nios_lookup', 'view', filter={'name': 'default'}, 48 | provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" 49 | 50 | # all of the examples below use credentials that are set using env variables 51 | # export INFOBLOX_HOST=nios01 52 | # export INFOBLOX_USERNAME=admin 53 | # export INFOBLOX_PASSWORD=admin 54 | 55 | - name: fetch all host records and include extended attributes 56 | ansible.builtin.set_fact: 57 | host_records: "{{ lookup('infoblox.nios_modules.nios_lookup', 'record:host', return_fields=['extattrs', 'name', 'view', 'comment']}) }}" 58 | 59 | 60 | - name: use env variables to pass credentials 61 | ansible.builtin.set_fact: 62 | networkviews: "{{ lookup('infoblox.nios_modules.nios_lookup', 'networkview') }}" 63 | 64 | - name: get a host record 65 | ansible.builtin.set_fact: 66 | host: "{{ lookup('infoblox.nios_modules.nios_lookup', 'record:host', filter={'name': 'hostname.ansible.com'}) }}" 67 | 68 | - name: get the authoritative zone from a non default dns view 69 | ansible.builtin.set_fact: 70 | host: "{{ lookup('infoblox.nios_modules.nios_lookup', 'zone_auth', filter={'fqdn': 'ansible.com', 'view': 'ansible-dns'}) }}" 71 | """ 72 | 73 | RETURN = """ 74 | obj_type: 75 | description: 76 | - The object type specified in the terms argument 77 | returned: always 78 | type: list 79 | contains: 80 | obj_field: 81 | description: 82 | - One or more obj_type fields as specified by return_fields argument or 83 | the default set of fields as per the object type 84 | """ 85 | 86 | from ansible.plugins.lookup import LookupBase 87 | from ansible.errors import AnsibleError 88 | from ..module_utils.api import WapiLookup 89 | from ..module_utils.api import normalize_extattrs, flatten_extattrs 90 | 91 | 92 | class LookupModule(LookupBase): 93 | 94 | def run(self, terms, variables=None, **kwargs): 95 | try: 96 | obj_type = terms[0] 97 | except IndexError: 98 | raise AnsibleError('the object_type must be specified') 99 | 100 | return_fields = kwargs.pop('return_fields', None) 101 | filter_data = kwargs.pop('filter', {}) 102 | extattrs = normalize_extattrs(kwargs.pop('extattrs', {})) 103 | provider = kwargs.pop('provider', {}) 104 | wapi = WapiLookup(provider) 105 | res = wapi.get_object(obj_type, filter_data, return_fields=return_fields, extattrs=extattrs) 106 | if res is not None: 107 | for obj in res: 108 | if 'extattrs' in obj: 109 | obj['extattrs'] = flatten_extattrs(obj['extattrs']) 110 | else: 111 | res = [] 112 | return res 113 | -------------------------------------------------------------------------------- /plugins/lookup/nios_next_vlan_id.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018-2019 Red Hat, Inc. 2 | # Copyright (c) 2020 Infoblox, Inc. 3 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 4 | 5 | 6 | from __future__ import (absolute_import, division, print_function) 7 | 8 | __metaclass__ = type 9 | 10 | DOCUMENTATION = ''' 11 | --- 12 | name: nios_next_vlan_id 13 | short_description: Return the next available VLAN ID for a VLAN view/range 14 | version_added: "1.8.0" 15 | description: 16 | - Uses the Infoblox WAPI API to return the next available VLAN IDs for a given VLAN view/range 17 | requirements: 18 | - infoblox_client 19 | 20 | options: 21 | parent: 22 | description: The VLAN view/range to retrieve the VLAN IDs from. 23 | required: false 24 | default: default 25 | type: str 26 | num: 27 | description: The number of VLAN IDs to return. 28 | required: false 29 | default: 1 30 | type: int 31 | exclude: 32 | description: List of VLAN IDs that need to be excluded from returned VLAN IDs. 33 | required: false 34 | type: list 35 | elements: int 36 | ''' 37 | 38 | EXAMPLES = """ 39 | - name: return the next available VLAN ID from a VLAN view 40 | ansible.builtin.set_fact: 41 | networkaddr: "{{ lookup('infoblox.nios_modules.nios_next_vlan_id', parent='vlanview', 42 | provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" 43 | 44 | - name: return the next two available VLAN IDs from a VLAN range 45 | ansible.builtin.set_fact: 46 | networkaddr: "{{ lookup('infoblox.nios_modules.nios_next_vlan_id', parent='vlanrange', num=2, 47 | provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" 48 | 49 | - name: return the next available VLAN ID, excluding IDs 1-3 50 | ansible.builtin.set_fact: 51 | networkaddr: "{{ lookup('infoblox.nios_modules.nios_next_vlan_id', parent='vlanrange', exclude=[1,2,3], 52 | provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" 53 | """ 54 | 55 | RETURN = """ 56 | _list: 57 | description: 58 | - The list of next vlan ids available 59 | returned: always 60 | type: list 61 | """ 62 | 63 | from ansible.plugins.lookup import LookupBase 64 | from ansible.module_utils._text import to_text 65 | from ansible.errors import AnsibleError 66 | from ..module_utils.api import WapiLookup 67 | 68 | 69 | class LookupModule(LookupBase): 70 | 71 | def run(self, terms, variables=None, **kwargs): 72 | parent_ref = str() 73 | provider = kwargs.pop('provider', {}) 74 | wapi = WapiLookup(provider) 75 | num = kwargs.get('num', 1) 76 | exclude_vlan_id = kwargs.get('exclude', []) 77 | parent = kwargs.get('parent', 'default') 78 | 79 | try: 80 | parent_obj_vlanview = wapi.get_object('vlanview', {'name': parent}) 81 | parent_obj_vlanrange = wapi.get_object('vlanrange', {'name': parent}) 82 | if parent_obj_vlanrange: 83 | parent_ref = parent_obj_vlanrange[0]['_ref'] 84 | elif parent_obj_vlanview: 85 | parent_ref = parent_obj_vlanview[0]['_ref'] 86 | else: 87 | raise AnsibleError(message='VLAN View/Range \'%s\' cannot be found.' % parent) 88 | 89 | avail_ids = wapi.call_func('next_available_vlan_id', parent_ref, {'num': num, 'exclude': exclude_vlan_id}) 90 | return [avail_ids['vlan_ids']] 91 | 92 | except Exception as exc: 93 | raise AnsibleError(to_text(exc)) 94 | -------------------------------------------------------------------------------- /plugins/module_utils/network.py: -------------------------------------------------------------------------------- 1 | from __future__ import (absolute_import, division, print_function) 2 | __metaclass__ = type 3 | import socket 4 | 5 | 6 | def validate_ip_address(address): 7 | try: 8 | socket.inet_aton(address) 9 | except socket.error: 10 | return False 11 | return address.count('.') == 3 12 | 13 | 14 | def validate_ip_v6_address(address): 15 | try: 16 | socket.inet_pton(socket.AF_INET6, address) 17 | except socket.error: 18 | return False 19 | return True 20 | -------------------------------------------------------------------------------- /plugins/modules/nios_dns_view.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright (c) 2018-2019 Red Hat, Inc. 3 | # Copyright (c) 2020 Infoblox, Inc. 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | from __future__ import absolute_import, division, print_function 7 | __metaclass__ = type 8 | 9 | DOCUMENTATION = ''' 10 | --- 11 | module: nios_dns_view 12 | author: "Peter Sprygada (@privateip)" 13 | short_description: Configure Infoblox NIOS DNS views 14 | version_added: "1.0.0" 15 | description: 16 | - Adds and/or removes instances of DNS view objects from 17 | Infoblox NIOS servers. This module manages NIOS C(view) objects 18 | using the Infoblox WAPI interface over REST. 19 | - Updates instances of DNS view object from Infoblox NIOS servers. 20 | requirements: 21 | - infoblox-client 22 | extends_documentation_fragment: infoblox.nios_modules.nios 23 | notes: 24 | - This module supports C(check_mode). 25 | options: 26 | name: 27 | description: 28 | - Specifies the fully qualified hostname to add or remove from 29 | the system. User can also update the hostname as it is possible 30 | to pass a dict containing I(new_name), I(old_name). See examples. 31 | required: true 32 | aliases: 33 | - view 34 | type: str 35 | network_view: 36 | description: 37 | - Specifies the name of the network view to assign the configured 38 | DNS view to. The network view must already be configured on the 39 | target system. 40 | default: default 41 | type: str 42 | extattrs: 43 | description: 44 | - Allows for the configuration of Extensible Attributes on the 45 | instance of the object. This argument accepts a set of key / value 46 | pairs for configuration. 47 | type: dict 48 | comment: 49 | description: 50 | - Configures a text string comment to be associated with the instance 51 | of this object. The provided text string will be configured on the 52 | object instance. 53 | type: str 54 | state: 55 | description: 56 | - Configures the intended state of the instance of the object on 57 | the NIOS server. When this value is set to C(present), the object 58 | is configured on the device and when this value is set to C(absent) 59 | the value is removed (if necessary) from the device. 60 | default: present 61 | choices: 62 | - present 63 | - absent 64 | type: str 65 | 66 | ''' 67 | 68 | EXAMPLES = ''' 69 | - name: Configure a new dns view instance 70 | infoblox.nios_modules.nios_dns_view: 71 | name: ansible-dns 72 | state: present 73 | provider: 74 | host: "{{ inventory_hostname_short }}" 75 | username: admin 76 | password: admin 77 | connection: local 78 | 79 | - name: Update the comment for dns view 80 | infoblox.nios_modules.nios_dns_view: 81 | name: ansible-dns 82 | comment: this is an example comment 83 | state: present 84 | provider: 85 | host: "{{ inventory_hostname_short }}" 86 | username: admin 87 | password: admin 88 | connection: local 89 | 90 | - name: Remove the dns view instance 91 | infoblox.nios_modules.nios_dns_view: 92 | name: ansible-dns 93 | state: absent 94 | provider: 95 | host: "{{ inventory_hostname_short }}" 96 | username: admin 97 | password: admin 98 | connection: local 99 | 100 | - name: Update the dns view instance 101 | infoblox.nios_modules.nios_dns_view: 102 | name: {new_name: ansible-dns-new, old_name: ansible-dns} 103 | state: present 104 | provider: 105 | host: "{{ inventory_hostname_short }}" 106 | username: admin 107 | password: admin 108 | connection: local 109 | ''' 110 | 111 | RETURN = ''' # ''' 112 | 113 | from ansible.module_utils.basic import AnsibleModule 114 | from ..module_utils.api import WapiModule 115 | from ..module_utils.api import NIOS_DNS_VIEW 116 | from ..module_utils.api import normalize_ib_spec 117 | 118 | 119 | def main(): 120 | ''' Main entry point for module execution 121 | ''' 122 | ib_spec = dict( 123 | name=dict(required=True, aliases=['view'], ib_req=True), 124 | network_view=dict(default='default', ib_req=True), 125 | 126 | extattrs=dict(type='dict'), 127 | comment=dict() 128 | ) 129 | 130 | argument_spec = dict( 131 | provider=dict(required=True), 132 | state=dict(default='present', choices=['present', 'absent']) 133 | ) 134 | 135 | argument_spec.update(normalize_ib_spec(ib_spec)) 136 | argument_spec.update(WapiModule.provider_spec) 137 | 138 | module = AnsibleModule(argument_spec=argument_spec, 139 | supports_check_mode=True) 140 | 141 | wapi = WapiModule(module) 142 | result = wapi.run(NIOS_DNS_VIEW, ib_spec) 143 | 144 | module.exit_json(**result) 145 | 146 | 147 | if __name__ == '__main__': 148 | main() 149 | -------------------------------------------------------------------------------- /plugins/modules/nios_dtc_monitor_icmp.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright (c) 2018-2019 Red Hat, Inc. 3 | # Copyright (c) 2020 Infoblox, Inc. 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | from __future__ import absolute_import, division, print_function 7 | __metaclass__ = type 8 | 9 | DOCUMENTATION = ''' 10 | --- 11 | module: nios_dtc_monitor_icmp 12 | author: "Joachim Buyse (@jbisabel)" 13 | version_added: "1.6.0" 14 | short_description: Configure Infoblox NIOS DTC ICMP monitors 15 | description: 16 | - Adds and/or removes instances of DTC ICMP monitor objects from Infoblox NIOS 17 | servers. This module manages C(dtc:monitor:icmp) objects using the Infoblox 18 | WAPI interface over REST. 19 | requirements: 20 | - infoblox-client 21 | extends_documentation_fragment: infoblox.nios_modules.nios 22 | notes: 23 | - This module supports C(check_mode). 24 | options: 25 | name: 26 | description: 27 | - Configures the display name for this DTC monitor. Values with leading 28 | or trailing white space are not valid for this field. 29 | required: true 30 | type: str 31 | interval: 32 | description: 33 | - Configures the interval for ICMP health check. 34 | type: int 35 | default: 5 36 | retry_down: 37 | description: 38 | - Configures the value of how many times the server should appear as 39 | down to be treated as dead after it was alive. 40 | type: int 41 | default: 1 42 | retry_up: 43 | description: 44 | - Configures the value of how many times the server should appear as up 45 | to be treated as alive after it was dead. 46 | type: int 47 | default: 1 48 | timeout: 49 | description: 50 | - Configures the timeout for ICMP health check in seconds. 51 | type: int 52 | default: 15 53 | extattrs: 54 | description: 55 | - Allows for the configuration of Extensible Attributes on the 56 | instance of the object. This argument accepts a set of key / value 57 | pairs for configuration. 58 | type: dict 59 | comment: 60 | description: 61 | - Configures a text string comment to be associated with the instance 62 | of this object. The provided text string will be configured on the 63 | object instance. 64 | type: str 65 | state: 66 | description: 67 | - Configures the intended state of the instance of the object on 68 | the NIOS server. When this value is set to C(present), the object 69 | is configured on the device and when this value is set to C(absent) 70 | the value is removed (if necessary) from the device. 71 | default: present 72 | choices: 73 | - present 74 | - absent 75 | type: str 76 | ''' 77 | 78 | EXAMPLES = ''' 79 | - name: Configure a DTC ICMP monitor 80 | infoblox.nios_modules.nios_dtc_monitor_icmp: 81 | name: icmp_monitor 82 | port: 8080 83 | state: present 84 | provider: 85 | host: "{{ inventory_hostname_short }}" 86 | username: admin 87 | password: admin 88 | connection: local 89 | 90 | - name: Add a comment to an existing DTC ICMP monitor 91 | infoblox.nios_modules.nios_dtc_monitor_icmp: 92 | name: icmp_monitor 93 | comment: this is a test comment 94 | state: present 95 | provider: 96 | host: "{{ inventory_hostname_short }}" 97 | username: admin 98 | password: admin 99 | connection: local 100 | 101 | - name: Remove a DTC ICMP monitor from the system 102 | infoblox.nios_modules.nios_dtc_monitor_icmp: 103 | name: icmp_monitor 104 | state: absent 105 | provider: 106 | host: "{{ inventory_hostname_short }}" 107 | username: admin 108 | password: admin 109 | connection: local 110 | ''' 111 | 112 | RETURN = ''' # ''' 113 | 114 | from ansible.module_utils.basic import AnsibleModule 115 | from ..module_utils.api import WapiModule 116 | from ..module_utils.api import NIOS_DTC_MONITOR_ICMP 117 | from ..module_utils.api import normalize_ib_spec 118 | 119 | 120 | def main(): 121 | ''' Main entry point for module execution 122 | ''' 123 | 124 | ib_spec = dict( 125 | name=dict(required=True, ib_req=True), 126 | 127 | interval=dict(type='int', default=5), 128 | retry_down=dict(type='int', default=1), 129 | retry_up=dict(type='int', default=1), 130 | timeout=dict(type='int', default=15), 131 | 132 | extattrs=dict(type='dict'), 133 | comment=dict(), 134 | ) 135 | 136 | argument_spec = dict( 137 | provider=dict(required=True), 138 | state=dict(default='present', choices=['present', 'absent']) 139 | ) 140 | 141 | argument_spec.update(normalize_ib_spec(ib_spec)) 142 | argument_spec.update(WapiModule.provider_spec) 143 | 144 | module = AnsibleModule(argument_spec=argument_spec, 145 | supports_check_mode=True) 146 | 147 | wapi = WapiModule(module) 148 | result = wapi.run(NIOS_DTC_MONITOR_ICMP, ib_spec) 149 | 150 | module.exit_json(**result) 151 | 152 | 153 | if __name__ == '__main__': 154 | main() 155 | -------------------------------------------------------------------------------- /plugins/modules/nios_dtc_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright (c) 2018-2019 Red Hat, Inc. 3 | # Copyright (c) 2020 Infoblox, Inc. 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | from __future__ import absolute_import, division, print_function 7 | __metaclass__ = type 8 | 9 | DOCUMENTATION = ''' 10 | --- 11 | module: nios_dtc_server 12 | author: "Mauricio Teixeira (@badnetmask)" 13 | short_description: Configure Infoblox NIOS DTC Server 14 | version_added: "1.1.0" 15 | description: 16 | - Adds and/or removes instances of DTC Server objects from 17 | Infoblox NIOS servers. This module manages NIOS C(dtc:server) objects 18 | using the Infoblox WAPI interface over REST. 19 | requirements: 20 | - infoblox-client 21 | extends_documentation_fragment: infoblox.nios_modules.nios 22 | notes: 23 | - This module supports C(check_mode). 24 | options: 25 | name: 26 | description: 27 | - Specifies the DTC Server display name 28 | required: true 29 | type: str 30 | host: 31 | description: 32 | - Configures the IP address (A response) or FQDN (CNAME response) 33 | of the server 34 | required: true 35 | type: str 36 | disable: 37 | description: 38 | - Determines whether the DTC Server is disabled or not. 39 | When this is set to False, the fixed address is enabled. 40 | required: false 41 | type: bool 42 | default: False 43 | extattrs: 44 | description: 45 | - Allows for the configuration of Extensible Attributes on the 46 | instance of the object. This argument accepts a set of key / value 47 | pairs for configuration. 48 | type: dict 49 | comment: 50 | description: 51 | - Configures a text string comment to be associated with the instance 52 | of this object. The provided text string will be configured on the 53 | object instance. 54 | type: str 55 | state: 56 | description: 57 | - Configures the intended state of the instance of the object on 58 | the NIOS server. When this value is set to C(present), the object 59 | is configured on the device and when this value is set to C(absent) 60 | the value is removed (if necessary) from the device. 61 | default: present 62 | choices: 63 | - present 64 | - absent 65 | type: str 66 | ''' 67 | 68 | EXAMPLES = ''' 69 | - name: Configure a DTC Server 70 | infoblox.nios_modules.nios_dtc_server: 71 | name: a.example.com 72 | host: 192.168.10.1 73 | state: present 74 | provider: 75 | host: "{{ inventory_hostname_short }}" 76 | username: admin 77 | password: admin 78 | connection: local 79 | 80 | - name: Add a comment to a DTC server 81 | infoblox.nios_modules.nios_dtc_server: 82 | name: a.example.com 83 | host: 192.168.10.1 84 | comment: this is a test comment 85 | state: present 86 | provider: 87 | host: "{{ inventory_hostname_short }}" 88 | username: admin 89 | password: admin 90 | connection: local 91 | 92 | - name: Remove a DTC Server from the system 93 | infoblox.nios_modules.nios_dtc_server: 94 | name: a.example.com 95 | host: 192.168.10.1 96 | state: absent 97 | provider: 98 | host: "{{ inventory_hostname_short }}" 99 | username: admin 100 | password: admin 101 | connection: local 102 | ''' 103 | 104 | RETURN = ''' # ''' 105 | 106 | from ansible.module_utils.basic import AnsibleModule 107 | from ..module_utils.api import WapiModule 108 | from ..module_utils.api import NIOS_DTC_SERVER 109 | from ..module_utils.api import normalize_ib_spec 110 | 111 | 112 | def main(): 113 | ''' Main entry point for module execution 114 | ''' 115 | 116 | ib_spec = dict( 117 | name=dict(required=True, ib_req=True), 118 | host=dict(required=True, ib_req=True), 119 | 120 | disable=dict(type='bool', default=False), 121 | extattrs=dict(type='dict'), 122 | comment=dict(), 123 | ) 124 | 125 | argument_spec = dict( 126 | provider=dict(required=True), 127 | state=dict(default='present', choices=['present', 'absent']) 128 | ) 129 | 130 | argument_spec.update(normalize_ib_spec(ib_spec)) 131 | argument_spec.update(WapiModule.provider_spec) 132 | 133 | module = AnsibleModule(argument_spec=argument_spec, 134 | supports_check_mode=True) 135 | 136 | wapi = WapiModule(module) 137 | result = wapi.run(NIOS_DTC_SERVER, ib_spec) 138 | 139 | module.exit_json(**result) 140 | 141 | 142 | if __name__ == '__main__': 143 | main() 144 | -------------------------------------------------------------------------------- /plugins/modules/nios_network_view.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright (c) 2018-2019 Red Hat, Inc. 3 | # Copyright (c) 2020 Infoblox, Inc. 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | from __future__ import absolute_import, division, print_function 7 | __metaclass__ = type 8 | 9 | DOCUMENTATION = ''' 10 | --- 11 | module: nios_network_view 12 | author: "Peter Sprygada (@privateip)" 13 | short_description: Configure Infoblox NIOS network views 14 | version_added: "1.0.0" 15 | description: 16 | - Adds and/or removes instances of network view objects from 17 | Infoblox NIOS servers. This module manages NIOS C(networkview) objects 18 | using the Infoblox WAPI interface over REST. 19 | - Updates instances of network view object from Infoblox NIOS servers. 20 | requirements: 21 | - infoblox-client 22 | extends_documentation_fragment: infoblox.nios_modules.nios 23 | notes: 24 | - This module supports C(check_mode). 25 | options: 26 | name: 27 | description: 28 | - Specifies the fully qualified hostname to add or remove from 29 | the system. User can also update the hostname as it is possible 30 | to pass a dict containing I(new_name), I(old_name). See examples. 31 | type: str 32 | required: true 33 | aliases: 34 | - network_view 35 | extattrs: 36 | description: 37 | - Allows for the configuration of Extensible Attributes on the 38 | instance of the object. This argument accepts a set of key / value 39 | pairs for configuration. 40 | type: dict 41 | comment: 42 | description: 43 | - Configures a text string comment to be associated with the instance 44 | of this object. The provided text string will be configured on the 45 | object instance. 46 | type: str 47 | state: 48 | description: 49 | - Configures the intended state of the instance of the object on 50 | the NIOS server. When this value is set to C(present), the object 51 | is configured on the device and when this value is set to C(absent) 52 | the value is removed (if necessary) from the device. 53 | type: str 54 | default: present 55 | choices: 56 | - present 57 | - absent 58 | ''' 59 | 60 | EXAMPLES = ''' 61 | - name: Configure a new network view 62 | infoblox.nios_modules.nios_network_view: 63 | name: ansible 64 | state: present 65 | provider: 66 | host: "{{ inventory_hostname_short }}" 67 | username: admin 68 | password: admin 69 | connection: local 70 | 71 | - name: Update the comment for network view 72 | infoblox.nios_modules.nios_network_view: 73 | name: ansible 74 | comment: this is an example comment 75 | state: present 76 | provider: 77 | host: "{{ inventory_hostname_short }}" 78 | username: admin 79 | password: admin 80 | connection: local 81 | 82 | - name: Remove the network view 83 | infoblox.nios_modules.nios_network_view: 84 | name: ansible 85 | state: absent 86 | provider: 87 | host: "{{ inventory_hostname_short }}" 88 | username: admin 89 | password: admin 90 | connection: local 91 | 92 | - name: Update an existing network view 93 | infoblox.nios_modules.nios_network_view: 94 | name: {new_name: ansible-new, old_name: ansible} 95 | state: present 96 | provider: 97 | host: "{{ inventory_hostname_short }}" 98 | username: admin 99 | password: admin 100 | connection: local 101 | ''' 102 | 103 | RETURN = ''' # ''' 104 | 105 | from ansible.module_utils.basic import AnsibleModule 106 | from ..module_utils.api import WapiModule 107 | from ..module_utils.api import NIOS_NETWORK_VIEW 108 | from ..module_utils.api import normalize_ib_spec 109 | 110 | 111 | def main(): 112 | ''' Main entry point for module execution 113 | ''' 114 | ib_spec = dict( 115 | name=dict(required=True, aliases=['network_view'], ib_req=True), 116 | extattrs=dict(type='dict'), 117 | comment=dict(), 118 | ) 119 | 120 | argument_spec = dict( 121 | provider=dict(required=True), 122 | state=dict(default='present', choices=['present', 'absent']) 123 | ) 124 | 125 | argument_spec.update(normalize_ib_spec(ib_spec)) 126 | argument_spec.update(WapiModule.provider_spec) 127 | 128 | module = AnsibleModule(argument_spec=argument_spec, 129 | supports_check_mode=True) 130 | 131 | wapi = WapiModule(module) 132 | result = wapi.run(NIOS_NETWORK_VIEW, ib_spec) 133 | 134 | module.exit_json(**result) 135 | 136 | 137 | if __name__ == '__main__': 138 | main() 139 | -------------------------------------------------------------------------------- /plugins/modules/nios_nsgroup_delegation.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright © 2020 Infoblox Inc 3 | # -*- coding: utf-8 -*- 4 | # Copyright (c) 2018-2019 Red Hat, Inc. 5 | # Copyright (c) 2020 Infoblox, Inc. 6 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | from __future__ import absolute_import, division, print_function 9 | __metaclass__ = type 10 | 11 | DOCUMENTATION = ''' 12 | --- 13 | module: nios_nsgroup_delegation 14 | short_description: Configure Infoblox DNS Nameserver Delegation Groups 15 | extends_documentation_fragment: infoblox.nios_modules.nios 16 | author: 17 | - Mauricio Teixeira (@badnetmask) 18 | version_added: "1.7.0" 19 | description: 20 | - Adds and/or removes nameserver groups of type "Delegation" form Infoblox NIOS servers. 21 | This module manages NIOS C(nsgroup:delegation) objects using the Infoblox. WAPI interface over REST. 22 | requirements: 23 | - infoblox_client 24 | options: 25 | name: 26 | description: 27 | - Specifies the name of the NIOS nameserver group to be managed. 28 | required: true 29 | type: str 30 | delegate_to: 31 | description: 32 | - Specifies the list of name servers to be used 33 | required: true 34 | type: list 35 | elements: dict 36 | suboptions: 37 | name: 38 | description: 39 | - Provide the name of the server 40 | required: true 41 | type: str 42 | address: 43 | description: 44 | - Provide the IP address of the server 45 | required: true 46 | type: str 47 | extattrs: 48 | description: 49 | - Allows for the configuration of Extensible Attributes on the 50 | instance of the object. This argument accepts a set of key / value 51 | pairs for configuration. 52 | required: false 53 | type: dict 54 | comment: 55 | description: 56 | - Configures a text string comment to be associated with the instance 57 | of this object. The provided text string will be configured on the 58 | object instance. 59 | required: false 60 | type: str 61 | state: 62 | description: 63 | - Configures the intended state of the instance of the object on 64 | the NIOS server. When this value is set to C(present), the object 65 | is configured on the device and when this value is set to C(absent) 66 | the value is removed (if necessary) from the device. 67 | choices: [present, absent] 68 | default: present 69 | type: str 70 | ''' 71 | 72 | EXAMPLES = ''' 73 | - name: create infoblox nameserver delegation group 74 | infoblox.nios_modules.nios_nsgroup_delegation: 75 | name: my-delegation-group 76 | comment: "this is a delegation nameserver group" 77 | delegate_to: 78 | - name: first 79 | address: 192.168.0.10 80 | - name: second 81 | address: 192.168.0.20 82 | state: present 83 | provider: 84 | host: "{{ inventory_hostname_short }}" 85 | username: admin 86 | password: admin 87 | connection: local 88 | ''' 89 | 90 | RETURN = ''' # ''' 91 | 92 | from ansible.module_utils.basic import AnsibleModule 93 | from ..module_utils.api import WapiModule 94 | from ..module_utils.api import NIOS_NSGROUP_DELEGATION 95 | from ..module_utils.api import normalize_ib_spec 96 | 97 | 98 | def main(): 99 | '''entrypoint for module execution.''' 100 | argument_spec = dict( 101 | provider=dict(required=True), 102 | state=dict(default='present', choices=['present', 'absent']), 103 | ) 104 | 105 | delegate_to_spec = dict( 106 | name=dict(required=True), 107 | address=dict(required=True) 108 | ) 109 | 110 | ib_spec = dict( 111 | name=dict(required=True, ib_req=True), 112 | delegate_to=dict(type='list', elements='dict', required=True, options=delegate_to_spec), 113 | extattrs=dict(type='dict'), 114 | comment=dict(), 115 | ) 116 | 117 | argument_spec.update(normalize_ib_spec(ib_spec)) 118 | argument_spec.update(WapiModule.provider_spec) 119 | 120 | module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) 121 | 122 | wapi = WapiModule(module) 123 | result = wapi.run(NIOS_NSGROUP_DELEGATION, ib_spec) 124 | 125 | module.exit_json(**result) 126 | 127 | 128 | if __name__ == '__main__': 129 | main() 130 | -------------------------------------------------------------------------------- /plugins/modules/nios_nsgroup_forwardstubserver.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright © 2020 Infoblox Inc 3 | # -*- coding: utf-8 -*- 4 | # Copyright (c) 2018-2019 Red Hat, Inc. 5 | # Copyright (c) 2020 Infoblox, Inc. 6 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | from __future__ import absolute_import, division, print_function 9 | __metaclass__ = type 10 | 11 | DOCUMENTATION = ''' 12 | --- 13 | module: nios_nsgroup_forwardstubserver 14 | short_description: Configure Infoblox DNS Nameserver Forward/Stub Server Groups 15 | extends_documentation_fragment: infoblox.nios_modules.nios 16 | author: 17 | - Mauricio Teixeira (@badnetmask) 18 | version_added: "1.7.0" 19 | description: 20 | - Adds and/or removes nameserver groups of type "Forward/Stub Server" form Infoblox NIOS servers. 21 | This module manages NIOS C(nsgroup:forwardstubserver) objects using the Infoblox. WAPI interface over REST. 22 | requirements: 23 | - infoblox_client 24 | options: 25 | name: 26 | description: 27 | - Specifies the name of the NIOS nameserver group to be managed. 28 | required: true 29 | type: str 30 | external_servers: 31 | description: 32 | - Specifies the list of name servers to be used 33 | required: true 34 | type: list 35 | elements: dict 36 | suboptions: 37 | name: 38 | description: 39 | - Provide the name of the server 40 | required: true 41 | type: str 42 | address: 43 | description: 44 | - Provide the IP address of the server 45 | required: true 46 | type: str 47 | extattrs: 48 | description: 49 | - Allows for the configuration of Extensible Attributes on the 50 | instance of the object. This argument accepts a set of key / value 51 | pairs for configuration. 52 | required: false 53 | type: dict 54 | comment: 55 | description: 56 | - Configures a text string comment to be associated with the instance 57 | of this object. The provided text string will be configured on the 58 | object instance. 59 | required: false 60 | type: str 61 | state: 62 | description: 63 | - Configures the intended state of the instance of the object on 64 | the NIOS server. When this value is set to C(present), the object 65 | is configured on the device and when this value is set to C(absent) 66 | the value is removed (if necessary) from the device. 67 | choices: [present, absent] 68 | default: present 69 | type: str 70 | ''' 71 | 72 | EXAMPLES = ''' 73 | - name: create infoblox nameserver forward/stub group 74 | infoblox.nios_modules.nios_nsgroup_forwardstubserver: 75 | name: my-forwardstub-group 76 | comment: "this is a forward/stub nameserver group" 77 | external_servers: 78 | - name: first 79 | address: 192.168.0.10 80 | - name: second 81 | address: 192.168.0.20 82 | state: present 83 | provider: 84 | host: "{{ inventory_hostname_short }}" 85 | username: admin 86 | password: admin 87 | connection: local 88 | ''' 89 | 90 | RETURN = ''' # ''' 91 | 92 | from ansible.module_utils.basic import AnsibleModule 93 | from ..module_utils.api import WapiModule 94 | from ..module_utils.api import NIOS_NSGROUP_FORWARDSTUBSERVER 95 | from ..module_utils.api import normalize_ib_spec 96 | 97 | 98 | def main(): 99 | '''entrypoint for module execution.''' 100 | argument_spec = dict( 101 | provider=dict(required=True), 102 | state=dict(default='present', choices=['present', 'absent']), 103 | ) 104 | 105 | external_servers_spec = dict( 106 | name=dict(required=True), 107 | address=dict(required=True) 108 | ) 109 | 110 | ib_spec = dict( 111 | name=dict(required=True, ib_req=True), 112 | external_servers=dict(type='list', elements='dict', required=True, options=external_servers_spec), 113 | extattrs=dict(type='dict'), 114 | comment=dict(), 115 | ) 116 | 117 | argument_spec.update(normalize_ib_spec(ib_spec)) 118 | argument_spec.update(WapiModule.provider_spec) 119 | 120 | module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) 121 | 122 | wapi = WapiModule(module) 123 | result = wapi.run(NIOS_NSGROUP_FORWARDSTUBSERVER, ib_spec) 124 | 125 | module.exit_json(**result) 126 | 127 | 128 | if __name__ == '__main__': 129 | main() 130 | -------------------------------------------------------------------------------- /plugins/modules/nios_nsgroup_stubmember.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright © 2020 Infoblox Inc 3 | # -*- coding: utf-8 -*- 4 | # Copyright (c) 2018-2019 Red Hat, Inc. 5 | # Copyright (c) 2020 Infoblox, Inc. 6 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | from __future__ import absolute_import, division, print_function 9 | __metaclass__ = type 10 | 11 | DOCUMENTATION = ''' 12 | --- 13 | module: nios_nsgroup_stubmember 14 | short_description: Configure Infoblox DNS Nameserver Stub Member Groups 15 | extends_documentation_fragment: infoblox.nios_modules.nios 16 | author: 17 | - Mauricio Teixeira (@badnetmask) 18 | version_added: "1.7.0" 19 | description: 20 | - Adds and/or removes nameserver groups of type "Stub Member" form Infoblox NIOS servers. 21 | This module manages NIOS C(nsgroup:stubmember) objects using the Infoblox. WAPI interface over REST. 22 | requirements: 23 | - infoblox_client 24 | options: 25 | name: 26 | description: 27 | - Specifies the name of the NIOS nameserver group to be managed. 28 | required: true 29 | type: str 30 | stub_members: 31 | description: 32 | - Specifies the list of members to be used 33 | required: true 34 | type: list 35 | elements: dict 36 | suboptions: 37 | name: 38 | description: 39 | - Provide the name of the member 40 | required: true 41 | type: str 42 | extattrs: 43 | description: 44 | - Allows for the configuration of Extensible Attributes on the 45 | instance of the object. This argument accepts a set of key / value 46 | pairs for configuration. 47 | required: false 48 | type: dict 49 | comment: 50 | description: 51 | - Configures a text string comment to be associated with the instance 52 | of this object. The provided text string will be configured on the 53 | object instance. 54 | required: false 55 | type: str 56 | state: 57 | description: 58 | - Configures the intended state of the instance of the object on 59 | the NIOS server. When this value is set to C(present), the object 60 | is configured on the device and when this value is set to C(absent) 61 | the value is removed (if necessary) from the device. 62 | choices: [present, absent] 63 | default: present 64 | type: str 65 | ''' 66 | 67 | EXAMPLES = ''' 68 | - name: create infoblox nameserver stub member group 69 | infoblox.nios_modules.nios_nsgroup_stubmember: 70 | name: my-stubmember-group 71 | comment: "this is a stub member nameserver group" 72 | stub_members: 73 | - name: member.localdomain 74 | state: present 75 | provider: 76 | host: "{{ inventory_hostname_short }}" 77 | username: admin 78 | password: admin 79 | connection: local 80 | ''' 81 | 82 | RETURN = ''' # ''' 83 | 84 | from ansible.module_utils.basic import AnsibleModule 85 | from ..module_utils.api import WapiModule 86 | from ..module_utils.api import NIOS_NSGROUP_STUBMEMBER 87 | from ..module_utils.api import normalize_ib_spec 88 | 89 | 90 | def main(): 91 | '''entrypoint for module execution.''' 92 | argument_spec = dict( 93 | provider=dict(required=True), 94 | state=dict(default='present', choices=['present', 'absent']), 95 | ) 96 | 97 | stub_members_spec = dict( 98 | name=dict(required=True), 99 | ) 100 | 101 | ib_spec = dict( 102 | name=dict(required=True, ib_req=True), 103 | stub_members=dict(type='list', elements='dict', required=True, options=stub_members_spec), 104 | extattrs=dict(type='dict'), 105 | comment=dict(), 106 | ) 107 | 108 | argument_spec.update(normalize_ib_spec(ib_spec)) 109 | argument_spec.update(WapiModule.provider_spec) 110 | 111 | module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) 112 | 113 | wapi = WapiModule(module) 114 | result = wapi.run(NIOS_NSGROUP_STUBMEMBER, ib_spec) 115 | 116 | module.exit_json(**result) 117 | 118 | 119 | if __name__ == '__main__': 120 | main() 121 | -------------------------------------------------------------------------------- /plugins/modules/nios_restartservices.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright (c) 2018-2019 Red Hat, Inc. 3 | # Copyright (c) 2020 Infoblox, Inc. 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | from __future__ import absolute_import, division, print_function 7 | __metaclass__ = type 8 | 9 | DOCUMENTATION = ''' 10 | --- 11 | module: nios_restartservices 12 | author: "Mauricio Teixeira (@badnetmask)" 13 | short_description: Restart grid services. 14 | version_added: "1.1.0" 15 | description: 16 | - Restart grid services. 17 | - When invoked without any options, will restart ALL services on the 18 | default restart group IF NEEDED. 19 | requirements: 20 | - infoblox-client 21 | extends_documentation_fragment: infoblox.nios_modules.nios 22 | notes: 23 | - This module supports C(check_mode). 24 | options: 25 | groups: 26 | description: 27 | - The list of the Service Restart Groups to restart. 28 | required: false 29 | type: list 30 | elements: str 31 | members: 32 | description: 33 | - The list of the Grid Members to restart. 34 | required: false 35 | type: list 36 | elements: str 37 | mode: 38 | description: 39 | - The restart method in case of grid restart. 40 | required: false 41 | type: str 42 | choices: 43 | - GROUPED 44 | - SEQUENTIAL 45 | - SIMULTANEOUS 46 | restart_option: 47 | description: 48 | - Controls whether services are restarted unconditionally or when needed 49 | required: false 50 | type: str 51 | default: RESTART_IF_NEEDED 52 | choices: 53 | - RESTART_IF_NEEDED 54 | - FORCE_RESTART 55 | services: 56 | description: 57 | - The list of services the restart applicable to. 58 | required: false 59 | type: list 60 | elements: str 61 | default: ALL 62 | choices: 63 | - ALL 64 | - DNS 65 | - DHCP 66 | - DHCPV4 67 | - DHCPV6 68 | ''' 69 | 70 | EXAMPLES = ''' 71 | - name: Restart all grid services if needed. 72 | infoblox.nios_modules.nios_restartservices: 73 | provider: 74 | host: "{{ inventory_hostname_short }}" 75 | username: admin 76 | password: admin 77 | connection: local 78 | 79 | - name: Restart DNS service if needed. 80 | infoblox.nios_modules.nios_restartservices: 81 | services: 82 | - DNS 83 | provider: 84 | host: "{{ inventory_hostname_short }}" 85 | username: admin 86 | password: admin 87 | connection: local 88 | ''' 89 | 90 | RETURN = ''' # ''' 91 | 92 | from ansible.module_utils.basic import AnsibleModule 93 | from ..module_utils.api import WapiModule 94 | from ..module_utils.api import normalize_ib_spec 95 | 96 | 97 | def main(): 98 | ''' Main entry point for module execution 99 | ''' 100 | 101 | ib_spec = dict( 102 | groups=dict(type='list', elements='str'), 103 | members=dict(type='list', elements='str'), 104 | mode=dict(type='str', choices=['GROUPED', 'SEQUENTIAL', 105 | 'SIMULTANEOUS']), 106 | restart_option=dict(type='str', default='RESTART_IF_NEEDED', 107 | choices=['RESTART_IF_NEEDED', 'FORCE_RESTART']), 108 | services=dict(type='list', elements='str', default=['ALL'], 109 | choices=['ALL', 'DNS', 'DHCP', 'DHCPV4', 'DHCPV6']) 110 | ) 111 | 112 | argument_spec = dict( 113 | provider=dict(required=True) 114 | ) 115 | 116 | argument_spec.update(normalize_ib_spec(ib_spec)) 117 | argument_spec.update(WapiModule.provider_spec) 118 | 119 | module = AnsibleModule(argument_spec=argument_spec, 120 | supports_check_mode=True) 121 | 122 | wapi = WapiModule(module) 123 | 124 | # restart is a grid function, so we need to properly format 125 | # the arguments before sending the command 126 | restart_params = module.params 127 | del restart_params['provider'] 128 | if restart_params['groups'] is None: 129 | del restart_params['groups'] 130 | if restart_params['members'] is None: 131 | del restart_params['members'] 132 | if restart_params['mode'] is None: 133 | del restart_params['mode'] 134 | grid_obj = wapi.get_object('grid') 135 | if grid_obj is None: 136 | module.fail_json(msg='Failed to get NIOS grid information.') 137 | result = wapi.call_func('restartservices', grid_obj[0]['_ref'], restart_params) 138 | 139 | module.exit_json(**result) 140 | 141 | 142 | if __name__ == '__main__': 143 | main() 144 | -------------------------------------------------------------------------------- /plugins/modules/nios_txt_record.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # Copyright (c) 2018-2019 Red Hat, Inc. 3 | # Copyright (c) 2020 Infoblox, Inc. 4 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | from __future__ import absolute_import, division, print_function 7 | __metaclass__ = type 8 | 9 | DOCUMENTATION = ''' 10 | --- 11 | module: nios_txt_record 12 | author: "Corey Wanless (@coreywan)" 13 | short_description: Configure Infoblox NIOS txt records 14 | version_added: "1.0.0" 15 | description: 16 | - Adds and/or removes instances of txt record objects from 17 | Infoblox NIOS servers. This module manages NIOS C(record:txt) objects 18 | using the Infoblox WAPI interface over REST. 19 | requirements: 20 | - infoblox_client 21 | extends_documentation_fragment: infoblox.nios_modules.nios 22 | notes: 23 | - This module supports C(check_mode). 24 | options: 25 | name: 26 | description: 27 | - Specifies the fully qualified hostname to add or remove from 28 | the system. Users can also update the name as it is possible 29 | to pass a dict containing I(new_name), I(old_name). See examples. 30 | required: true 31 | type: str 32 | view: 33 | description: 34 | - Sets the DNS view to associate this tst record with. The DNS 35 | view must already be configured on the system. 36 | default: default 37 | aliases: 38 | - dns_view 39 | type: str 40 | text: 41 | description: 42 | - Text associated with the record. It can contain up to 255 bytes 43 | per substring, up to a total of 512 bytes. To enter leading, 44 | trailing, or embedded spaces in the text, add quotes around the 45 | text to preserve the spaces. 46 | required: true 47 | type: str 48 | ttl: 49 | description: 50 | - Configures the TTL to be associated with this txt record. 51 | type: int 52 | extattrs: 53 | description: 54 | - Allows for the configuration of Extensible Attributes on the 55 | instance of the object. This argument accepts a set of key / value 56 | pairs for configuration. 57 | type: dict 58 | comment: 59 | description: 60 | - Configures a text string comment to be associated with the instance 61 | of this object. The provided text string will be configured on the 62 | object instance. 63 | type: str 64 | state: 65 | description: 66 | - Configures the intended state of the instance of the object on 67 | the NIOS server. When this value is set to C(present), the object 68 | is configured on the device and when this value is set to C(absent) 69 | the value is removed (if necessary) from the device. 70 | default: present 71 | choices: 72 | - present 73 | - absent 74 | type: str 75 | ''' 76 | 77 | EXAMPLES = ''' 78 | - name: Ensure a text Record Exists 79 | infoblox.nios_modules.nios_txt_record: 80 | name: fqdn.txt.record.com 81 | text: mytext 82 | state: present 83 | view: External 84 | provider: 85 | host: "{{ inventory_hostname_short }}" 86 | username: admin 87 | password: admin 88 | 89 | - name: Update name of TXT record 90 | infoblox.nios_modules.nios_txt_record: 91 | name: {old_name: sample.txtrecord.com, new_name: newsample.txtrecord.com} 92 | text: mytext 93 | state: present 94 | view: External 95 | provider: 96 | host: "{{ inventory_hostname_short }}" 97 | username: admin 98 | password: admin 99 | connection: local 100 | 101 | - name: Ensure a text Record does not exist 102 | infoblox.nios_modules.nios_txt_record: 103 | name: fqdn.txt.record.com 104 | text: mytext 105 | state: absent 106 | view: External 107 | provider: 108 | host: "{{ inventory_hostname_short }}" 109 | username: admin 110 | password: admin 111 | ''' 112 | 113 | RETURN = ''' # ''' 114 | 115 | from ansible.module_utils.basic import AnsibleModule 116 | from ..module_utils.api import WapiModule 117 | from ..module_utils.api import normalize_ib_spec 118 | 119 | 120 | def main(): 121 | ''' Main entry point for module execution 122 | ''' 123 | 124 | ib_spec = dict( 125 | name=dict(required=True, ib_req=True), 126 | view=dict(default='default', aliases=['dns_view'], ib_req=True), 127 | text=dict(required=True, type='str', ib_req=True), 128 | ttl=dict(type='int'), 129 | extattrs=dict(type='dict'), 130 | comment=dict(), 131 | ) 132 | 133 | argument_spec = dict( 134 | provider=dict(required=True), 135 | state=dict(default='present', choices=['present', 'absent']) 136 | ) 137 | 138 | argument_spec.update(normalize_ib_spec(ib_spec)) 139 | argument_spec.update(WapiModule.provider_spec) 140 | 141 | module = AnsibleModule(argument_spec=argument_spec, 142 | supports_check_mode=True) 143 | 144 | wapi = WapiModule(module) 145 | result = wapi.run('record:txt', ib_spec) 146 | 147 | module.exit_json(**result) 148 | 149 | 150 | if __name__ == '__main__': 151 | main() 152 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | infoblox-client==0.6.2 -------------------------------------------------------------------------------- /tests/integration/targets/nios_a_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_a_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_a_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_a_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include A record idempotence tests 3 | ansible.builtin.include_tasks: nios_a_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_a_record/tasks/nios_a_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup a_record 15 | infoblox.nios_modules.nios_a_record: 16 | name: a.ansible.com 17 | ipv4: 192.168.10.1 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | 21 | - name: Create an a_record 22 | infoblox.nios_modules.nios_a_record: 23 | name: a.ansible.com 24 | ipv4: 192.168.10.1 25 | state: present 26 | provider: "{{ nios_provider }}" 27 | register: a_record_create1 28 | 29 | - name: Recreate an a_record 30 | infoblox.nios_modules.nios_a_record: 31 | name: a.ansible.com 32 | ipv4: 192.168.10.1 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | register: a_record_create2 36 | 37 | - name: Add a comment to an existing a_record 38 | infoblox.nios_modules.nios_a_record: 39 | name: a.ansible.com 40 | ipv4: 192.168.10.1 41 | comment: this is a test comment 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: a_record_update1 45 | 46 | - name: Add a comment to an existing a_record 47 | infoblox.nios_modules.nios_a_record: 48 | name: a.ansible.com 49 | ipv4: 192.168.10.1 50 | comment: this is a test comment 51 | state: present 52 | provider: "{{ nios_provider }}" 53 | register: a_record_update2 54 | 55 | - name: Remove a a_record from the system 56 | infoblox.nios_modules.nios_a_record: 57 | name: a.ansible.com 58 | ipv4: 192.168.10.1 59 | state: absent 60 | provider: "{{ nios_provider }}" 61 | register: a_record_delete1 62 | 63 | - name: Remove a a_record from the system 64 | infoblox.nios_modules.nios_a_record: 65 | name: a.ansible.com 66 | ipv4: 192.168.10.1 67 | state: absent 68 | provider: "{{ nios_provider }}" 69 | register: a_record_delete2 70 | 71 | - name: Verify idempotence and changes of A record operations 72 | ansible.builtin.assert: 73 | that: 74 | - a_record_create1.changed 75 | - not a_record_create2.changed 76 | - a_record_update1.changed 77 | - not a_record_update2.changed 78 | - a_record_delete1.changed 79 | - not a_record_delete2.changed 80 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_aaaa_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_aaaa_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_aaaa_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_aaaa_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include AAAA record idempotence tests 3 | ansible.builtin.include_tasks: nios_aaaa_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_aaaa_record/tasks/nios_aaaa_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup aaaa record 15 | infoblox.nios_modules.nios_aaaa_record: 16 | name: aaaa.ansible.com 17 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | 21 | - name: Create an aaaa record 22 | infoblox.nios_modules.nios_aaaa_record: 23 | name: aaaa.ansible.com 24 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 25 | state: present 26 | provider: "{{ nios_provider }}" 27 | register: aaaa_record_create1 28 | 29 | - name: Recreate an aaaa record 30 | infoblox.nios_modules.nios_aaaa_record: 31 | name: aaaa.ansible.com 32 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | register: aaaa_record_create2 36 | 37 | - name: Add a comment to an existing aaaa record 38 | infoblox.nios_modules.nios_aaaa_record: 39 | name: aaaa.ansible.com 40 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 41 | comment: this is a test comment 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: aaaa_record_update1 45 | 46 | - name: Add a comment to an existing aaaa record 47 | infoblox.nios_modules.nios_aaaa_record: 48 | name: aaaa.ansible.com 49 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 50 | comment: this is a test comment 51 | state: present 52 | provider: "{{ nios_provider }}" 53 | register: aaaa_record_update2 54 | 55 | - name: Remove a aaaa record from the system 56 | infoblox.nios_modules.nios_aaaa_record: 57 | name: aaaa.ansible.com 58 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 59 | state: absent 60 | provider: "{{ nios_provider }}" 61 | register: aaaa_record_delete1 62 | 63 | - name: Remove a aaaa record from the system 64 | infoblox.nios_modules.nios_aaaa_record: 65 | name: aaaa.ansible.com 66 | ipv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 67 | state: absent 68 | provider: "{{ nios_provider }}" 69 | register: aaaa_record_delete2 70 | 71 | - name: Verify idempotence and changes of AAAA record operations 72 | ansible.builtin.assert: 73 | that: 74 | - aaaa_record_create1.changed 75 | - not aaaa_record_create2.changed 76 | - aaaa_record_update1.changed 77 | - not aaaa_record_update2.changed 78 | - aaaa_record_delete1.changed 79 | - not aaaa_record_delete2.changed 80 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_adminuser/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_adminuser/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_adminuser/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_adminuser/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include idempotence tasks for adminuser 3 | ansible.builtin.include_tasks: nios_adminuser_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_adminuser/tasks/nios_adminuser_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup adminuser 3 | infoblox.nios_modules.nios_adminuser: 4 | name: ansible-adminuser 5 | admin_groups: admin-group 6 | state: absent 7 | provider: "{{ nios_provider }}" 8 | 9 | - name: Configure a adminuser on the system 10 | infoblox.nios_modules.nios_adminuser: 11 | name: ansible-adminuser 12 | admin_groups: admin-group 13 | password: Pwd@1234 14 | state: present 15 | provider: "{{ nios_provider }}" 16 | register: adminuser_create1 17 | 18 | - name: Configure another adminuser on the system 19 | infoblox.nios_modules.nios_adminuser: 20 | name: ansible-adminuser 21 | admin_groups: admin-group 22 | state: present 23 | provider: "{{ nios_provider }}" 24 | register: adminuser_create2 25 | 26 | - name: Update the comment and ext attributes for an existing adminuser 27 | infoblox.nios_modules.nios_adminuser: 28 | name: ansible-adminuser 29 | admin_groups: admin-group 30 | comment: this is an example comment 31 | extattrs: 32 | Site: west-dc 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | register: adminuser_update1 36 | 37 | - name: Update again the comment and ext attributes for an existing adminuser 38 | infoblox.nios_modules.nios_adminuser: 39 | name: ansible-adminuser 40 | admin_groups: admin-group 41 | comment: this is an example comment 42 | extattrs: 43 | Site: west-dc 44 | state: present 45 | provider: "{{ nios_provider }}" 46 | register: adminuser_update2 47 | 48 | - name: Remove the adminuser 49 | infoblox.nios_modules.nios_adminuser: 50 | name: ansible-adminuser 51 | admin_groups: admin-group 52 | state: absent 53 | provider: "{{ nios_provider }}" 54 | register: adminuser_delete1 55 | 56 | - name: Remove again the adminuser 57 | infoblox.nios_modules.nios_adminuser: 58 | name: ansible-adminuser 59 | admin_groups: admin-group 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | register: adminuser_delete2 63 | 64 | - name: Create a new adminuser with all attributes 65 | infoblox.nios_modules.nios_adminuser: 66 | name: ansible-adminuser 67 | admin_groups: admin-group 68 | comment: "Created by Ansible" 69 | auth_method: KEYPAIR_PASSWORD 70 | auth_type: LOCAL 71 | use_ssh_keys: true 72 | ssh_keys: 73 | - key_name: "ansiblekey" 74 | key_type: "RSA" 75 | key_value: "ssh-rsa AAAA..." 76 | password: "Pwd@1234" 77 | ca_certificate_issuer: 'CN=\"infoblox-ca\"' 78 | client_certificate_serial_number: "397F9435000100000031" 79 | disable: false 80 | email: "example@email.com" 81 | enable_certificate_authentication: true 82 | time_zone: "UTC" 83 | use_time_zone: true 84 | extattrs: 85 | Site: "USA" 86 | state: present 87 | provider: "{{ nios_provider }}" 88 | register: adminuser_create3 89 | 90 | - name: Rerun adminuser with all attributes 91 | infoblox.nios_modules.nios_adminuser: 92 | name: ansible-adminuser 93 | admin_groups: admin-group 94 | comment: "Created by Ansible" 95 | auth_method: KEYPAIR_PASSWORD 96 | auth_type: LOCAL 97 | use_ssh_keys: true 98 | ssh_keys: 99 | - key_name: "ansiblekey" 100 | key_type: "RSA" 101 | key_value: "ssh-rsa AAAA..." 102 | ca_certificate_issuer: 'CN=\"infoblox-ca\"' 103 | client_certificate_serial_number: "397F9435000100000031" 104 | disable: false 105 | email: "example@email.com" 106 | enable_certificate_authentication: true 107 | time_zone: "UTC" 108 | use_time_zone: true 109 | extattrs: 110 | Site: "USA" 111 | state: present 112 | provider: "{{ nios_provider }}" 113 | register: adminuser_create4 114 | 115 | - name: Delete adminuser 116 | infoblox.nios_modules.nios_adminuser: 117 | name: ansible-adminuser 118 | admin_groups: admin-group 119 | comment: "Created by Ansible" 120 | auth_method: KEYPAIR_PASSWORD 121 | auth_type: LOCAL 122 | use_ssh_keys: true 123 | ssh_keys: 124 | - key_name: "ansiblekey" 125 | key_type: "RSA" 126 | key_value: "ssh-rsa AAAA..." 127 | ca_certificate_issuer: 'CN=\"infoblox-ca\"' 128 | client_certificate_serial_number: "397F9435000100000031" 129 | disable: false 130 | email: "example@email.com" 131 | enable_certificate_authentication: true 132 | time_zone: "UTC" 133 | use_time_zone: true 134 | extattrs: 135 | Site: "USA" 136 | state: absent 137 | provider: "{{ nios_provider }}" 138 | register: adminuser_delete3 139 | 140 | - name: Assert changes in adminuser 141 | ansible.builtin.assert: 142 | that: 143 | - adminuser_create1.changed 144 | - not adminuser_create2.changed 145 | - adminuser_update1.changed 146 | - not adminuser_update2.changed 147 | - adminuser_delete1.changed 148 | - not adminuser_delete2.changed 149 | - adminuser_create3.changed 150 | - not adminuser_create4.changed 151 | - adminuser_delete3.changed 152 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_cname_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_cname_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_cname_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_cname_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include CNAME record idempotence tests 3 | ansible.builtin.include_tasks: nios_cname_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_cname_record/tasks/nios_cname_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup cname record 15 | infoblox.nios_modules.nios_cname_record: 16 | name: cname.ansible.com 17 | canonical: realhost.ansible.com 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | 21 | - name: Create an cname record 22 | infoblox.nios_modules.nios_cname_record: 23 | name: cname.ansible.com 24 | canonical: realhost.ansible.com 25 | state: present 26 | provider: "{{ nios_provider }}" 27 | register: cname_record_create1 28 | 29 | - name: Recreate an cname record 30 | infoblox.nios_modules.nios_cname_record: 31 | name: cname.ansible.com 32 | canonical: realhost.ansible.com 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | register: cname_record_create2 36 | 37 | - name: Add a comment to an existing cname record 38 | infoblox.nios_modules.nios_cname_record: 39 | name: cname.ansible.com 40 | canonical: realhost.ansible.com 41 | comment: this is a test comment 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: cname_record_update1 45 | 46 | - name: Add a comment to an existing cname record 47 | infoblox.nios_modules.nios_cname_record: 48 | name: cname.ansible.com 49 | canonical: realhost.ansible.com 50 | comment: this is a test comment 51 | state: present 52 | provider: "{{ nios_provider }}" 53 | register: cname_record_update2 54 | 55 | - name: Remove a cname record from the system 56 | infoblox.nios_modules.nios_cname_record: 57 | name: cname.ansible.com 58 | canonical: realhost.ansible.com 59 | state: absent 60 | provider: "{{ nios_provider }}" 61 | register: cname_record_delete1 62 | 63 | - name: Remove a cname record from the system 64 | infoblox.nios_modules.nios_cname_record: 65 | name: cname.ansible.com 66 | canonical: realhost.ansible.com 67 | state: absent 68 | provider: "{{ nios_provider }}" 69 | register: cname_record_delete2 70 | 71 | - name: Verify idempotence and changes of CNAME record operations 72 | ansible.builtin.assert: 73 | that: 74 | - cname_record_create1.changed 75 | - not cname_record_create2.changed 76 | - cname_record_update1.changed 77 | - not cname_record_update2.changed 78 | - cname_record_delete1.changed 79 | - not cname_record_delete2.changed 80 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dns_view/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dns_view/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dns_view/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dns_view/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include the tasks for the nios_dns_view_idempotence 3 | ansible.builtin.include_tasks: nios_dns_view_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dns_view/tasks/nios_dns_view_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Delete dns view instance 3 | infoblox.nios_modules.nios_dns_view: 4 | name: ansible-dns 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Configure a new dns view instance 9 | infoblox.nios_modules.nios_dns_view: 10 | name: ansible-dns 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | register: nios_dns_create1 14 | 15 | - name: Configure a new dns view instance 16 | infoblox.nios_modules.nios_dns_view: 17 | name: ansible-dns 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | register: nios_dns_create2 21 | 22 | - name: Update the comment for dns view 23 | infoblox.nios_modules.nios_dns_view: 24 | name: ansible-dns 25 | comment: this is an example comment 26 | state: present 27 | provider: "{{ nios_provider }}" 28 | register: nios_dns_update1 29 | 30 | - name: Update the comment for dns view 31 | infoblox.nios_modules.nios_dns_view: 32 | name: ansible-dns 33 | comment: this is an example comment 34 | state: present 35 | provider: "{{ nios_provider }}" 36 | register: nios_dns_update2 37 | 38 | - name: Delete dns view instance 39 | infoblox.nios_modules.nios_dns_view: 40 | name: ansible-dns 41 | state: absent 42 | provider: "{{ nios_provider }}" 43 | register: nios_dns_delete1 44 | 45 | - name: Delete dns view instance 46 | infoblox.nios_modules.nios_dns_view: 47 | name: ansible-dns 48 | state: absent 49 | provider: "{{ nios_provider }}" 50 | register: nios_dns_delete2 51 | 52 | - name: Verify idempotence and changes of DNS view operations 53 | ansible.builtin.assert: 54 | that: 55 | - nios_dns_create1.changed 56 | - not nios_dns_create2.changed 57 | - nios_dns_update1.changed 58 | - not nios_dns_update2.changed 59 | - nios_dns_delete1.changed 60 | - not nios_dns_delete2.changed 61 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_http/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_http/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_http/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_http/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include the test for the nios_dtc_monitor_http_idempotence 3 | ansible.builtin.include_tasks: nios_dtc_monitor_http_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_http/tasks/nios_dtc_monitor_http_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC HTTPS monitor 15 | infoblox.nios_modules.nios_dtc_monitor_http: 16 | name: https_monitor 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | 20 | - name: Create a DTC HTTPS monitor 21 | infoblox.nios_modules.nios_dtc_monitor_http: 22 | name: https_monitor 23 | port: 443 24 | secure: true 25 | state: present 26 | provider: "{{ nios_provider }}" 27 | register: dtc_monitor_http_create1 28 | 29 | - name: Recreate a DTC HTTPS monitor 30 | infoblox.nios_modules.nios_dtc_monitor_http: 31 | name: https_monitor 32 | port: 443 33 | secure: true 34 | state: present 35 | provider: "{{ nios_provider }}" 36 | register: dtc_monitor_http_create2 37 | 38 | - name: Add a comment to an existing DTC HTTPS monitor 39 | infoblox.nios_modules.nios_dtc_monitor_http: 40 | name: https_monitor 41 | comment: this is a test comment 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: dtc_monitor_http_update1 45 | 46 | - name: Readd a comment to an existing DTC HTTPS monitor 47 | infoblox.nios_modules.nios_dtc_monitor_http: 48 | name: https_monitor 49 | comment: this is a test comment 50 | state: present 51 | provider: "{{ nios_provider }}" 52 | register: dtc_monitor_http_update2 53 | 54 | - name: Remove a DTC HTTPS monitor from the system 55 | infoblox.nios_modules.nios_dtc_monitor_http: 56 | name: https_monitor 57 | state: absent 58 | provider: "{{ nios_provider }}" 59 | register: dtc_monitor_http_delete1 60 | 61 | - name: Reremove a DTC HTTPS monitor from the system 62 | infoblox.nios_modules.nios_dtc_monitor_http: 63 | name: https_monitor 64 | state: absent 65 | provider: "{{ nios_provider }}" 66 | register: dtc_monitor_http_delete2 67 | 68 | - name: Verify outcomes 69 | ansible.builtin.assert: 70 | that: 71 | - dtc_monitor_http_create1.changed 72 | - not dtc_monitor_http_create2.changed 73 | - dtc_monitor_http_update1.changed 74 | - not dtc_monitor_http_update2.changed 75 | - dtc_monitor_http_delete1.changed 76 | - not dtc_monitor_http_delete2.changed 77 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_icmp/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_icmp/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_icmp/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_icmp/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include the tasks for the nios_dtc_monitor_icmp_idempotence 3 | ansible.builtin.include_tasks: nios_dtc_monitor_icmp_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_icmp/tasks/nios_dtc_monitor_icmp_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC ICMP monitor 15 | infoblox.nios_modules.nios_dtc_monitor_icmp: 16 | name: icmp_monitor 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | 20 | - name: Create a DTC ICMP monitor 21 | infoblox.nios_modules.nios_dtc_monitor_icmp: 22 | name: icmp_monitor 23 | state: present 24 | provider: "{{ nios_provider }}" 25 | register: dtc_monitor_icmp_create1 26 | 27 | - name: Recreate a DTC ICMP monitor 28 | infoblox.nios_modules.nios_dtc_monitor_icmp: 29 | name: icmp_monitor 30 | state: present 31 | provider: "{{ nios_provider }}" 32 | register: dtc_monitor_icmp_create2 33 | 34 | - name: Add a comment to an existing DTC ICMP monitor 35 | infoblox.nios_modules.nios_dtc_monitor_icmp: 36 | name: icmp_monitor 37 | comment: this is a test comment 38 | state: present 39 | provider: "{{ nios_provider }}" 40 | register: dtc_monitor_icmp_update1 41 | 42 | - name: Readd a comment to an existing DTC ICMP monitor 43 | infoblox.nios_modules.nios_dtc_monitor_icmp: 44 | name: icmp_monitor 45 | comment: this is a test comment 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | register: dtc_monitor_icmp_update2 49 | 50 | - name: Remove a DTC ICMP monitor from the system 51 | infoblox.nios_modules.nios_dtc_monitor_icmp: 52 | name: icmp_monitor 53 | state: absent 54 | provider: "{{ nios_provider }}" 55 | register: dtc_monitor_icmp_delete1 56 | 57 | - name: Reremove a DTC ICMP monitor from the system 58 | infoblox.nios_modules.nios_dtc_monitor_icmp: 59 | name: icmp_monitor 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | register: dtc_monitor_icmp_delete2 63 | 64 | - name: Verify outcomes 65 | ansible.builtin.assert: 66 | that: 67 | - dtc_monitor_icmp_create1.changed 68 | - not dtc_monitor_icmp_create2.changed 69 | - dtc_monitor_icmp_update1.changed 70 | - not dtc_monitor_icmp_update2.changed 71 | - dtc_monitor_icmp_delete1.changed 72 | - not dtc_monitor_icmp_delete2.changed 73 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_pdp/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_pdp/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_pdp/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_pdp/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include the tasks from the idempotence test 3 | ansible.builtin.include_tasks: nios_dtc_monitor_pdp_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_pdp/tasks/nios_dtc_monitor_pdp_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC PDP monitor 15 | infoblox.nios_modules.nios_dtc_monitor_pdp: 16 | name: pdp_monitor 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | 20 | - name: Create a DTC PDP monitor 21 | infoblox.nios_modules.nios_dtc_monitor_pdp: 22 | name: pdp_monitor 23 | state: present 24 | provider: "{{ nios_provider }}" 25 | register: dtc_monitor_pdp_create1 26 | 27 | - name: Recreate a DTC PDP monitor 28 | infoblox.nios_modules.nios_dtc_monitor_pdp: 29 | name: pdp_monitor 30 | state: present 31 | provider: "{{ nios_provider }}" 32 | register: dtc_monitor_pdp_create2 33 | 34 | - name: Add a comment to an existing DTC PDP monitor 35 | infoblox.nios_modules.nios_dtc_monitor_pdp: 36 | name: pdp_monitor 37 | comment: this is a test comment 38 | state: present 39 | provider: "{{ nios_provider }}" 40 | register: dtc_monitor_pdp_update1 41 | 42 | - name: Readd a comment to an existing DTC PDP monitor 43 | infoblox.nios_modules.nios_dtc_monitor_pdp: 44 | name: pdp_monitor 45 | comment: this is a test comment 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | register: dtc_monitor_pdp_update2 49 | 50 | - name: Remove a DTC PDP monitor from the system 51 | infoblox.nios_modules.nios_dtc_monitor_pdp: 52 | name: pdp_monitor 53 | state: absent 54 | provider: "{{ nios_provider }}" 55 | register: dtc_monitor_pdp_delete1 56 | 57 | - name: Reremove a DTC PDP monitor from the system 58 | infoblox.nios_modules.nios_dtc_monitor_pdp: 59 | name: pdp_monitor 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | register: dtc_monitor_pdp_delete2 63 | 64 | - name: Verify outcomes 65 | ansible.builtin.assert: 66 | that: 67 | - dtc_monitor_pdp_create1.changed 68 | - not dtc_monitor_pdp_create2.changed 69 | - dtc_monitor_pdp_update1.changed 70 | - not dtc_monitor_pdp_update2.changed 71 | - dtc_monitor_pdp_delete1.changed 72 | - not dtc_monitor_pdp_delete2.changed 73 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_sip/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_sip/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_sip/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_sip/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include tasks from nios_dtc_monitor_sip_idempotence.yaml 3 | ansible.builtin.include_tasks: nios_dtc_monitor_sip_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_sip/tasks/nios_dtc_monitor_sip_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC SIP monitor 15 | infoblox.nios_modules.nios_dtc_monitor_sip: 16 | name: sip_monitor 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | 20 | - name: Create a DTC SIP monitor 21 | infoblox.nios_modules.nios_dtc_monitor_sip: 22 | name: sip_monitor 23 | state: present 24 | provider: "{{ nios_provider }}" 25 | register: dtc_monitor_sip_create1 26 | 27 | - name: Recreate a DTC SIP monitor 28 | infoblox.nios_modules.nios_dtc_monitor_sip: 29 | name: sip_monitor 30 | state: present 31 | provider: "{{ nios_provider }}" 32 | register: dtc_monitor_sip_create2 33 | 34 | - name: Add a comment to an existing DTC SIP monitor 35 | infoblox.nios_modules.nios_dtc_monitor_sip: 36 | name: sip_monitor 37 | comment: this is a test comment 38 | state: present 39 | provider: "{{ nios_provider }}" 40 | register: dtc_monitor_sip_update1 41 | 42 | - name: Readd a comment to an existing DTC SIP monitor 43 | infoblox.nios_modules.nios_dtc_monitor_sip: 44 | name: sip_monitor 45 | comment: this is a test comment 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | register: dtc_monitor_sip_update2 49 | 50 | - name: Remove a DTC SIP monitor from the system 51 | infoblox.nios_modules.nios_dtc_monitor_sip: 52 | name: sip_monitor 53 | state: absent 54 | provider: "{{ nios_provider }}" 55 | register: dtc_monitor_sip_delete1 56 | 57 | - name: Reremove a DTC SIP monitor from the system 58 | infoblox.nios_modules.nios_dtc_monitor_sip: 59 | name: sip_monitor 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | register: dtc_monitor_sip_delete2 63 | 64 | - name: Verify outcomes 65 | ansible.builtin.assert: 66 | that: 67 | - dtc_monitor_sip_create1.changed 68 | - not dtc_monitor_sip_create2.changed 69 | - dtc_monitor_sip_update1.changed 70 | - not dtc_monitor_sip_update2.changed 71 | - dtc_monitor_sip_delete1.changed 72 | - not dtc_monitor_sip_delete2.changed 73 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_snmp/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_snmp/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_snmp/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_snmp/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include the tasks from the nios_dtc_monitor_snmp_idempotence.yaml file 3 | ansible.builtin.include_tasks: nios_dtc_monitor_snmp_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_snmp/tasks/nios_dtc_monitor_snmp_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC SNMP monitor 15 | infoblox.nios_modules.nios_dtc_monitor_snmp: 16 | name: snmp_monitor 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | 20 | - name: Create a DTC SNMP monitor 21 | infoblox.nios_modules.nios_dtc_monitor_snmp: 22 | name: snmp_monitor 23 | state: present 24 | provider: "{{ nios_provider }}" 25 | register: dtc_monitor_snmp_create1 26 | 27 | - name: Recreate a DTC SNMP monitor 28 | infoblox.nios_modules.nios_dtc_monitor_snmp: 29 | name: snmp_monitor 30 | state: present 31 | provider: "{{ nios_provider }}" 32 | register: dtc_monitor_snmp_create2 33 | 34 | - name: Add a comment to an existing DTC SNMP monitor 35 | infoblox.nios_modules.nios_dtc_monitor_snmp: 36 | name: snmp_monitor 37 | comment: this is a test comment 38 | state: present 39 | provider: "{{ nios_provider }}" 40 | register: dtc_monitor_snmp_update1 41 | 42 | - name: Readd a comment to an existing DTC SNMP monitor 43 | infoblox.nios_modules.nios_dtc_monitor_snmp: 44 | name: snmp_monitor 45 | comment: this is a test comment 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | register: dtc_monitor_snmp_update2 49 | 50 | - name: Remove a DTC SNMP monitor from the system 51 | infoblox.nios_modules.nios_dtc_monitor_snmp: 52 | name: snmp_monitor 53 | state: absent 54 | provider: "{{ nios_provider }}" 55 | register: dtc_monitor_snmp_delete1 56 | 57 | - name: Reremove a DTC SNMP monitor from the system 58 | infoblox.nios_modules.nios_dtc_monitor_snmp: 59 | name: snmp_monitor 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | register: dtc_monitor_snmp_delete2 63 | 64 | - name: Verify outcomes 65 | ansible.builtin.assert: 66 | that: 67 | - dtc_monitor_snmp_create1.changed 68 | - not dtc_monitor_snmp_create2.changed 69 | - dtc_monitor_snmp_update1.changed 70 | - not dtc_monitor_snmp_update2.changed 71 | - dtc_monitor_snmp_delete1.changed 72 | - not dtc_monitor_snmp_delete2.changed 73 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_tcp/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_tcp/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_tcp/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_tcp/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include the test for the nios_dtc_monitor_tcp_idempotence 3 | ansible.builtin.include_tasks: nios_dtc_monitor_tcp_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_monitor_tcp/tasks/nios_dtc_monitor_tcp_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC TCP monitor 15 | infoblox.nios_modules.nios_dtc_monitor_tcp: 16 | name: tcp_monitor 17 | port: 8080 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | 21 | - name: Create a DTC TCP monitor 22 | infoblox.nios_modules.nios_dtc_monitor_tcp: 23 | name: tcp_monitor 24 | port: 8080 25 | state: present 26 | provider: "{{ nios_provider }}" 27 | register: dtc_monitor_tcp_create1 28 | 29 | - name: Recreate a DTC TCP monitor 30 | infoblox.nios_modules.nios_dtc_monitor_tcp: 31 | name: tcp_monitor 32 | port: 8080 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | register: dtc_monitor_tcp_create2 36 | 37 | - name: Add a comment to an existing DTC TCP monitor 38 | infoblox.nios_modules.nios_dtc_monitor_tcp: 39 | name: tcp_monitor 40 | port: 8080 41 | comment: this is a test comment 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: dtc_monitor_tcp_update1 45 | 46 | - name: Readd a comment to an existing DTC TCP monitor 47 | infoblox.nios_modules.nios_dtc_monitor_tcp: 48 | name: tcp_monitor 49 | port: 8080 50 | comment: this is a test comment 51 | state: present 52 | provider: "{{ nios_provider }}" 53 | register: dtc_monitor_tcp_update2 54 | 55 | - name: Remove a DTC TCP monitor from the system 56 | infoblox.nios_modules.nios_dtc_monitor_tcp: 57 | name: tcp_monitor 58 | port: 8080 59 | state: absent 60 | provider: "{{ nios_provider }}" 61 | register: dtc_monitor_tcp_delete1 62 | 63 | - name: Reremove a DTC TCP monitor from the system 64 | infoblox.nios_modules.nios_dtc_monitor_tcp: 65 | name: tcp_monitor 66 | port: 8080 67 | state: absent 68 | provider: "{{ nios_provider }}" 69 | register: dtc_monitor_tcp_delete2 70 | 71 | - name: Verify outcomes 72 | ansible.builtin.assert: 73 | that: 74 | - dtc_monitor_tcp_create1.changed 75 | - not dtc_monitor_tcp_create2.changed 76 | - dtc_monitor_tcp_update1.changed 77 | - not dtc_monitor_tcp_update2.changed 78 | - dtc_monitor_tcp_delete1.changed 79 | - not dtc_monitor_tcp_delete2.changed 80 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_topology/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_topology/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_topology/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_topology/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include DTC topology idempotence tests 3 | ansible.builtin.include_tasks: nios_dtc_topology_idempotence.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_dtc_topology/tasks/nios_dtc_topology_idempotence.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Clean up the DTC Topology 15 | infoblox.nios_modules.nios_dtc_topology: 16 | name: a_topology 17 | state: absent 18 | provider: "{{ nios_provider }}" 19 | 20 | - name: Clean up the DTC pool 21 | infoblox.nios_modules.nios_dtc_pool: 22 | name: web_pool 23 | lb_preferred_method: ROUND_ROBIN 24 | state: absent 25 | provider: "{{ nios_provider }}" 26 | 27 | - name: Clean up the DTC server 28 | infoblox.nios_modules.nios_dtc_server: 29 | name: Server1 30 | host: 192.168.10.1 31 | state: absent 32 | provider: "{{ nios_provider }}" 33 | 34 | - name: Create DTC server 35 | infoblox.nios_modules.nios_dtc_server: 36 | name: Server1 37 | host: 192.168.10.1 38 | comment: Created with Ansible 39 | state: present 40 | provider: "{{ nios_provider }}" 41 | 42 | - name: Create DTC Pool 43 | infoblox.nios_modules.nios_dtc_pool: 44 | name: web_pool 45 | lb_preferred_method: ROUND_ROBIN 46 | servers: 47 | - server: Server1 48 | ratio: 1 49 | comment: Created with Ansible 50 | state: present 51 | provider: "{{ nios_provider }}" 52 | 53 | - name: Create a DTC Topology 54 | infoblox.nios_modules.nios_dtc_topology: 55 | name: a_topology 56 | rules: 57 | - dest_type: POOL 58 | destination_link: web_pool 59 | return_type: REGULAR 60 | state: present 61 | provider: "{{ nios_provider }}" 62 | register: dtc_topology_create1 63 | 64 | - name: Recreate a DTC Topology 65 | infoblox.nios_modules.nios_dtc_topology: 66 | name: a_topology 67 | state: present 68 | provider: "{{ nios_provider }}" 69 | register: dtc_topology_create2 70 | 71 | - name: Add a comment to an existing DTC Topology 72 | infoblox.nios_modules.nios_dtc_topology: 73 | name: a_topology 74 | comment: this is a test comment 75 | state: present 76 | provider: "{{ nios_provider }}" 77 | register: dtc_topology_update1 78 | 79 | - name: Readd a comment to an existing DTC Topology 80 | infoblox.nios_modules.nios_dtc_topology: 81 | name: a_topology 82 | comment: this is a test comment 83 | state: present 84 | provider: "{{ nios_provider }}" 85 | register: dtc_topology_update2 86 | 87 | - name: Remove a DTC Topology 88 | infoblox.nios_modules.nios_dtc_topology: 89 | name: a_topology 90 | state: absent 91 | provider: "{{ nios_provider }}" 92 | register: dtc_topology_delete1 93 | 94 | - name: Reremove a DTC Topology 95 | infoblox.nios_modules.nios_dtc_topology: 96 | name: a_topology 97 | state: absent 98 | provider: "{{ nios_provider }}" 99 | register: dtc_topology_delete2 100 | 101 | - name: Remove the DTC pool 102 | infoblox.nios_modules.nios_dtc_pool: 103 | name: web_pool 104 | lb_preferred_method: ROUND_ROBIN 105 | state: absent 106 | provider: "{{ nios_provider }}" 107 | 108 | - name: Remove the DTC server 109 | infoblox.nios_modules.nios_dtc_server: 110 | name: Server1 111 | host: 192.168.10.1 112 | state: absent 113 | provider: "{{ nios_provider }}" 114 | 115 | - name: Verify outcomes 116 | ansible.builtin.assert: 117 | that: 118 | - dtc_topology_create1.changed 119 | - not dtc_topology_create2.changed 120 | - dtc_topology_update1.changed 121 | - not dtc_topology_update2.changed 122 | - dtc_topology_delete1.changed 123 | - not dtc_topology_delete2.changed 124 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_extensible_attribute/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_extensible_attribute/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_extensible_attribute/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_extensible_attribute/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include tasks for extensible attributes 3 | ansible.builtin.include_tasks: nios_extensible_attribute.yaml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_extensible_attribute/tasks/nios_extensible_attribute.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Clean up existing EA 3 | infoblox.nios_modules.nios_extensible_attribute: 4 | name: stringEA 5 | type: STRING 6 | state: absent 7 | provider: "{{ nios_provider }}" 8 | 9 | - name: Create STRING EA 10 | infoblox.nios_modules.nios_extensible_attribute: 11 | name: stringEA 12 | type: STRING 13 | default_value: string 14 | min: 1 15 | max: 15 16 | comment: Created string EA with Ansible 17 | state: present 18 | provider: "{{ nios_provider }}" 19 | register: create_string_ea 20 | 21 | - name: Update STRING EA Comment 22 | infoblox.nios_modules.nios_extensible_attribute: 23 | name: stringEA 24 | type: STRING 25 | default_value: string 26 | min: 1 27 | max: 15 28 | comment: Updated string EA with Ansible 29 | state: present 30 | provider: "{{ nios_provider }}" 31 | register: update_string_ea 32 | 33 | - name: Create Integer EA 34 | infoblox.nios_modules.nios_extensible_attribute: 35 | name: IntegerEA 36 | type: INTEGER 37 | default_value: "15" 38 | min: 1 39 | max: 15 40 | flags: I 41 | comment: Created string EA with Ansible 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: create_integer_ea 45 | 46 | - name: Update Integer EA value 47 | infoblox.nios_modules.nios_extensible_attribute: 48 | name: IntegerEA 49 | type: INTEGER 50 | default_value: "14" 51 | min: 1 52 | max: 15 53 | flags: I 54 | comment: Created string EA with Ansible 55 | state: present 56 | provider: "{{ nios_provider }}" 57 | register: update_integer_ea 58 | 59 | - name: Remove STRING EA Comment 60 | infoblox.nios_modules.nios_extensible_attribute: 61 | name: stringEA 62 | type: STRING 63 | default_value: string 64 | min: 1 65 | max: 15 66 | state: present 67 | provider: "{{ nios_provider }}" 68 | register: remove_string_ea 69 | 70 | - name: Remove Integer EA definition 71 | infoblox.nios_modules.nios_extensible_attribute: 72 | name: IntegerEA 73 | type: INTEGER 74 | default_value: "14" 75 | min: 1 76 | max: 15 77 | flags: I 78 | comment: Created string EA with Ansible 79 | state: absent 80 | provider: "{{ nios_provider }}" 81 | register: remove_integer_ea 82 | 83 | - name: Create ENUM EA 84 | infoblox.nios_modules.nios_extensible_attribute: 85 | name: enumEA 86 | type: ENUM 87 | list_values: 88 | - option1 89 | - option2 90 | default_value: option1 91 | comment: Created enum EA with Ansible 92 | state: present 93 | provider: "{{ nios_provider }}" 94 | register: create_enum_ea 95 | 96 | - name: Update ENUM EA default value 97 | infoblox.nios_modules.nios_extensible_attribute: 98 | name: enumEA 99 | type: ENUM 100 | list_values: 101 | - option1 102 | - option2 103 | default_value: option2 104 | comment: Updated enum EA default value with Ansible 105 | state: present 106 | provider: "{{ nios_provider }}" 107 | register: update_enum_ea 108 | 109 | - name: Create DATE EA 110 | infoblox.nios_modules.nios_extensible_attribute: 111 | name: dateEA 112 | type: DATE 113 | default_value: "2023-01-01" 114 | comment: Created date EA with Ansible 115 | state: present 116 | provider: "{{ nios_provider }}" 117 | register: create_date_ea 118 | 119 | - name: Update DATE EA default value 120 | infoblox.nios_modules.nios_extensible_attribute: 121 | name: dateEA 122 | type: DATE 123 | default_value: "2023-12-31" 124 | comment: Updated date EA default value with Ansible 125 | state: present 126 | provider: "{{ nios_provider }}" 127 | register: update_date_ea 128 | 129 | - name: Check if the EA already exists 130 | infoblox.nios_modules.nios_extensible_attribute: 131 | name: existEA 132 | state: present 133 | provider: "{{ nios_provider }}" 134 | register: ea_exists 135 | 136 | - name: Verify outcomes including new tests 137 | ansible.builtin.assert: 138 | that: 139 | - create_string_ea.changed 140 | - update_string_ea.changed 141 | - create_integer_ea.changed 142 | - update_integer_ea.changed 143 | - remove_string_ea.changed 144 | - remove_integer_ea.changed 145 | - create_enum_ea.changed 146 | - update_enum_ea.changed 147 | - create_date_ea.changed 148 | - update_date_ea.changed 149 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_host_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_host_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_host_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_host_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include host record idempotence tests 3 | ansible.builtin.include_tasks: nios_host_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_host_record/tasks/nios_host_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup ipv4 host record 15 | infoblox.nios_modules.nios_host_record: 16 | name: host.ansible.com 17 | ipv4: 18 | - address: 192.168.10.1 19 | state: absent 20 | provider: "{{ nios_provider }}" 21 | 22 | - name: Create an ipv4 host record 23 | infoblox.nios_modules.nios_host_record: 24 | name: host.ansible.com 25 | ipv4: 26 | - address: 192.168.10.1 27 | state: present 28 | provider: "{{ nios_provider }}" 29 | register: ipv4_create1 30 | 31 | - name: Recreate an ipv4 host record 32 | infoblox.nios_modules.nios_host_record: 33 | name: host.ansible.com 34 | ipv4: 35 | - address: 192.168.10.1 36 | state: present 37 | provider: "{{ nios_provider }}" 38 | register: ipv4_create2 39 | 40 | - name: Add a comment to an existing host record 41 | infoblox.nios_modules.nios_host_record: 42 | name: host.ansible.com 43 | ipv4: 44 | - address: 192.168.10.1 45 | comment: this is a test comment 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | register: ipv4_update1 49 | 50 | 51 | # TODO: Uncomment this block when the issue resolved 52 | # - name: Add a comment to an existing host record 53 | # infoblox.nios_modules.nios_host_record: 54 | # name: host.ansible.com 55 | # ipv4: 56 | # - address: 192.168.10.1 57 | # comment: this is a test comment 58 | # state: present 59 | # provider: "{{ nios_provider }}" 60 | # register: ipv4_update2 61 | 62 | - name: Remove a host record from the system 63 | infoblox.nios_modules.nios_host_record: 64 | name: host.ansible.com 65 | state: absent 66 | provider: "{{ nios_provider }}" 67 | register: ipv4_delete1 68 | 69 | - name: Remove a host record from the system 70 | infoblox.nios_modules.nios_host_record: 71 | name: host.ansible.com 72 | state: absent 73 | provider: "{{ nios_provider }}" 74 | register: ipv4_delete2 75 | 76 | - name: Create an ipv4 host record bypassing DNS 77 | infoblox.nios_modules.nios_host_record: 78 | name: host 79 | ipv4: 80 | - address: 192.168.10.1 81 | dns: false 82 | state: present 83 | provider: "{{ nios_provider }}" 84 | register: ipv4_create3 85 | 86 | - name: Recreate an ipv4 host record bypassing DNS 87 | infoblox.nios_modules.nios_host_record: 88 | name: host 89 | ipv4: 90 | - address: 192.168.10.1 91 | dns: false 92 | state: present 93 | provider: "{{ nios_provider }}" 94 | register: ipv4_create4 95 | 96 | - name: Create an ipv4 host record via DHCP and MAC 97 | infoblox.nios_modules.nios_host_record: 98 | name: host 99 | configure_for_dns: false 100 | ipv4: 101 | - address: 192.168.10.1 102 | dhcp: true 103 | mac: "00-80-C8-E3-4C-BD" 104 | state: present 105 | provider: "{{ nios_provider }}" 106 | register: ipv4_create5 107 | 108 | # - name: Recreate an ipv4 host record via DHCP and MAC 109 | # infoblox.nios_modules.nios_host_record: 110 | # name: host 111 | # configure_for_dns: false 112 | # ipv4: 113 | # - address: 192.168.10.1 114 | # dhcp: true 115 | # mac: "00-80-C8-E3-4C-BD" 116 | # state: present 117 | # provider: "{{ nios_provider }}" 118 | # register: ipv4_create6 119 | 120 | - name: Verify idempotence and changes of IPv4 host record operations 121 | ansible.builtin.assert: 122 | that: 123 | - ipv4_create1.changed 124 | - not ipv4_create2.changed 125 | - ipv4_update1.changed 126 | # - not ipv4_update2.changed 127 | - ipv4_delete1.changed 128 | - not ipv4_delete2.changed 129 | - ipv4_create3.changed 130 | - not ipv4_create4.changed 131 | - ipv4_create5.changed 132 | # - not ipv4_create6.changed 133 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_mx_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_mx_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_mx_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_mx_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include MX record idempotence tests 3 | ansible.builtin.include_tasks: nios_mx_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_mx_record/tasks/nios_mx_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup mx record 15 | infoblox.nios_modules.nios_mx_record: 16 | name: ansible.com 17 | mx: mailhost.ansible.com 18 | preference: 0 19 | state: absent 20 | provider: "{{ nios_provider }}" 21 | 22 | - name: Create an mx record 23 | infoblox.nios_modules.nios_mx_record: 24 | name: ansible.com 25 | mx: mailhost.ansible.com 26 | preference: 0 27 | state: present 28 | provider: "{{ nios_provider }}" 29 | register: mx_record_create1 30 | 31 | - name: Recreate an mx record 32 | infoblox.nios_modules.nios_mx_record: 33 | name: ansible.com 34 | mx: mailhost.ansible.com 35 | preference: 0 36 | state: present 37 | provider: "{{ nios_provider }}" 38 | register: mx_record_create2 39 | 40 | - name: Add a comment to an existing mx record 41 | infoblox.nios_modules.nios_mx_record: 42 | name: ansible.com 43 | mx: mailhost.ansible.com 44 | preference: 0 45 | comment: this is a test comment 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | register: mx_record_update1 49 | 50 | - name: Add a comment to an existing mx record 51 | infoblox.nios_modules.nios_mx_record: 52 | name: ansible.com 53 | mx: mailhost.ansible.com 54 | preference: 0 55 | comment: this is a test comment 56 | state: present 57 | provider: "{{ nios_provider }}" 58 | register: mx_record_update2 59 | 60 | - name: Remove a mx record from the system 61 | infoblox.nios_modules.nios_mx_record: 62 | name: ansible.com 63 | mx: mailhost.ansible.com 64 | preference: 0 65 | state: absent 66 | provider: "{{ nios_provider }}" 67 | register: mx_record_delete1 68 | 69 | - name: Remove a mx record from the system 70 | infoblox.nios_modules.nios_mx_record: 71 | name: ansible.com 72 | mx: mailhost.ansible.com 73 | preference: 0 74 | state: absent 75 | provider: "{{ nios_provider }}" 76 | register: mx_record_delete2 77 | 78 | - name: Verify idempotence and changes of MX record operations 79 | ansible.builtin.assert: 80 | that: 81 | - mx_record_create1.changed 82 | - not mx_record_create2.changed 83 | - mx_record_update1.changed 84 | - not mx_record_update2.changed 85 | - mx_record_delete1.changed 86 | - not mx_record_delete2.changed 87 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_naptr_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_naptr_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_naptr_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_naptr_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include NAPTR record idempotence tests 3 | ansible.builtin.include_tasks: nios_naptr_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_naptr_record/tasks/nios_naptr_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup naptr record 15 | infoblox.nios_modules.nios_naptr_record: 16 | name: "*.subscriber-100.ansiblezone.com" 17 | order: 1000 18 | preference: 10 19 | replacement: replacement1.network.ansiblezone.com 20 | state: absent 21 | provider: "{{ nios_provider }}" 22 | 23 | - name: Create an naptr record 24 | infoblox.nios_modules.nios_naptr_record: 25 | name: "*.subscriber-100.ansiblezone.com" 26 | order: 1000 27 | preference: 10 28 | replacement: replacement1.network.ansiblezone.com 29 | state: present 30 | provider: "{{ nios_provider }}" 31 | register: naptr_record_create1 32 | 33 | - name: Recreate an naptr record 34 | infoblox.nios_modules.nios_naptr_record: 35 | name: "*.subscriber-100.ansiblezone.com" 36 | order: 1000 37 | preference: 10 38 | replacement: replacement1.network.ansiblezone.com 39 | state: present 40 | provider: "{{ nios_provider }}" 41 | register: naptr_record_create2 42 | 43 | - name: Add a comment to an existing naptr record 44 | infoblox.nios_modules.nios_naptr_record: 45 | name: "*.subscriber-100.ansiblezone.com" 46 | order: 1000 47 | preference: 10 48 | replacement: replacement1.network.ansiblezone.com 49 | comment: this is a test comment 50 | state: present 51 | provider: "{{ nios_provider }}" 52 | register: naptr_record_update1 53 | 54 | - name: Add a comment to an existing naptr record 55 | infoblox.nios_modules.nios_naptr_record: 56 | name: "*.subscriber-100.ansiblezone.com" 57 | order: 1000 58 | preference: 10 59 | replacement: replacement1.network.ansiblezone.com 60 | comment: this is a test comment 61 | state: present 62 | provider: "{{ nios_provider }}" 63 | register: naptr_record_update2 64 | 65 | - name: Remove a naptr record from the system 66 | infoblox.nios_modules.nios_naptr_record: 67 | name: "*.subscriber-100.ansiblezone.com" 68 | order: 1000 69 | preference: 10 70 | replacement: replacement1.network.ansiblezone.com 71 | state: absent 72 | provider: "{{ nios_provider }}" 73 | register: naptr_record_delete1 74 | 75 | - name: Remove a naptr record from the system 76 | infoblox.nios_modules.nios_naptr_record: 77 | name: "*.subscriber-100.ansiblezone.com" 78 | order: 1000 79 | preference: 10 80 | replacement: replacement1.network.ansiblezone.com 81 | state: absent 82 | provider: "{{ nios_provider }}" 83 | register: naptr_record_delete2 84 | 85 | - name: Verify idempotence and changes of NAPTR record operations 86 | ansible.builtin.assert: 87 | that: 88 | - naptr_record_create1.changed 89 | - not naptr_record_create2.changed 90 | - naptr_record_update1.changed 91 | - not naptr_record_update2.changed 92 | - naptr_record_delete1.changed 93 | - not naptr_record_delete2.changed 94 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network/defaults/main.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/integration/targets/nios_network/defaults/main.yaml -------------------------------------------------------------------------------- /tests/integration/targets/nios_network/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include network idempotence tests 3 | ansible.builtin.include_tasks: nios_network_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network/tasks/nios_network_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup a network ipv4 3 | infoblox.nios_modules.nios_network: 4 | network: 192.168.10.0/24 5 | comment: this is a test comment 6 | state: absent 7 | provider: "{{ nios_provider }}" 8 | 9 | - name: Configure a network ipv4 10 | infoblox.nios_modules.nios_network: 11 | network: 192.168.10.0/24 12 | comment: this is a test comment 13 | state: present 14 | provider: "{{ nios_provider }}" 15 | register: nios_ipv4_create1 16 | 17 | - name: Configure a network ipv4 18 | infoblox.nios_modules.nios_network: 19 | network: 192.168.10.0/24 20 | comment: this is a test comment 21 | state: present 22 | provider: "{{ nios_provider }}" 23 | register: nios_ipv4_create2 24 | 25 | - name: Set dhcp options for a network ipv4 26 | infoblox.nios_modules.nios_network: 27 | network: 192.168.10.0/24 28 | comment: this is a test comment 29 | options: 30 | - name: domain-name 31 | value: ansible.com 32 | state: present 33 | provider: "{{ nios_provider }}" 34 | register: nios_ipv4_update1 35 | 36 | - name: Set dhcp options for a network ipv4 37 | infoblox.nios_modules.nios_network: 38 | network: 192.168.10.0/24 39 | comment: this is a test comment 40 | options: 41 | - name: domain-name 42 | value: ansible.com 43 | state: present 44 | provider: "{{ nios_provider }}" 45 | register: nios_ipv4_update2 46 | 47 | - name: Remove a network ipv4 48 | infoblox.nios_modules.nios_network: 49 | network: 192.168.10.0/24 50 | state: absent 51 | provider: "{{ nios_provider }}" 52 | register: nios_ipv4_remove1 53 | 54 | - name: Remove a network ipv4 55 | infoblox.nios_modules.nios_network: 56 | network: 192.168.10.0/24 57 | state: absent 58 | provider: "{{ nios_provider }}" 59 | register: nios_ipv4_remove2 60 | 61 | - name: Configure a network ipv6 62 | infoblox.nios_modules.nios_network: 63 | network: fe80::/64 64 | comment: this is a test comment 65 | state: present 66 | provider: "{{ nios_provider }}" 67 | register: nios_ipv6_create1 68 | 69 | - name: Configure a network ipv6 with filter option 70 | infoblox.nios_modules.nios_network: 71 | network: fe80::/64 72 | comment: this is a test comment 73 | use_logic_filter_rules: true 74 | state: present 75 | provider: "{{ nios_provider }}" 76 | register: nios_ipv6_update1 77 | 78 | - name: Configure a network ipv4 with filter option 79 | infoblox.nios_modules.nios_network: 80 | network: 192.168.11.0/24 81 | comment: this is a test comment 82 | use_logic_filter_rules: true 83 | state: present 84 | provider: "{{ nios_provider }}" 85 | register: nios_ipv4_create3 86 | 87 | - name: Update a network ipv4 with filter option 88 | infoblox.nios_modules.nios_network: 89 | network: 192.168.11.0/24 90 | comment: this is a test comment 91 | use_logic_filter_rules: false 92 | state: present 93 | provider: "{{ nios_provider }}" 94 | register: nios_ipv4_update3 95 | 96 | - name: Re-run with no changes 97 | infoblox.nios_modules.nios_network: 98 | network: 192.168.11.0/24 99 | comment: this is a test comment 100 | use_logic_filter_rules: false 101 | state: present 102 | provider: "{{ nios_provider }}" 103 | register: nios_ipv4_update4 104 | 105 | - name: Remove an ipv4 network 106 | infoblox.nios_modules.nios_network: 107 | network: 192.168.11.0/24 108 | comment: this is a test comment 109 | use_logic_filter_rules: false 110 | state: absent 111 | provider: "{{ nios_provider }}" 112 | register: nios_ipv4_remove3 113 | 114 | - name: Verify idempotence and changes of network operations 115 | ansible.builtin.assert: 116 | that: 117 | - nios_ipv4_create1.changed 118 | - not nios_ipv4_create2.changed 119 | - nios_ipv4_update1.changed 120 | - not nios_ipv4_update2.changed 121 | - nios_ipv4_remove1.changed 122 | - not nios_ipv4_remove2.changed 123 | - nios_ipv4_create3.changed 124 | - nios_ipv4_update3.changed 125 | - nios_ipv6_create1.changed 126 | - nios_ipv6_update1.changed 127 | - not nios_ipv4_update4.changed 128 | - nios_ipv4_remove3.changed 129 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network_view/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network_view/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network_view/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network_view/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include network view idempotence tests 3 | ansible.builtin.include_tasks: nios_network_view_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_network_view/tasks/nios_network_view_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup a new network view 3 | infoblox.nios_modules.nios_network_view: 4 | name: ansible 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Configure a new network view 9 | infoblox.nios_modules.nios_network_view: 10 | name: ansible 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | register: nios_network_view_create1 14 | 15 | - name: Configure a new network view 16 | infoblox.nios_modules.nios_network_view: 17 | name: ansible 18 | state: present 19 | provider: "{{ nios_provider }}" 20 | register: nios_network_view_create2 21 | 22 | - name: Update the comment for network view 23 | infoblox.nios_modules.nios_network_view: 24 | name: ansible 25 | comment: this is an example comment 26 | state: present 27 | provider: "{{ nios_provider }}" 28 | register: nios_network_view_update1 29 | 30 | - name: Update the comment for network view 31 | infoblox.nios_modules.nios_network_view: 32 | name: ansible 33 | comment: this is an example comment 34 | state: present 35 | provider: "{{ nios_provider }}" 36 | register: nios_network_view_update2 37 | 38 | - name: Remove the network view 39 | infoblox.nios_modules.nios_network_view: 40 | name: ansible 41 | state: absent 42 | provider: "{{ nios_provider }}" 43 | register: nios_network_view_delete1 44 | 45 | - name: Remove the network view 46 | infoblox.nios_modules.nios_network_view: 47 | name: ansible 48 | state: absent 49 | provider: "{{ nios_provider }}" 50 | register: nios_network_view_delete2 51 | 52 | - name: Verify idempotence and changes of network view operations 53 | ansible.builtin.assert: 54 | that: 55 | - nios_network_view_create1.changed 56 | - not nios_network_view_create2.changed 57 | - nios_network_view_update1.changed 58 | - not nios_network_view_update2.changed 59 | - nios_network_view_delete1.changed 60 | - not nios_network_view_delete2.changed 61 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_delegation/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_delegation/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_delegation/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_delegation/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include idempotence tasks for nsgroup delegation 3 | ansible.builtin.include_tasks: nios_nsgroup_delegation_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_delegation/tasks/nios_nsgroup_delegation_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup nsgroup delegation 3 | nios_nsgroup_delegation: 4 | name: ansible-nsgroup_delegation 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | delegate_to: 8 | - name: ns1 9 | address: 192.168.0.1 10 | 11 | - name: Configure a nsgroup delegation on the system 12 | nios_nsgroup_delegation: 13 | name: ansible-nsgroup_delegation 14 | state: present 15 | provider: "{{ nios_provider }}" 16 | delegate_to: 17 | - name: ns1 18 | address: 192.168.0.1 19 | register: nsgroup_delegation_create1 20 | 21 | - name: Configure another nsgroup delegation on the system 22 | nios_nsgroup_delegation: 23 | name: ansible-nsgroup_delegation 24 | state: present 25 | provider: "{{ nios_provider }}" 26 | delegate_to: 27 | - name: ns1 28 | address: 192.168.0.1 29 | register: nsgroup_delegation_create2 30 | 31 | - name: Update the comment and ext attributes for an existing nsgroup delegation 32 | nios_nsgroup_delegation: 33 | name: ansible-nsgroup_delegation 34 | comment: this is an example comment 35 | extattrs: 36 | Site: west-dc 37 | state: present 38 | provider: "{{ nios_provider }}" 39 | delegate_to: 40 | - name: ns1 41 | address: 192.168.0.1 42 | register: nsgroup_delegation_update1 43 | 44 | - name: Update again the comment and ext attributes for an existing nsgroup delegation 45 | nios_nsgroup_delegation: 46 | name: ansible-nsgroup_delegation 47 | comment: this is an example comment 48 | extattrs: 49 | Site: west-dc 50 | state: present 51 | provider: "{{ nios_provider }}" 52 | delegate_to: 53 | - name: ns1 54 | address: 192.168.0.1 55 | register: nsgroup_delegation_update2 56 | 57 | - name: Remove the nsgroup delegation 58 | nios_nsgroup_delegation: 59 | name: ansible-nsgroup_delegation 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | delegate_to: 63 | - name: ns1 64 | address: 192.168.0.1 65 | register: nsgroup_delegation_delete1 66 | 67 | - name: Remove again the nsgroup delegation 68 | nios_nsgroup_delegation: 69 | name: ansible-nsgroup_delegation 70 | state: absent 71 | provider: "{{ nios_provider }}" 72 | delegate_to: 73 | - name: ns1 74 | address: 192.168.0.1 75 | register: nsgroup_delegation_delete2 76 | 77 | - name: Assert changes in nsgroup delegation 78 | ansible.builtin.assert: 79 | that: 80 | - nsgroup_delegation_create1.changed 81 | - not nsgroup_delegation_create2.changed 82 | - nsgroup_delegation_update1.changed 83 | - not nsgroup_delegation_update2.changed 84 | - nsgroup_delegation_delete1.changed 85 | - not nsgroup_delegation_delete2.changed 86 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardingmember/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardingmember/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardingmember/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardingmember/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Including idempotence tasks for nsgroup forwardingmember 3 | ansible.builtin.include_tasks: nios_nsgroup_forwardingmember_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardingmember/tasks/nios_nsgroup_forwardingmember_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup nsgroup forwardingmember 3 | nios_nsgroup_forwardingmember: 4 | name: ansible-nsgroup_forwardingmember 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | forwarding_servers: 8 | - name: ns1 9 | use_override_forwarders: true 10 | forward_to: 11 | - name: ns1 12 | address: 192.168.10.1 13 | 14 | - name: Configure a nsgroup forwardingmember on the system 15 | nios_nsgroup_forwardingmember: 16 | name: ansible-nsgroup_forwardingmember 17 | state: present 18 | provider: "{{ nios_provider }}" 19 | forwarding_servers: 20 | - name: ns1 21 | use_override_forwarders: true 22 | forward_to: 23 | - name: ns1 24 | address: 192.168.10.1 25 | register: nsgroup_forwardingmember_create1 26 | 27 | - name: Configure another nsgroup forwardingmember on the system 28 | nios_nsgroup_forwardingmember: 29 | name: ansible-nsgroup_forwardingmember 30 | state: present 31 | provider: "{{ nios_provider }}" 32 | forwarding_servers: 33 | - name: ns1 34 | use_override_forwarders: true 35 | forward_to: 36 | - name: ns1 37 | address: 192.168.10.1 38 | register: nsgroup_forwardingmember_create2 39 | 40 | - name: Update the comment and ext attributes for an existing nsgroup forwardingmember 41 | nios_nsgroup_forwardingmember: 42 | name: ansible-nsgroup_forwardingmember 43 | comment: this is an example comment 44 | extattrs: 45 | Site: west-dc 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | forwarding_servers: 49 | - name: ns1 50 | use_override_forwarders: true 51 | forward_to: 52 | - name: ns1 53 | address: 192.168.10.1 54 | register: nsgroup_forwardingmember_update1 55 | 56 | - name: Update again the comment and ext attributes for an existing nsgroup forwardingmember 57 | nios_nsgroup_forwardingmember: 58 | name: ansible-nsgroup_forwardingmember 59 | comment: this is an example comment 60 | extattrs: 61 | Site: west-dc 62 | state: present 63 | provider: "{{ nios_provider }}" 64 | forwarding_servers: 65 | - name: ns1 66 | use_override_forwarders: true 67 | forward_to: 68 | - name: ns1 69 | address: 192.168.10.1 70 | register: nsgroup_forwardingmember_update2 71 | 72 | - name: Remove the nsgroup forwardingmember 73 | nios_nsgroup_forwardingmember: 74 | name: ansible-nsgroup_forwardingmember 75 | state: absent 76 | provider: "{{ nios_provider }}" 77 | forwarding_servers: 78 | - name: ns1 79 | use_override_forwarders: true 80 | forward_to: 81 | - name: ns1 82 | address: 192.168.10.1 83 | register: nsgroup_forwardingmember_delete1 84 | 85 | - name: Remove again the nsgroup forwardingmember 86 | nios_nsgroup_forwardingmember: 87 | name: ansible-nsgroup_forwardingmember 88 | state: absent 89 | provider: "{{ nios_provider }}" 90 | forwarding_servers: 91 | - name: ns1 92 | use_override_forwarders: true 93 | forward_to: 94 | - name: ns1 95 | address: 192.168.10.1 96 | register: nsgroup_forwardingmember_delete2 97 | 98 | - name: Assert changes in nsgroup forwardingmember 99 | ansible.builtin.assert: 100 | that: 101 | - nsgroup_forwardingmember_create1.changed 102 | - not nsgroup_forwardingmember_create2.changed 103 | - nsgroup_forwardingmember_update1.changed 104 | - not nsgroup_forwardingmember_update2.changed 105 | - nsgroup_forwardingmember_delete1.changed 106 | - not nsgroup_forwardingmember_delete2.changed 107 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardstubserver/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardstubserver/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardstubserver/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardstubserver/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include idempotence tasks for nsgroup forwardstubserver 3 | ansible.builtin.include_tasks: nios_nsgroup_forwardstubserver_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_forwardstubserver/tasks/nios_nsgroup_forwardstubserver_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup nsgroup forwardstubserver 3 | nios_nsgroup_forwardstubserver: 4 | name: ansible-nsgroup_forwardstubserver 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | external_servers: 8 | - name: ns1 9 | address: 192.168.0.1 10 | 11 | - name: Configure a nsgroup forwardstubserver on the system 12 | nios_nsgroup_forwardstubserver: 13 | name: ansible-nsgroup_forwardstubserver 14 | state: present 15 | provider: "{{ nios_provider }}" 16 | external_servers: 17 | - name: ns1 18 | address: 192.168.0.1 19 | register: nsgroup_forwardstubserver_create1 20 | 21 | - name: Configure another nsgroup forwardstubserver on the system 22 | nios_nsgroup_forwardstubserver: 23 | name: ansible-nsgroup_forwardstubserver 24 | state: present 25 | provider: "{{ nios_provider }}" 26 | external_servers: 27 | - name: ns1 28 | address: 192.168.0.1 29 | register: nsgroup_forwardstubserver_create2 30 | 31 | - name: Update the comment and ext attributes for an existing nsgroup forwardstubserver 32 | nios_nsgroup_forwardstubserver: 33 | name: ansible-nsgroup_forwardstubserver 34 | comment: this is an example comment 35 | extattrs: 36 | Site: west-dc 37 | state: present 38 | provider: "{{ nios_provider }}" 39 | external_servers: 40 | - name: ns1 41 | address: 192.168.0.1 42 | register: nsgroup_forwardstubserver_update1 43 | 44 | - name: Update again the comment and ext attributes for an existing nsgroup forwardstubserver 45 | nios_nsgroup_forwardstubserver: 46 | name: ansible-nsgroup_forwardstubserver 47 | comment: this is an example comment 48 | extattrs: 49 | Site: west-dc 50 | state: present 51 | provider: "{{ nios_provider }}" 52 | external_servers: 53 | - name: ns1 54 | address: 192.168.0.1 55 | register: nsgroup_forwardstubserver_update2 56 | 57 | - name: Remove the nsgroup forwardstubserver 58 | nios_nsgroup_forwardstubserver: 59 | name: ansible-nsgroup_forwardstubserver 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | external_servers: 63 | - name: ns1 64 | address: 192.168.0.1 65 | register: nsgroup_forwardstubserver_delete1 66 | 67 | - name: Remove again the nsgroup forwardstubserver 68 | nios_nsgroup_forwardstubserver: 69 | name: ansible-nsgroup_forwardstubserver 70 | state: absent 71 | provider: "{{ nios_provider }}" 72 | external_servers: 73 | - name: ns1 74 | address: 192.168.0.1 75 | register: nsgroup_forwardstubserver_delete2 76 | 77 | - name: Assert changes in nsgroup forwardstubserver 78 | ansible.builtin.assert: 79 | that: 80 | - nsgroup_forwardstubserver_create1.changed 81 | - not nsgroup_forwardstubserver_create2.changed 82 | - nsgroup_forwardstubserver_update1.changed 83 | - not nsgroup_forwardstubserver_update2.changed 84 | - nsgroup_forwardstubserver_delete1.changed 85 | - not nsgroup_forwardstubserver_delete2.changed 86 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_stubmember/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_stubmember/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_stubmember/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_stubmember/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include idempotence tasks for nsgroup_stubmember 3 | ansible.builtin.include_tasks: nios_nsgroup_stubmember_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_nsgroup_stubmember/tasks/nios_nsgroup_stubmember_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup nsgroup stubmember 3 | nios_nsgroup_stubmember: 4 | name: ansible-nsgroup_stubmember 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | stub_members: 8 | - name: ns1 9 | 10 | - name: Configure a nsgroup stubmember on the system 11 | nios_nsgroup_stubmember: 12 | name: ansible-nsgroup_stubmember 13 | state: present 14 | provider: "{{ nios_provider }}" 15 | stub_members: 16 | - name: ns1 17 | register: nsgroup_stubmember_create1 18 | 19 | - name: Configure another nsgroup stubmember on the system 20 | nios_nsgroup_stubmember: 21 | name: ansible-nsgroup_stubmember 22 | state: present 23 | provider: "{{ nios_provider }}" 24 | stub_members: 25 | - name: ns1 26 | register: nsgroup_stubmember_create2 27 | 28 | - name: Update the comment and ext attributes for an existing nsgroup stubmember 29 | nios_nsgroup_stubmember: 30 | name: ansible-nsgroup_stubmember 31 | comment: this is an example comment 32 | extattrs: 33 | Site: west-dc 34 | state: present 35 | provider: "{{ nios_provider }}" 36 | stub_members: 37 | - name: ns1 38 | register: nsgroup_stubmember_update1 39 | 40 | - name: Update again the comment and ext attributes for an existing nsgroup stubmember 41 | nios_nsgroup_stubmember: 42 | name: ansible-nsgroup_stubmember 43 | comment: this is an example comment 44 | extattrs: 45 | Site: west-dc 46 | state: present 47 | provider: "{{ nios_provider }}" 48 | stub_members: 49 | - name: ns1 50 | register: nsgroup_stubmember_update2 51 | 52 | - name: Remove the nsgroup stubmember 53 | nios_nsgroup_stubmember: 54 | name: ansible-nsgroup_stubmember 55 | state: absent 56 | provider: "{{ nios_provider }}" 57 | stub_members: 58 | - name: ns1 59 | register: nsgroup_stubmember_delete1 60 | 61 | - name: Remove again the nsgroup stubmember 62 | nios_nsgroup_stubmember: 63 | name: ansible-nsgroup_stubmember 64 | state: absent 65 | provider: "{{ nios_provider }}" 66 | stub_members: 67 | - name: ns1 68 | register: nsgroup_stubmember_delete2 69 | 70 | - name: Assert changes in nsgroup_stubmember tasks 71 | ansible.builtin.assert: 72 | that: 73 | - nsgroup_stubmember_create1.changed 74 | - not nsgroup_stubmember_create2.changed 75 | - nsgroup_stubmember_update1.changed 76 | - not nsgroup_stubmember_update2.changed 77 | - nsgroup_stubmember_delete1.changed 78 | - not nsgroup_stubmember_delete2.changed 79 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_ptr_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_ptr_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_ptr_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_ptr_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include PTR record idempotence tests 3 | ansible.builtin.include_tasks: nios_ptr_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_ptr_record/tasks/nios_ptr_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Create an ipv4 ptr record 3 | infoblox.nios_modules.nios_ptr_record: 4 | name: ptr.ansible.com 5 | ptrdname: ptr.ansible.com 6 | ipv4: 192.168.10.1 7 | state: present 8 | provider: "{{ nios_provider }}" 9 | view: default 10 | register: ipv4_ptr_create1 11 | 12 | - name: Create the same ipv4 ptr record 13 | infoblox.nios_modules.nios_ptr_record: 14 | name: ptr.ansible.com 15 | ptrdname: ptr.ansible.com 16 | ipv4: 192.168.10.1 17 | state: present 18 | view: default 19 | provider: "{{ nios_provider }}" 20 | register: ipv4_ptr_create2 21 | 22 | - name: Add a comment to an existing ipv4 ptr record 23 | infoblox.nios_modules.nios_ptr_record: 24 | name: ptr.ansible.com 25 | ptrdname: ptr.ansible.com 26 | ipv4: 192.168.10.1 27 | comment: this is a test comment 28 | view: default 29 | state: present 30 | provider: "{{ nios_provider }}" 31 | register: ipv4_ptr_update1 32 | 33 | - name: Add the same comment to the same ipv4 ptr host record 34 | infoblox.nios_modules.nios_ptr_record: 35 | name: ptr.ansible.com 36 | ptrdname: ptr.ansible.com 37 | ipv4: 192.168.10.1 38 | comment: this is a test comment 39 | view: default 40 | state: present 41 | provider: "{{ nios_provider }}" 42 | register: ipv4_ptr_update2 43 | 44 | - name: Remove a ptr record from the system 45 | infoblox.nios_modules.nios_ptr_record: 46 | name: ptr.ansible.com 47 | ptrdname: ptr.ansible.com 48 | ipv4: 192.168.10.1 49 | view: default 50 | state: absent 51 | provider: "{{ nios_provider }}" 52 | register: ipv4_ptr_delete1 53 | 54 | - name: Remove the same ptr record from the system 55 | infoblox.nios_modules.nios_ptr_record: 56 | ptrdname: ptr.ansible.com 57 | name: ptr.ansible.com 58 | ipv4: 192.168.10.1 59 | view: default 60 | state: absent 61 | provider: "{{ nios_provider }}" 62 | register: ipv4_ptr_delete2 63 | 64 | - name: Create an ipv6 ptr record 65 | infoblox.nios_modules.nios_ptr_record: 66 | ptrdname: ptr6.ansible.com 67 | name: ptr6.ansible.com 68 | ipv6: 2002:8ac3:802d:1242:20d:60ff:fe38:6d16 69 | view: default 70 | state: present 71 | provider: "{{ nios_provider }}" 72 | register: ipv6_ptr_create1 73 | 74 | - name: Verify idempotence and changes of PTR record operations 75 | ansible.builtin.assert: 76 | that: 77 | - ipv4_ptr_create1.changed 78 | - not ipv4_ptr_create2.changed 79 | - ipv4_ptr_update1.changed 80 | - not ipv4_ptr_update2.changed 81 | - ipv4_ptr_delete1.changed 82 | - not ipv4_ptr_delete2.changed 83 | - ipv6_ptr_create1.changed 84 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_srv_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_srv_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_srv_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_srv_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include SRV record idempotence tests 3 | ansible.builtin.include_tasks: nios_srv_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_srv_record/tasks/nios_srv_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup srv record 15 | infoblox.nios_modules.nios_srv_record: 16 | name: ansible.com 17 | port: 5080 18 | priority: 10 19 | target: service1.ansible.com 20 | weight: 10 21 | state: absent 22 | provider: "{{ nios_provider }}" 23 | 24 | - name: Create an srv record 25 | infoblox.nios_modules.nios_srv_record: 26 | name: ansible.com 27 | port: 5080 28 | priority: 10 29 | target: service1.ansible.com 30 | weight: 10 31 | state: present 32 | provider: "{{ nios_provider }}" 33 | register: srv_record_create1 34 | 35 | - name: Recreate an srv record 36 | infoblox.nios_modules.nios_srv_record: 37 | name: ansible.com 38 | port: 5080 39 | priority: 10 40 | target: service1.ansible.com 41 | weight: 10 42 | state: present 43 | provider: "{{ nios_provider }}" 44 | register: srv_record_create2 45 | 46 | - name: Add a comment to an existing srv record 47 | infoblox.nios_modules.nios_srv_record: 48 | name: ansible.com 49 | port: 5080 50 | priority: 10 51 | target: service1.ansible.com 52 | weight: 10 53 | comment: this is a test comment 54 | state: present 55 | provider: "{{ nios_provider }}" 56 | register: srv_record_update1 57 | 58 | - name: Add a comment to an existing srv record 59 | infoblox.nios_modules.nios_srv_record: 60 | name: ansible.com 61 | port: 5080 62 | priority: 10 63 | target: service1.ansible.com 64 | weight: 10 65 | comment: this is a test comment 66 | state: present 67 | provider: "{{ nios_provider }}" 68 | register: srv_record_update2 69 | 70 | - name: Remove a srv record from the system 71 | infoblox.nios_modules.nios_srv_record: 72 | name: ansible.com 73 | port: 5080 74 | priority: 10 75 | target: service1.ansible.com 76 | weight: 10 77 | state: absent 78 | provider: "{{ nios_provider }}" 79 | register: srv_record_delete1 80 | 81 | - name: Remove a srv record from the system 82 | infoblox.nios_modules.nios_srv_record: 83 | name: ansible.com 84 | port: 5080 85 | priority: 10 86 | target: service1.ansible.com 87 | weight: 10 88 | state: absent 89 | provider: "{{ nios_provider }}" 90 | register: srv_record_delete2 91 | 92 | - name: Verify idempotence and changes of SRV record operations 93 | ansible.builtin.assert: 94 | that: 95 | - srv_record_create1.changed 96 | - not srv_record_create2.changed 97 | - srv_record_update1.changed 98 | - not srv_record_update2.changed 99 | - srv_record_delete1.changed 100 | - not srv_record_delete2.changed 101 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_txt_record/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_txt_record/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_txt_record/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_txt_record/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include TXT record idempotence tests 3 | ansible.builtin.include_tasks: nios_txt_record_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_txt_record/tasks/nios_txt_record_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup the parent object 3 | infoblox.nios_modules.nios_zone: 4 | name: ansible.com 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Create the parent object 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible.com 11 | state: present 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Cleanup txt record 15 | infoblox.nios_modules.nios_txt_record: 16 | name: txt.ansible.com 17 | text: mytext 18 | state: absent 19 | provider: "{{ nios_provider }}" 20 | 21 | - name: Create txt record 22 | infoblox.nios_modules.nios_txt_record: 23 | name: txt.ansible.com 24 | text: mytext 25 | state: present 26 | provider: "{{ nios_provider }}" 27 | register: txt_create1 28 | 29 | - name: Create txt record 30 | infoblox.nios_modules.nios_txt_record: 31 | name: txt.ansible.com 32 | text: mytext 33 | state: present 34 | provider: "{{ nios_provider }}" 35 | register: txt_create2 36 | 37 | - name: Assert TXT record creation idempotence 38 | ansible.builtin.assert: 39 | that: 40 | - txt_create1.changed 41 | - not txt_create2.changed 42 | 43 | - name: Add a comment to an existing txt record 44 | infoblox.nios_modules.nios_txt_record: 45 | name: txt.ansible.com 46 | text: mytext 47 | state: present 48 | comment: mycomment 49 | provider: "{{ nios_provider }}" 50 | register: txt_update1 51 | 52 | - name: Add a comment to an existing txt record 53 | infoblox.nios_modules.nios_txt_record: 54 | name: txt.ansible.com 55 | text: mytext 56 | state: present 57 | comment: mycomment 58 | provider: "{{ nios_provider }}" 59 | register: txt_update2 60 | 61 | - name: Remove a txt record from the system 62 | infoblox.nios_modules.nios_txt_record: 63 | name: txt.ansible.com 64 | text: mytext 65 | state: absent 66 | provider: "{{ nios_provider }}" 67 | register: txt_delete1 68 | 69 | - name: Remove a txt record from the system 70 | infoblox.nios_modules.nios_txt_record: 71 | name: txt.ansible.com 72 | text: mytext 73 | state: absent 74 | provider: "{{ nios_provider }}" 75 | register: txt_delete2 76 | 77 | - name: Verify idempotence and changes of TXT record operations 78 | ansible.builtin.assert: 79 | that: 80 | - txt_create1.changed 81 | - not txt_create2.changed 82 | - txt_update1.changed 83 | - not txt_update2.changed 84 | - txt_delete1.changed 85 | - not txt_delete2.changed 86 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_vlan/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_vlan/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_vlan/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_vlan/tasks/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include idempotence tasks for vlan 3 | ansible.builtin.include_tasks: nios_vlan_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_vlan/tasks/nios_vlan_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup VLAN 3 | nios_vlan: 4 | name: ansible-vlan 5 | id: 10 6 | parent: default 7 | state: absent 8 | provider: "{{ nios_provider }}" 9 | 10 | - name: Configure a VLAN on the system 11 | infoblox.nios_modules.nios_vlan: 12 | name: ansible-vlan 13 | id: 10 14 | parent: default 15 | comment: 'this is an example comment' 16 | contact: 'example@email.com' 17 | department: 'IT' 18 | description: 'This is an example VLAN' 19 | reserved: true 20 | state: present 21 | provider: "{{ nios_provider }}" 22 | register: vlan_create1 23 | 24 | - name: Configure another VLAN on the system 25 | infoblox.nios_modules.nios_vlan: 26 | name: ansible-vlan 27 | id: 10 28 | comment: 'this is an example comment' 29 | parent: default 30 | contact: 'example@email.com' 31 | department: 'IT' 32 | description: 'This is an example VLAN' 33 | reserved: true 34 | state: present 35 | provider: "{{ nios_provider }}" 36 | register: vlan_create2 37 | 38 | - name: Update the comment and ext attributes for an existing VLAN 39 | infoblox.nios_modules.nios_vlan: 40 | name: ansible-vlan 41 | id: 10 42 | parent: default 43 | contact: 'example@email.com' 44 | department: 'IT' 45 | description: 'This is an example VLAN' 46 | reserved: true 47 | comment: this is an example comment 48 | extattrs: 49 | Site: west-dc 50 | state: present 51 | provider: "{{ nios_provider }}" 52 | register: vlan_update1 53 | 54 | - name: Update again the comment and ext attributes for an existing VLAN 55 | infoblox.nios_modules.nios_vlan: 56 | name: ansible-vlan 57 | id: 10 58 | parent: default 59 | contact: 'example@email.com' 60 | department: 'IT' 61 | description: 'This is an example VLAN' 62 | reserved: true 63 | comment: this is an example comment 64 | extattrs: 65 | Site: west-dc 66 | state: present 67 | provider: "{{ nios_provider }}" 68 | register: vlan_update2 69 | 70 | - name: Remove the VLAN 71 | infoblox.nios_modules.nios_vlan: 72 | name: ansible-vlan 73 | id: 10 74 | parent: default 75 | state: absent 76 | provider: "{{ nios_provider }}" 77 | register: vlan_delete1 78 | 79 | - name: Remove again the VLAN 80 | infoblox.nios_modules.nios_vlan: 81 | name: ansible-vlan 82 | id: 10 83 | parent: default 84 | state: absent 85 | provider: "{{ nios_provider }}" 86 | register: vlan_delete2 87 | 88 | - name: Assert changes in VLAN 89 | ansible.builtin.assert: 90 | that: 91 | - vlan_create1.changed 92 | - not vlan_create2.changed 93 | - vlan_update1.changed 94 | - not vlan_update2.changed 95 | - vlan_delete1.changed 96 | - not vlan_delete2.changed 97 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_zone/aliases: -------------------------------------------------------------------------------- 1 | shippable/cloud/group1 2 | cloud/nios 3 | destructive 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_zone/defaults/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | testcase: "*" 3 | test_items: [] 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_zone/meta/main.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | dependencies: 3 | - prepare_nios_tests 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_zone/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include NIOS zone idempotence tests 3 | ansible.builtin.include_tasks: nios_zone_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/nios_zone/tasks/nios_zone_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Cleanup dns view instance 3 | infoblox.nios_modules.nios_dns_view: 4 | name: ansible-dns 5 | state: absent 6 | provider: "{{ nios_provider }}" 7 | 8 | - name: Cleanup test zone 9 | infoblox.nios_modules.nios_zone: 10 | name: ansible-dns 11 | state: absent 12 | provider: "{{ nios_provider }}" 13 | 14 | - name: Configure a zone on the system 15 | infoblox.nios_modules.nios_zone: 16 | name: ansible-dns 17 | state: present 18 | provider: "{{ nios_provider }}" 19 | register: zone_create1 20 | 21 | - name: Configure a zone on the system 22 | infoblox.nios_modules.nios_zone: 23 | name: ansible-dns 24 | state: present 25 | provider: "{{ nios_provider }}" 26 | register: zone_create2 27 | 28 | - name: Update the comment and ext attributes for an existing zone 29 | infoblox.nios_modules.nios_zone: 30 | name: ansible-dns 31 | comment: this is an example comment 32 | extattrs: 33 | Site: west-dc 34 | state: present 35 | provider: "{{ nios_provider }}" 36 | register: zone_update1 37 | 38 | - name: Update the comment and ext attributes for an existing zone 39 | infoblox.nios_modules.nios_zone: 40 | name: ansible-dns 41 | comment: this is an example comment 42 | extattrs: 43 | Site: west-dc 44 | state: present 45 | provider: "{{ nios_provider }}" 46 | register: zone_update2 47 | 48 | - name: Remove the dns zone 49 | infoblox.nios_modules.nios_zone: 50 | name: ansible-dns 51 | state: absent 52 | provider: "{{ nios_provider }}" 53 | register: zone_delete1 54 | 55 | - name: Remove the dns zone 56 | infoblox.nios_modules.nios_zone: 57 | name: ansible-dns 58 | state: absent 59 | provider: "{{ nios_provider }}" 60 | register: zone_delete2 61 | 62 | - name: Verify idempotence and changes of zone operations 63 | ansible.builtin.assert: 64 | that: 65 | - zone_create1.changed 66 | - not zone_create2.changed 67 | - zone_update1.changed 68 | - not zone_update2.changed 69 | - zone_delete1.changed 70 | - not zone_delete2.changed 71 | -------------------------------------------------------------------------------- /tests/integration/targets/prepare_nios_tests/tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Include idempotence tests for NIOS 3 | ansible.builtin.include_tasks: prepare_nios_tests_idempotence.yml 4 | -------------------------------------------------------------------------------- /tests/integration/targets/prepare_nios_tests/tasks/prepare_nios_tests_idempotence.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install infoblox-client using pip 3 | ansible.builtin.pip: 4 | name: infoblox-client 5 | -------------------------------------------------------------------------------- /tests/requirements.txt: -------------------------------------------------------------------------------- 1 | infoblox-client 2 | pytest 3 | pytest-xdist 4 | mock 5 | pytest-mock 6 | pytest-cov==2.8.0 7 | coverage==7.6.1 8 | pygobject 9 | launchpadlib 10 | -------------------------------------------------------------------------------- /tests/unit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/unit/__init__.py -------------------------------------------------------------------------------- /tests/unit/compat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/unit/compat/__init__.py -------------------------------------------------------------------------------- /tests/unit/compat/mock.py: -------------------------------------------------------------------------------- 1 | # (c) 2014, Toshio Kuratomi 2 | # 3 | # This file is part of Ansible 4 | # 5 | # Ansible is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # Ansible is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Ansible. If not, see . 17 | 18 | # Make coding more python3-ish 19 | from __future__ import (absolute_import, division, print_function) 20 | __metaclass__ = type 21 | 22 | ''' 23 | Compat module for Python3.x's unittest.mock module 24 | ''' 25 | import sys 26 | 27 | # Python 2.7 28 | 29 | # Note: Could use the pypi mock library on python3.x as well as python2.x. It 30 | # is the same as the python3 stdlib mock library 31 | 32 | try: 33 | # Allow wildcard import because we really do want to import all of mock's 34 | # symbols into this compat shim 35 | # pylint: disable=wildcard-import,unused-wildcard-import 36 | from unittest.mock import * 37 | except ImportError: 38 | # Python 2 39 | # pylint: disable=wildcard-import,unused-wildcard-import 40 | try: 41 | from mock import * 42 | except ImportError: 43 | print('You need the mock library installed on python2.x to run tests') 44 | 45 | 46 | # Prior to 3.4.4, mock_open cannot handle binary read_data 47 | if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): 48 | file_spec = None 49 | 50 | def _iterate_read_data(read_data): 51 | # Helper for mock_open: 52 | # Retrieve lines from read_data via a generator so that separate calls to 53 | # readline, read, and readlines are properly interleaved 54 | sep = b'\n' if isinstance(read_data, bytes) else '\n' 55 | data_as_list = [l + sep for l in read_data.split(sep)] 56 | 57 | if data_as_list[-1] == sep: 58 | # If the last line ended in a newline, the list comprehension will have an 59 | # extra entry that's just a newline. Remove this. 60 | data_as_list = data_as_list[:-1] 61 | else: 62 | # If there wasn't an extra newline by itself, then the file being 63 | # emulated doesn't have a newline to end the last line remove the 64 | # newline that our naive format() added 65 | data_as_list[-1] = data_as_list[-1][:-1] 66 | 67 | yield from data_as_list 68 | 69 | def mock_open(mock=None, read_data=''): 70 | """ 71 | A helper function to create a mock to replace the use of `open`. It works 72 | for `open` called directly or used as a context manager. 73 | The `mock` argument is the mock object to configure. If `None` (the 74 | default) then a `MagicMock` will be created for you, with the API limited 75 | to methods or attributes available on standard file handles. 76 | `read_data` is a string for the `read` methoddline`, and `readlines` of the 77 | file handle to return. This is an empty string by default. 78 | """ 79 | def _readlines_side_effect(*args, **kwargs): 80 | if handle.readlines.return_value is not None: 81 | return handle.readlines.return_value 82 | return list(_data) 83 | 84 | def _read_side_effect(*args, **kwargs): 85 | if handle.read.return_value is not None: 86 | return handle.read.return_value 87 | return type(read_data)().join(_data) 88 | 89 | def _readline_side_effect(): 90 | if handle.readline.return_value is not None: 91 | while True: 92 | yield handle.readline.return_value 93 | yield from _data 94 | 95 | global file_spec 96 | if file_spec is None: 97 | import _io 98 | file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) 99 | 100 | if mock is None: 101 | mock = MagicMock(name='open', spec=open) 102 | 103 | handle = MagicMock(spec=file_spec) 104 | handle.__enter__.return_value = handle 105 | 106 | _data = _iterate_read_data(read_data) 107 | 108 | handle.write.return_value = None 109 | handle.read.return_value = None 110 | handle.readline.return_value = None 111 | handle.readlines.return_value = None 112 | 113 | handle.read.side_effect = _read_side_effect 114 | handle.readline.side_effect = _readline_side_effect() 115 | handle.readlines.side_effect = _readlines_side_effect 116 | 117 | mock.return_value = handle 118 | return mock 119 | -------------------------------------------------------------------------------- /tests/unit/plugins/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/unit/plugins/__init__.py -------------------------------------------------------------------------------- /tests/unit/plugins/module_utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/unit/plugins/module_utils/__init__.py -------------------------------------------------------------------------------- /tests/unit/plugins/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/unit/plugins/modules/__init__.py -------------------------------------------------------------------------------- /tests/unit/plugins/modules/fixtures/nios_result.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infobloxopen/infoblox-ansible/dcd53cffb0b45a01a097f0d436c7ed19f13c2464/tests/unit/plugins/modules/fixtures/nios_result.txt -------------------------------------------------------------------------------- /tests/unit/plugins/modules/test_nios_module.py: -------------------------------------------------------------------------------- 1 | # (c) 2018 Red Hat Inc. 2 | # 3 | # This file is part of Ansible 4 | # 5 | # Ansible is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # Ansible is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with Ansible. If not, see . 17 | 18 | # Make coding more python3-ish 19 | from __future__ import (absolute_import, division, print_function) 20 | __metaclass__ = type 21 | 22 | import os 23 | import json 24 | 25 | from ansible_collections.infoblox.nios_modules.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase 26 | 27 | 28 | fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') 29 | fixture_data = {} 30 | 31 | 32 | def load_fixture(name): 33 | path = os.path.join(fixture_path, name) 34 | 35 | if path in fixture_data: 36 | return fixture_data[path] 37 | 38 | with open(path) as f: 39 | data = f.read() 40 | 41 | try: 42 | data = json.loads(data) 43 | except Exception: 44 | pass 45 | 46 | fixture_data[path] = data 47 | return data 48 | 49 | 50 | class TestNiosModule(ModuleTestCase): 51 | 52 | def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False): 53 | 54 | self.load_fixtures(commands) 55 | 56 | if failed: 57 | result = self.failed() 58 | self.assertTrue(result['failed'], result) 59 | else: 60 | result = self.changed(changed) 61 | self.assertEqual(result['changed'], changed, result) 62 | 63 | if commands is not None: 64 | if sort: 65 | self.assertEqual(sorted(commands), sorted(result['commands']), result['commands']) 66 | else: 67 | self.assertEqual(commands, result['commands'], result['commands']) 68 | 69 | return result 70 | 71 | def failed(self): 72 | with self.assertRaises(AnsibleFailJson) as exc: 73 | self.module.main() 74 | 75 | result = exc.exception.args[0] 76 | self.assertTrue(result['failed'], result) 77 | return result 78 | 79 | def changed(self, changed=False): 80 | with self.assertRaises(AnsibleExitJson) as exc: 81 | self.module.main() 82 | 83 | result = exc.exception.args[0] 84 | self.assertEqual(result['changed'], changed, result) 85 | return result 86 | 87 | def load_fixtures(self, commands=None): 88 | pass 89 | -------------------------------------------------------------------------------- /tests/unit/plugins/modules/utils.py: -------------------------------------------------------------------------------- 1 | # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 2 | 3 | from __future__ import (absolute_import, division, print_function) 4 | __metaclass__ = type 5 | 6 | import json 7 | try: 8 | from ansible_collections.community.general.tests.unit.compat import unittest 9 | except ImportError: 10 | import unittest 11 | from ansible_collections.community.general.tests.unit.compat.mock import patch 12 | from ansible.module_utils import basic 13 | from ansible.module_utils.common.text.converters import to_bytes 14 | 15 | 16 | def set_module_args(args): 17 | if '_ansible_remote_tmp' not in args: 18 | args['_ansible_remote_tmp'] = '/tmp' 19 | if '_ansible_keep_remote_files' not in args: 20 | args['_ansible_keep_remote_files'] = False 21 | 22 | args = json.dumps({'ANSIBLE_MODULE_ARGS': args}) 23 | basic._ANSIBLE_ARGS = to_bytes(args) 24 | 25 | 26 | class AnsibleExitJson(Exception): 27 | pass 28 | 29 | 30 | class AnsibleFailJson(Exception): 31 | pass 32 | 33 | 34 | def exit_json(*args, **kwargs): 35 | if 'changed' not in kwargs: 36 | kwargs['changed'] = False 37 | raise AnsibleExitJson(kwargs) 38 | 39 | 40 | def fail_json(*args, **kwargs): 41 | kwargs['failed'] = True 42 | raise AnsibleFailJson(kwargs) 43 | 44 | 45 | class ModuleTestCase(unittest.TestCase): 46 | 47 | def setUp(self): 48 | self.mock_module = patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json) 49 | self.mock_module.start() 50 | self.mock_sleep = patch('time.sleep') 51 | self.mock_sleep.start() 52 | set_module_args({}) 53 | self.addCleanup(self.mock_module.stop) 54 | self.addCleanup(self.mock_sleep.stop) 55 | -------------------------------------------------------------------------------- /tests/unit/requirements.txt: -------------------------------------------------------------------------------- 1 | infoblox-client 2 | pytest 3 | pytest-forked 4 | pytest-xdist 5 | mock 6 | pytest-mock 7 | pytest-cov 8 | coverage==7.6.1 9 | --------------------------------------------------------------------------------