Advertisement
Guest User

Untitled

a guest
May 2nd, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. - name: execute powershell to get disk space
  2. win_command: "win_command: 'powershell.exe Get-PSDrive "{{ tmplocation[:1] | quote }}" | Select-Object Free | ConvertTo-Json"
  3. register: getpsdrive
  4.  
  5. - name: Register freediskspace as a fact
  6. set_fact:
  7. freediskspace: "{{ (getpsdrive.stdout | from_json).Free // 1073741824 }}"
  8.  
  9. - name: Create directory structure
  10. tags: basic
  11. win_file:
  12. path: "{{ tmplocation }}"
  13. state: directory
  14.  
  15. - name: Download software
  16. win_get_url:
  17. url: "{{ item.value.url }}"
  18. dest: "{{ item.value.dst }}"
  19. force: no
  20. url_username: "{{ afilerepo_user }}"
  21. url_password: "{{ afilerepo_password }}"
  22. loop: "{{ lookup('dict', software,wantlist=True) }}"
  23. when: freediskspace | int > 5
  24.  
  25.  
  26. - name: execute powershell to get disk space
  27. win_command: "win_command: 'powershell.exe Get-PSDrive "{{ tmplocation[:1] | quote }}" | Select-Object Free | ConvertTo-Json"
  28. register: getpsdrive
  29.  
  30. - name: Register freediskspace as a fact
  31. set_fact:
  32. freediskspace: "{{ (getpsdrive.stdout | from_json).Free // 1073741824 }}"
  33.  
  34. - name: Create directory structure
  35. tags: basic
  36. win_file:
  37. path: "{{ tmplocation }}"
  38. state: directory
  39.  
  40. - name: Download software
  41. win_get_url:
  42. url: "{{ item.value.url }}"
  43. dest: "{{ item.value.dst }}"
  44. force: no
  45. url_username: "{{ afilerepo_user }}"
  46. url_password: "{{ afilerepo_password }}"
  47. loop: "{{ lookup('dict', software,wantlist=True) }}"
  48. when: freediskspace | int > 5
  49.  
  50. The error appears to have been in '/mnt/c/github/ansible-mdt/tasks/downloads.yml': line 2, column 16, but may
  51. be elsewhere in the file depending on the exact syntax problem.
  52.  
  53. The offending line appears to be:
  54.  
  55. - name: execute powershell to get disk space
  56. win_command: "win_command: 'powershell.exe Get-PSDrive "{{ tmplocation[:1] | quote }}" | Select-Object Free | ConvertTo-Json"
  57. ^ here
  58. We could be wrong, but this one looks like it might be an issue with
  59. missing quotes. Always quote template expression brackets when they
  60. start a value. For instance:
  61.  
  62. with_items:
  63. - {{ foo }}
  64.  
  65. Should be written as:
  66.  
  67. with_items:
  68. - "{{ foo }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement