Finally able to connect to the windows guest after doing some setting
change in the WinRM inside the guest but 'win_partition' is creating a new
partition instead of extending one:
# cat ../inventory
[windows]
xxx.xxx.xxx.xxx
[windows:vars]
ansible_connection=winrm
ansible_user=Administrator
ansible_password=xxxxxxxxxx
ansible_winrm_transport=basic
ansible_winrm_server_cert_validation=ignore
ansible_port=5985
# cat disk.yaml
---
- name: Extend the C drive to the max space
hosts: "{{ target }}"
gather_facts: false
connection: winrm
tasks:
- name: Disk extension
win_partition:
state: present
partition_size: -1
partition_number: 0
disk_number: 0
# ansible-playbook -i ../inventory -e target=windows disk.yaml
PLAY [Extend the C drive to the max space]
***************************************************************************************************************************************************************************************************************
TASK [Disk extension]
***********************************************************************************************************************************************************************************************************************************
changed: [xxx.xxx.xxx.xxx]
PLAY RECAP
***********************************************************************************************************************************************************************************************************************************************
xxx.xxx.xxx.xxx : ok=1 changed=1 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
On Wednesday, July 15, 2020 at 1:55:48 PM UTC+5:30 [email protected]
wrote:
> u001b[91munexpected token '\u0000', expected 'begin', 'process', 'end',
> or\n\u001b[96m | \u001b[91m'dynamicparam'.\n\u001b[0m\n",
> "module_stdout": "", "msg": "MODULE
>
> Answer is unexpected tokens
>
> On Wed, 15 Jul 2020, 11:04 Udayendu kar, <[email protected]> wrote:
>
>> Disk resize code:
>>
>> ```
>> - name: Extend the C drive to the max space
>> win_partition:
>> partition_size: -1
>> partition_number: 0
>> disk_number: 0
>> ```
>>
>> Error message:
>>
>> ```
>> TASK [Extend the C drive to the max space]
>> *******************************************************************************************************************************************************************************************************************************************
>>
>> task path: /root/Windows/win-deploy.yaml:70 <127.0.0.1> ESTABLISH LOCAL
>> CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep
>> 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
>> /root/.ansible/tmp `"&& mkdir
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737 &&
>> echo ansible-tmp-1594746664.821915-2548-136259556554737="` echo
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737 `" )
>> && sleep 0' Using module file
>> /usr/local/lib/python3.8/dist-packages/ansible/modules/windows/win_partition.ps1
>>
>> <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-2331o41jvcot/tmp54wxtp0v
>> TO
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
>>
>> <127.0.0.1> EXEC /bin/sh -c 'chmod u+x
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
>>
>> && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'powershell
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1
>>
>> && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r
>> /root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/ >
>> /dev/null 2>&1 && sleep 0' fatal: [localhost]: FAILED! => { "changed":
>> false, "module_stderr": "\u001b[91mParserError:
>> \u001b[0m/root/.ansible/tmp/ansible-tmp-1594746664.821915-2548-136259556554737/AnsiballZ_win_partition.ps1:151\n\u001b[96mLine
>>
>> |\n\u001b[96m 151 | \u001b[0m
>> \u001b[96m\u0000\u001b[0m\u0000\u0000\u0000{\"module_entry\":
>> \"IyFwb3dlcnNoZWxsCgojIENvcHlyaWdodDogKGMpIDIwMTg …\n\u001b[96m |
>> \u001b[91m ~\n\u001b[91m\u001b[96m | \u001b[91munexpected token '\u0000',
>> expected 'begin', 'process', 'end', or\n\u001b[96m |
>> \u001b[91m'dynamicparam'.\n\u001b[0m\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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/4304d693-9447-4a4b-9018-61fd2438dc82n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/4304d693-9447-4a4b-9018-61fd2438dc82n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c737fa19-9225-4fca-9b2f-7d36c3d7662bn%40googlegroups.com.