I have a playbook that is doing two lookup for the next available Infoblox network subnet in two different networks. I set the facts and I'm trying to loop over the results of the two lookups. I print the results of the lookup so I can see I'm getting back what I expected. I think the issue is I'm trying to create the network from the lookup results with a single task. If I break it out into two different task one for each network returned from the lookup it fails. Its somehow related to the loop statement. I've changed the IPs so not to show our acutal IP space.
Here's my playbook: vars: verizon: 1.1.1.0/20 at_t: 1.1.2.0/20 - name: Return the next available Verizon IP subnet for network set_fact: verizon_pe_ce: "{{ lookup('nios_next_network', verizon, cidr=30, provider=cli_infoblox ) }}" delegate_to: localhost - name: Print the subnet debug: var: verizon_pe_ce - name: Return the next available at_t IP subnet for network set_fact: att_pe_ce: "{{ lookup('nios_next_network', at_t, cidr=30, provider=cli_infoblox ) }}" delegate_to: localhost - name: Print the subnet debug: var: att_pe_ce - name: configure a network ipv4 nios_network: network: "{{ item }}" comment: WAN ansible assignment extattrs: Network_Name: ansible_test_assignment Network_Environment: CLIENT_REMOTE Client_Site_#: "{{ client_num }}-{{ client_name }} - ({{ city }}, {{ state }})" CL_RTR_INT: [ "RTR A", "WAN Network _30" ] VRF_NAME: CL Network_Container: SNG state: present provider: "{{ cli_infoblox }}" loop: - verizon_pe_ce - att_pe_ce delegate_to: localhost This is the output from the lookups: TASK [Print the subnet] ********************************************************************************************************************************** task path: /automation/ansible/playbooks/infoblox/next_available_network.yml:28 ok: [10.x.x.x] => { "verizon_pe_ce": [ "1.1.1.36/30" ] } TASK [Print the subnet] ********************************************************************************************************************************** task path: /automation/ansible/playbooks/infoblox/next_available_network.yml:36 ok: [10.x.x.x] => { "att_pe_ce": [ "1.1.2.36/30" ] } The error is the same for both the verizon_pe_ce and the att_pe_ce. Here's the output related to the att_pe_ce. TypeError: 'NoneType' object is not iterable failed: [10.x.x.x] (item=att_pe_ce) => { "ansible_loop_var": "item", "changed": false, "item": "att_pe_ce", "module_stderr": "Traceback (most recent call last):\n File \"/home/e001gx/.ansible/tmp/ansible-tmp-1616159168.3519313-122151-53449377816842/AnsiballZ_nios_network.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/e001gx/.ansible/tmp/ansible-tmp-1616159168.3519313-122151-53449377816842/AnsiballZ_nios_network.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/e0013192gx/.ansible/tmp/ansible-tmp-1616159168.3519313-122151-53449377816842/AnsiballZ_nios_network.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.infoblox.nios_modules.plugins.modules.nios_network', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/opt/rh/rh-python36/root/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_nios_network_payload_5eez7968/ansible_nios_network_payload.zip/ansible_collections/infoblox/nios_modules/plugins/modules/nios_network.py\", line 302, in <module>\n File \"/tmp/ansible_nios_network_payload_5eez7968/ansible_nios_network_payload.zip/ansible_collections/infoblox/nios_modules/plugins/modules/nios_network.py\", line 290, in main\nTypeError: 'NoneType' object is not iterable\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/00c97ac1-01d7-4a0c-8d83-ad2722d2f92en%40googlegroups.com.