Hi Rob, Maybe you could try this structure in your playbook file:
--- > - hosts: windows > tasks: > - name: install > win_chocolatey: > package: notepadplusplus > state: present > # Install git > - win_chocolatey: > package: git Hope that helps. On Tue, Dec 16, 2014 at 2:03 PM, Rob White <[email protected]> wrote: > > Nope, doesn't work. > > My file structure is: > > windows_playbook.yml > group_vars/windows > inventory/win > > My playbook: > --- > - name: Configure instance > hosts: windows > gather_facts: true > tasks: > - name: Install common packages from chocolatey > win_chocolatey: package=notepadplusplus state=present > > > > group_vars/windows has: > > ansible_ssh_user: administrator > ansible_ssh_pass: hidden > ansible_ssh_port: 5986 > ansible_connection: winrm > > inventory/win is simply: > > [windows] > 1.2.3.4 > > Output is always: > > ERROR: win_chocolatey is not a legal parameter in an Ansible task or > handler > > I've tried specifying variables at the command line. I.e. > > ansible-playbook hosts_windows.yml -i inventories/windows -u administrator > -k -c winrm > > It asks for the password then fails with the same error. > > Again, this command works fine: > > ansible -v windows -i inventories/windows -m win_chocolatey -c winrm -u > administrator -k -a 'package=notepadplusplus' > > > Any further suggestions welcome :) > > > On Tuesday, 9 December 2014 16:14:18 UTC+11, Chris Church wrote: >> >> Trying using ansible-playbook with -c winrm, or add >> ansible_connection=winrm to your inventory for Windows hosts. >> >> Ansible will only find PowerShell modules when using the winrm connection. >> >> >> On Mon, Dec 8, 2014 at 9:40 PM, Rob White <[email protected]> wrote: >> >>> # Install common packages >>> - name: Install common packages from chocolatey >>> win_chocolatey: >>> package: notepadplusplus >>> state: present >>> showlog: true >>> >>> On Tuesday, 9 December 2014 11:26:17 UTC+11, Chris Church wrote: >>>> >>>> Could you paste the task from your playbook that's causing the error? >>>> >>>> >>>> On Mon, Dec 8, 2014 at 12:47 AM, Rob White <[email protected]> wrote: >>>> >>>>> I'm having trouble with win_chocolatey module in a playbook. >>>>> >>>>> I upgraded from 1.7 to 1.9 and then ran the following successfully: >>>>> >>>>> ansible windows -i inventories/windows -m win_chocolatey -c winrm -u >>>>>> administrator -k -a 'package=notepadplusplus' >>>>>> SSH password: >>>>>> 1.2.3.4 | success >> { >>>>>> "changed": true, >>>>>> "chocolatey command": "C:\\ProgramData\\chocolatey\\bin\\choco.exe >>>>>> install notepadplusplus -source https://chocolatey.org/api/v2/", >>>>>> "chocolatey_success": "true" >>>>> >>>>> } >>>>> >>>>> >>>>> So then I added to a playbook as per the documentation but I get the >>>>> following error: >>>>> >>>>> ansible-playbook hosts_windows.yml -i inventories/windows >>>>>> ERROR: win_chocolatey is not a legal parameter in an Ansible task or >>>>>> handler >>>>> >>>>> >>>>> Why would ansible see the module, but ansible-playbook fail? >>>>> >>>>> -- >>>>> 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 post to this group, send email to [email protected]. >>>>> To view this discussion on the web visit https://groups.google.com/d/ >>>>> msgid/ansible-project/ca1815cc-565f-4bd7-8492-897dc382b66a% >>>>> 40googlegroups.com >>>>> <https://groups.google.com/d/msgid/ansible-project/ca1815cc-565f-4bd7-8492-897dc382b66a%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> 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 post to this group, send email to [email protected]. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/ansible-project/fff1cfe4-3eb1-4e16-ab07- >>> f688e6c6d17f%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/fff1cfe4-3eb1-4e16-ab07-f688e6c6d17f%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/mUAVtS3n-cw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/ef7bf334-855e-4e85-ba2a-641c0c47b609%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/ef7bf334-855e-4e85-ba2a-641c0c47b609%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOYwOt%2BufKDFpEFiWQc6R2_GcLan%2BqZuP1Nqi8OytqaHuvXHiA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
