Advertisement
Guest User

Untitled

a guest
Feb 28th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. - name: Check DVS portgroup from vCenter and allocate IP address from EPG description
  2. hosts: localhost
  3. connection: local
  4. gather_facts: no
  5. vars:
  6. nios_provider:
  7. host: "dns1"
  8. username: ""
  9. password: ""
  10.  
  11. tasks:
  12. - name: Find unused IP address from EPG
  13. local_action: command sh /free.sh "{{ item }}"
  14. 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"
  15. register: dvs_output
  16.  
  17. - name: The IP
  18. debug: msg={{ dvs_output.results | map(attribute='stdout_lines') | list }}
  19. # debug: msg={{ dvs_output }}
  20. register: ip_dns
  21.  
  22. - name: return next available IP address for network {{ ip_dns }}
  23. set_fact:
  24. ipaddr: "{{ lookup('nios_next_ip', '{{ item }}', num=10, provider=nios_provider) }}"
  25. with_items: "{{ ip_dns.msg }}"
  26. ignore_errors: true
  27. register: lookup
  28.  
  29. PLAY [Check DVS portgroup from vCenter and allocate IP address from EPG description] ***********************************************************************************************************************
  30.  
  31. TASK [Find unused IP address from EPG] *********************************************************************************************************************************************************************
  32. 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)
  33.  
  34. TASK [The IP] **********************************************************************************************************************************************************************************************
  35. ok: [localhost] => {
  36. "msg": [
  37. [
  38. "11.25.2.0",
  39. "11.25.3.0"
  40. ]
  41. ]
  42. }
  43.  
  44. TASK [return next available IP address for network {'msg': [[u'11.25.2.0', u'11.25.3.0']], 'failed': False, 'changed': False}] ***************************************************************************
  45.  
  46. ok: [localhost] => (item=11.25.2.0)
  47. 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"}
  48. ...ignoring
  49.  
  50. TASK [Debug IP] ********************************************************************************************************************************************************************************************
  51. 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"}
  52.  
  53. PLAY RECAP *************************************************************************************************************************************************************************************************
  54. localhost : ok=3 changed=1 unreachable=0 failed=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement