Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: Check DVS portgroup from vCenter and allocate IP address from EPG description
- hosts: localhost
- connection: local
- gather_facts: no
- vars:
- nios_provider:
- host: "dns1"
- username: ""
- password: ""
- tasks:
- - name: Find unused IP address from EPG
- local_action: command sh /free.sh "{{ item }}"
- with_items: "DM-SNAP (VLAN-869) in DM AMZ, IP: 11.25.2.0/24 BD: BD-DH-VLAN-869 BD: BD_AZX_NO1, IP: 11.25.3.0/24"
- register: dvs_output
- - name: The IP
- debug: msg={{ dvs_output.results | map(attribute='stdout_lines') | list }}
- # debug: msg={{ dvs_output }}
- register: ip_dns
- - name: return next available IP address for network {{ ip_dns }}
- set_fact:
- ipaddr: "{{ lookup('nios_next_ip', '{{ item }}', num=10, provider=nios_provider) }}"
- with_items: "{{ ip_dns.msg }}"
- ignore_errors: true
- register: lookup
- PLAY [Check DVS portgroup from vCenter and allocate IP address from EPG description] ***********************************************************************************************************************
- TASK [Find unused IP address from EPG] *********************************************************************************************************************************************************************
- changed: [localhost -> localhost] => (item=DM-SNAP (VLAN-869) in DM AMZ, IP: 11.25.2.0/24 BD: BD-DH-VLAN-869 BD: BD_AZX_NO1, IP: 11.25.3.0/24)
- TASK [The IP] **********************************************************************************************************************************************************************************************
- ok: [localhost] => {
- "msg": [
- [
- "11.25.2.0",
- "11.25.3.0"
- ]
- ]
- }
- TASK [return next available IP address for network {'msg': [[u'11.25.2.0', u'11.25.3.0']], 'failed': False, 'changed': False}] ***************************************************************************
- ok: [localhost] => (item=11.25.2.0)
- fatal: [localhost]: FAILED! => {"msg": "Unexpected templating type error occurred on ({{ lookup('nios_next_ip', '{{ item }}', num=10, provider=nios_provider) }}): 'dict' object is not callable"}
- ...ignoring
- TASK [Debug IP] ********************************************************************************************************************************************************************************************
- fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'ansible_facts'nnThe error appears to have been in '/etc/ansible/playbooks/vmware/dev/test_allocate.yml': line 37, column 5, but maynbe elsewhere in the file depending on the exact syntax problem.nnThe offending line appears to be:nnn - name: Debug IPn ^ heren"}
- PLAY RECAP *************************************************************************************************************************************************************************************************
- localhost : ok=3 changed=1 unreachable=0 failed=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement