| 1 | # Infoblox NIOS Modules for Ansible Collections |
| 2 | |
| 3 | Infoblox NIOS Modules for Ansible Collections enable the management of your NIOS objects through APIs. |
| 4 | |
| 5 | ## Description |
| 6 | Infoblox NIOS Modules for Ansible Collections facilitate the DNS and IPAM automation of |
| 7 | VM workloads that are deployed across multiple platforms. The `nios_modules` collection consists of modules and plug-ins required to manage the networks, |
| 8 | IP addresses, and DNS records in NIOS. The collection is hosted on Ansible Galaxy under `infoblox.nios_modules`. |
| 9 | |
| 10 | ### Modules Overview |
| 11 | |
| 12 | The `infoblox.nios_modules` collection has the following content: |
| 13 | |
| 14 | ##### Modules |
| 15 | |
| 16 | - `nios_a_record` – Configure Infoblox NIOS A records |
| 17 | - `nios_aaaa_record` – Configure Infoblox NIOS AAAA records |
| 18 | - `nios_adminuser` – Configure Infoblox NIOS Adminuser |
| 19 | - `nios_cname_record` – Configure Infoblox NIOS CNAME records |
| 20 | - `nios_dns_view` – Configure Infoblox NIOS DNS views |
| 21 | - `nios_dtc_lbdn` – Configure Infoblox NIOS DTC LBDN records |
| 22 | - `nios_dtc_monitor_http` – Configure Infoblox NIOS DTC HTTP monitors |
| 23 | - `nios_dtc_monitor_icmp` – Configure Infoblox NIOS DTC ICMP monitors |
| 24 | - `nios_dtc_monitor_pdp` – Configure Infoblox NIOS DTC PDP monitors |
| 25 | - `nios_dtc_monitor_sip` – Configure Infoblox NIOS DTC SIP monitors |
| 26 | - `nios_dtc_monitor_snmp` – Configure Infoblox NIOS DTC SNMP monitors |
| 27 | - `nios_dtc_monitor_tcp` – Configure Infoblox NIOS DTC TCP monitors |
| 28 | - `nios_dtc_pool` – Configure Infoblox NIOS DTC pools |
| 29 | - `nios_dtc_server` – Configure Infoblox NIOS DTC server records |
| 30 | - `nios_dtc_topology` – Configure Infoblox NIOS DTC topologies |
| 31 | - `nios_extensible_attribute` - Configure Infoblox NIOS extensible attributes |
| 32 | - `nios_fixed_address` – Configure Infoblox NIOS DHCP Fixed Address |
| 33 | - `nios_host_record` – Configure Infoblox NIOS host records |
| 34 | - `nios_member` – Configure Infoblox NIOS members |
| 35 | - `nios_mx_record` – Configure Infoblox NIOS MX records |
| 36 | - `nios_naptr_record` – Configure Infoblox NIOS NAPTR records |
| 37 | - `nios_network` – Configure Infoblox NIOS network object |
| 38 | - `nios_network_view` – Configure Infoblox NIOS network views |
| 39 | - `nios_nsgroup` – Configure Infoblox DNS Authoritative Name server Groups |
| 40 | - `nios_nsgroup_delegation` – Configure Infoblox DNS Delegation Name server Groups |
| 41 | - `nios_nsgroup_forwardingmember` – Configure Infoblox DNS Forwarding Member Name server Groups |
| 42 | - `nios_nsgroup_forwardstubserver` – Configure Infoblox DNS Forward/Stub Server Name server Groups |
| 43 | - `nios_nsgroup_stubmember` – Configure Infoblox DNS Stub Member Name server Groups |
| 44 | - `nios_ptr_record` – Configure Infoblox NIOS PTR records |
| 45 | - `nios_range` - Configure Infoblox NIOS Network Range object |
| 46 | - `nios_restartservices` - Controlled restart of Infoblox NIOS services |
| 47 | - `nios_srv_record` – Configure Infoblox NIOS SRV records |
| 48 | - `nios_txt_record` – Configure Infoblox NIOS txt records |
| 49 | - `nios_vlan` – Configure Infoblox NIOS vlan |
| 50 | - `nios_zone` – Configure Infoblox NIOS DNS zones |
| 51 | |
| 52 | #### Plugins |
| 53 | |
| 54 | - `nios_inventory`: List all the hosts with records created in NIOS |
| 55 | - `nios_lookup`: Look up queries for NIOS database objects |
| 56 | - `nios_next_ip`: Return the next available IP address for a network |
| 57 | - `nios_next_network`: Return the next available network addresses |
| 58 | for a given network CIDR |
| 59 | - `nios_next_vlan_id`: Return the next available VLAN IDs for a given VLAN View/Range. |
| 60 | |
| 61 | ## Requirements |
| 62 | |
| 63 | - Python version 3.10 or later |
| 64 | - Ansible Core version 2.16 or later |
| 65 | - NIOS 8.6.x and 9.0.x |
| 66 | - Infoblox WAPI version 2.12.3 or later |
| 67 | - Python module infoblox-client version 0.6.2 |
| 68 | |
| 69 | Install the infoblox-client WAPI package. To install, run the following command: |
| 70 | ```shell |
| 71 | pip install infoblox-client==0.6.2 |
| 72 | ``` |
| 73 | |
| 74 | ## Installation |
| 75 | |
| 76 | To install nios module with the Ansible Galaxy command-line tool: |
| 77 | |
| 78 | ``` |
| 79 | ansible-galaxy collection install infoblox.nios_modules |
| 80 | ``` |
| 81 | |
| 82 | You can also include it in a requirements.yml file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: |
| 83 | |
| 84 | ```yaml |
| 85 | collections: |
| 86 | - name: infoblox.nios_modules |
| 87 | ``` |
| 88 | |
| 89 | Note that if you install any collection from Ansible Galaxy, they will not be upgraded automatically when you upgrade the Ansible package. |
| 90 | To upgrade the collection to the latest available version, run the following command: |
| 91 | |
| 92 | ``` |
| 93 | ansible-galaxy collection install infoblox.nios_modules --upgrade |
| 94 | ``` |
| 95 | |
| 96 | You can also install a specific version of the collection. For example, due to an issue of the latest version, |
| 97 | if you need to downgrade the collection to a prior version, use the following command to install the specific version: |
| 98 | |
| 99 | ``` |
| 100 | ansible-galaxy collection install infoblox.nios_modules:==<version> |
| 101 | ``` |
| 102 | |
| 103 | See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details. |
| 104 | |
| 105 | ### Installation from GitHub |
| 106 | |
| 107 | - Install the collection directly from the [GitHub](https://github.com/infobloxopen/infoblox-ansible) repository using the latest commit on the master branch: |
| 108 | ```shell |
| 109 | $ ansible-galaxy collection install git+https://github.com/infobloxopen/infoblox-ansible.git,master |
| 110 | ``` |
| 111 | |
| 112 | - For offline installation on the Ansible control machine, follow the below steps to clone the git repository and install from the repository: |
| 113 | |
| 114 | 1. **Clone the repo:** |
| 115 | ``` |
| 116 | $ git clone https://github.com/infobloxopen/infoblox-ansible.git |
| 117 | ``` |
| 118 | |
| 119 | 2. **Build the collection:** |
| 120 | To build a collection, run the following command from inside the root directory of the collection: |
| 121 | ``` |
| 122 | $ ansible-galaxy collection build |
| 123 | ``` |
| 124 | This creates a tarball of the built collection in the current directory. |
| 125 | |
| 126 | 3. **Install the collection:** |
| 127 | ``` |
| 128 | $ ansible-galaxy collection install infoblox-nios_modules-<version>.tar.gz -p ./collections |
| 129 | ``` |
| 130 | |
| 131 | Please refer to our Ansible [deployment guide](https://docs.infoblox.com/space/niosmodulesansible) for more details. |
| 132 | |
| 133 | ## Use Cases |
| 134 | |
| 135 | |
| 136 | ### 1. Automated DNS Record Management |
| 137 | |
| 138 | **Description:** Automatically create, update, and delete DNS records in Infoblox NIOS based on changes in your infrastructure. |
| 139 | |
| 140 | **Example:** |
| 141 | ```yaml |
| 142 | - name: Create a DNS A record |
| 143 | infoblox.nios_modules.nios_a_record: |
| 144 | name: "host.example.com" |
| 145 | ipv4addr: "192.168.1.10" |
| 146 | state: "present" |
| 147 | ``` |
| 148 | |
| 149 | ### 2. IP Address Allocation |
| 150 | |
| 151 | **Description:** Dynamically allocate and manage IP addresses for virtual machines and other devices in your network. |
| 152 | |
| 153 | **Example:** |
| 154 | ```yaml |
| 155 | - name: Allocate an IP address |
| 156 | infoblox.nios_modules.nios_fixed_address: |
| 157 | ipv4addr: "192.168.1.20" |
| 158 | mac: "00:50:56:00:00:01" |
| 159 | state: "present" |
| 160 | ``` |
| 161 | |
| 162 | ### 3. Network Management |
| 163 | |
| 164 | **Description:** Create and manage network segments and subnets within Infoblox NIOS. |
| 165 | |
| 166 | **Example:** |
| 167 | ```yaml |
| 168 | - name: Create a network |
| 169 | infoblox.nios_modules.nios_network: |
| 170 | network: "192.168.2.0/24" |
| 171 | comment: "Development network" |
| 172 | state: "present" |
| 173 | ``` |
| 174 | |
| 175 | ### 4. DHCP Scope Management |
| 176 | |
| 177 | **Description:** Manage DHCP scopes to ensure efficient IP address distribution and avoid conflicts. |
| 178 | |
| 179 | **Example:** |
| 180 | ```yaml |
| 181 | - name: Create a DHCP range |
| 182 | infoblox.nios_modules.nios_range: |
| 183 | network: "192.168.3.0/24" |
| 184 | start_addr: "192.168.3.10" |
| 185 | end_addr: "192.168.3.100" |
| 186 | state: "present" |
| 187 | ``` |
| 188 | |
| 189 | ### 5. DTC Object Management |
| 190 | |
| 191 | **Description:** Manage DNS Traffic Control (DTC) objects to optimize traffic distribution and ensure high availability. |
| 192 | |
| 193 | **Example:** |
| 194 | ```yaml |
| 195 | - name: Create a DTC Pool |
| 196 | infoblox.nios_modules.nios_dtc_pool: |
| 197 | name: "example_pool" |
| 198 | lb_method: "round_robin" |
| 199 | state: "present" |
| 200 | ``` |
| 201 | |
| 202 | ### 6. Lookups |
| 203 | |
| 204 | **Description:** Perform lookups to retrieve information about existing NIOS objects. |
| 205 | |
| 206 | **Example:** |
| 207 | ```yaml |
| 208 | - name: fetch the default dns view |
| 209 | ansible.builtin.set_fact: |
| 210 | dns_views: "{{ lookup('infoblox.nios_modules.nios_lookup', 'view', filter={'name': 'default'}, |
| 211 | provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" |
| 212 | ``` |
| 213 | |
| 214 | ### 7. Next Available Functionality |
| 215 | |
| 216 | **Description:** Retrieve the next available IP address or network in a specified range or network. |
| 217 | |
| 218 | **Example:** |
| 219 | ```yaml |
| 220 | - name: return next available IP address for network 192.168.10.0/24 |
| 221 | ansible.builtin.set_fact: |
| 222 | ipaddr: "{{ lookup('infoblox.nios_modules.nios_next_ip', '192.168.10.0/24', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" |
| 223 | ``` |
| 224 | |
| 225 | For more detailed examples and playbooks, refer to the `playbooks` directory in the `infoblox-ansible` repository. |
| 226 | |
| 227 | |
| 228 | ## Testing |
| 229 | |
| 230 | The collection has been tested in the following environments: |
| 231 | |
| 232 | - **Operating Systems:** |
| 233 | - Ubuntu 20.04 LTS |
| 234 | - Mac |
| 235 | |
| 236 | - **Ansible Versions:** |
| 237 | - Ansible Core 2.16 |
| 238 | - Ansible Core 2.17 |
| 239 | - Ansible Core 2.18 |
| 240 | |
| 241 | - **NIOS Versions:** |
| 242 | - NIOS 8.6.x |
| 243 | - NIOS 9.0.x |
| 244 | |
| 245 | ### Known Exceptions and Workarounds |
| 246 | |
| 247 | - For detailed information on testing and performance, refer to the `tests` directory in the `infoblox-ansible` repository. |
| 248 | - The `use_dns_ea_inheritance` option for Host Records is compatible only with WAPI versions 2.12.3 or 2.13.4 and later. |
| 249 | - The `nios_dtc_lbdn` module supports both string and dictionary formats for `auth_zones`. When using dictionary format, both `fqdn` and optional `view` keys can be specified (e.g., `{"fqdn": "example.com", "view": "default"}`). When multiple zones with the same name exist in different views, you must use the dictionary format with view specification. |
| 250 | - When removing entries from the `auth_zones` list in `nios_dtc_lbdn` module, the module will detect this change and update the LBDN record accordingly. |
| 251 | |
| 252 | ## Contributing |
| 253 | |
| 254 | We welcome your contributions to Infoblox Nios Modules. See [CONTRIBUTING.md](https://github.com/infobloxopen/infoblox-ansible/blob/master/CONTRIBUTING.md) for more details. |
| 255 | |
| 256 | ## Support |
| 257 | |
| 258 | ### Supported Versions |
| 259 | |
| 260 | Infoblox NIOS Modules for Ansible Collections supports the following versions: |
| 261 | - **NIOS Versions:** 8.6.x and 9.0.x |
| 262 | - **Ansible Core Versions:** 2.16 and later |
| 263 | - **Python Versions:** 3.10 and later |
| 264 | |
| 265 | ### How to Get Support |
| 266 | |
| 267 | If you need assistance with the Infoblox NIOS Modules, you can get support through the following channels: |
| 268 | |
| 269 | - **GitHub Issues:** |
| 270 | - Submit your issues or requests for enhancements on the [GitHub Issues](https://github.com/infobloxopen/infoblox-ansible/issues) page. |
| 271 | |
| 272 | - **Infoblox Support:** |
| 273 | - For enterprise support, contact Infoblox Support through the [Infoblox Support Portal](https://support.infoblox.com). |
| 274 | |
| 275 | For any other inquiries, please refer to the [Infoblox Contact Page](https://www.infoblox.com/company/contact-us/). |
| 276 | |
| 277 | ## Release Notes and Roadmap |
| 278 | |
| 279 | For detailed information about the latest updates, new features, bug fixes, and improvements, please visit our [Changelog](https://github.com/infobloxopen/infoblox-ansible/blob/master/CHANGELOG.rst). |
| 280 | |
| 281 | ## Related Information |
| 282 | |
| 283 | For more detailed documentation and examples, refer to the following resources: |
| 284 | - Infoblox [NIOS modules](https://docs.ansible.com/ansible/latest/collections/infoblox/nios_modules/index.html) on Ansible documentation |
| 285 | - Infoblox [workspace](https://galaxy.ansible.com/ui/repo/published/infoblox/nios_modules) in Ansible Galaxy |
| 286 | - Infoblox Ansible [deployment guide](https://docs.infoblox.com/space/niosmodulesansible) |
| 287 | - [CONTRIBUTING.md](https://github.com/infobloxopen/infoblox-ansible/blob/master/CONTRIBUTING.md) for contribution guidelines |
| 288 | |
| 289 | ## License Information |
| 290 | |
| 291 | This code is published under `GPL v3.0` [COPYING](https://github.com/infobloxopen/infoblox-ansible/blob/master/COPYING) |
| 292 | |
| 293 | ## Issues or RFEs |
| 294 | |
| 295 | You can open an issue or request for enhancement [here](https://github.com/infobloxopen/infoblox-ansible/issues) |