How to respond to prompts with pywinrm / Ansible when using win_chocolatey?

How to respond to prompts with pywinrm / Ansible when using win_chocolatey? I am installing the android-sdk kit / module with chocolatey and get prompted to accept the license (y/n), but have no way to use the expect module with windows unless I am mistaken? Thanks in advance!

John

Hi Johnson

License is accepted implicitly when you use chocolatey. You can install android sdk as follows. Please let me know if I am missing something

[ansible@ansibleserver playbooks]$ cat chocolatey.yml

  • hosts: ansibleclient
    tasks:
  • name: Install android studio
    win_chocolatey:
    name: androidstudio
    state: present

[ansible@ansibleserver playbooks]$ ansible-playbook chocolatey.yml

PLAY [ansibleclient] *************************************************************************************

TASK [Gathering Facts] *****************************************************************************************
ok: [ansibleclient]

TASK [Install android studio] **********************************************************************************
changed: [ansibleclient]

PLAY RECAP *****************************************************************************************************
ansibleclient : ok=2 changed=1 unreachable=0 failed=0

[ansible@ansibleserver playbooks]$

Yep, win_chocolatey automatically adds the -y argument when calling choco.exe so it shouldn’t be freezing on the license prompt.

Thank you Jordan!