We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
win_chocolatey: Cannot install hotfixes (KB####) over WinRM
##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
 - Bug Report

##### COMPONENT NAME
<!--- Name of the module/plugin/task/feature -->
- `win_chocolatey`

##### ANSIBLE VERSION
<!--- Paste verbatim output from “ansible --version” between quotes below -->
```
ansible 2.3.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, May  5 2017, 21:21:54) [GCC 6.3.0]
```

##### CONFIGURATION
- Default

##### OS / ENVIRONMENT
<!---
Mention the OS you are running Ansible from, and the OS you are
managing, or say “N/A” for anything that is not platform-specific.
Also mention the specific version of what you are trying to control,
e.g. if this is a network bug the version of firmware on the network device.
-->
- Ansible on **Gentoo**
- Target system is **Windows via WinRM**

##### SUMMARY
[Microsoft does not support](https://support.microsoft.com/en-us/help/2773898/windows-update-standalone-installer-wusa-returns-0x5-error-access-deni) using WUSA over a WinRM connection. If WUSA.exe has a WinRM session for an ancestor, it will exit immediately with "Access denied."

Chocolatey packages that install Windows hotfixes (kb######) use WUSA to install the update after downloading it. If the Chocolatey command is running within a WinRM session, it encounters the same problem.

Special-casing win_chocolatey for names beginning with "kb" is no solution either; some Chocolatey packages depend on these hotfix packages, perhaps even indirectly.

This could be argued as a bug with the Chocolatey packages themselves, as there exists some condition under which installation will fail. However, I believe this is appropriate as an Ansible bug, because the `win_chocolatey` task cannot install hotfixes (or packages depending on them) at all.

##### STEPS TO REPRODUCE
<!---
For bugs, show exactly how to reproduce the problem, using a minimal test-case.
For new features, show how the feature would be used.
-->

<!--- Paste example playbooks or commands between quotes below -->
```yaml
- name: Demonstrate bug with installing hotfixes over WinRM
  hosts: all
  tasks:
    - name: Install Chocolatey
      raw: "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
    - name: Attempt to install KB3033929
      win_chocolatey: name=kb3033929
```

<!--- You can also paste gist.github.com links for larger files -->
Please see [this gist](https://gist.github.com/CFSworks/490cf68574739df11b9deaaee1fcaa67) if you would like to reproduce the bug in Vagrant.

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->
Hotfix package should install like any other Chocolatey package.

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes below -->
```
==> default: Running provisioner: ansible...
    default: Running ansible-playbook...

PLAY [Demonstrate bug with installing hotfixes over WinRM] *********************

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

TASK [Install Chocolatey] ******************************************************
changed: [default]

TASK [Attempt to install KB3033929] ********************************************
fatal: [default]: FAILED! => {"changed": false, "choco_error_cmd": "choco.exe install -dv -y kb3033929 -timeout 2700", "choco_error_log": null, "failed": true, "msg": "Error installing kb3033929", "rc": 5}
        to retry, use: --limit @/home/cfsworks/Desktop/winbug/playbook.retry

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

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lib/ansible/modules/windows/win_chocolatey.py`
Content:
```
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 
4 # (c) 2014, Trond Hindenes <trond@hindenes.com>
5 #
6 # This file is part of Ansible
7 #
8 # Ansible is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Ansible is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Ansible.  If not, see <http://www.gnu.org/licenses/>.
20 
21 # this is a windows documentation stub.  actual code lives in the .ps1
22 # file of the same name
23 
24 ANSIBLE_METADATA = {'metadata_version': '1.1',
25                     'status': ['preview'],
26                     'supported_by': 'community'}
27 
28 DOCUMENTATION = r'''
29 ---
30 module: win_chocolatey
31 version_added: "1.9"
32 short_description: Manage packages using chocolatey
33 description:
34     - Manage packages using Chocolatey (U(http://chocolatey.org/)).
35     - If Chocolatey is missing from the system, the module will install it.
36     - List of packages can be found at U(http://chocolatey.org/packages).
37 requirements:
38 - chocolatey >= 0.10.5 (will be upgraded if older)
39 options:
40   name:
41     description:
42       - Name of the package to be installed.
43       - This must be a single package name.
44     required: yes
45   state:
46     description:
47       - State of the package on the system.
48     choices:
49       - absent
50       - downgrade
51       - latest
52       - present
53       - reinstalled
54     default: present
55   force:
56     description:
57       - Forces install of the package (even if it already exists).
58       - Using C(force) will cause ansible to always report that a change was made.
59     type: bool
60     default: 'no'
61   upgrade:
62     description:
63       - If package is already installed it, try to upgrade to the latest version or to the specified version.
64       - As of Ansible v2.3 this is deprecated, set parameter C(state) to C(latest) for the same result.
65     type: bool
66     default: 'no'
67   version:
68     description:
69       - Specific version of the package to be installed.
70       - Ignored when C(state) is set to C(absent).
71   source:
72     description:
73       - Specify source rather than using default chocolatey repository.
74   install_args:
75     description:
76       - Arguments to pass to the native installer.
77     version_added: '2.1'
78   params:
79     description:
80       - Parameters to pass to the package
81     version_added: '2.1'
82   allow_empty_checksums:
83     description:
84       - Allow empty checksums to be used.
85     type: bool
86     default: 'no'
87     version_added: '2.2'
88   ignore_checksums:
89     description:
90       - Ignore checksums altogether.
91     type: bool
92     default: 'no'
93     version_added: '2.2'
94   ignore_dependencies:
95     description:
96       - Ignore dependencies, only install/upgrade the package itself.
97     type: bool
98     default: 'no'
99     version_added: '2.1'
100   timeout:
101     description:
102       - The time to allow chocolatey to finish before timing out.
103     default: 2700
104     version_added: '2.3'
105     aliases: [ execution_timeout ]
106   skip_scripts:
107     description:
108     - Do not run I(chocolateyInstall.ps1) or I(chocolateyUninstall.ps1) scripts.
109     type: bool
110     default: 'no'
111     version_added: '2.4'
112   proxy_url:
113     description:
114       - Proxy url used to install chocolatey and the package.
115     version_added: '2.4'
116   proxy_username:
117     description:
118       - Proxy username used to install chocolatey and the package.
119       - When dealing with a username with double quote characters C("), they
120         need to be escaped with C(\) beforehand. See examples for more details.
121     version_added: '2.4'
122   proxy_password:
123     description:
124       - Proxy password used to install chocolatey and the package.
125       - See notes in C(proxy_username) when dealing with double quotes in a
126         password.
127     version_added: '2.4'
128 notes:
129 - Provide the C(version) parameter value as a string (e.g. C('6.1')), otherwise it
130   is considered to be a floating-point number and depending on the locale could
131   become C(6,1), which will cause a failure.
132 - When using verbosity 2 or less (C(-vv)) the C(stdout) output will be restricted.
133 - When using verbosity 4 (C(-vvvv)) the C(stdout) output will be more verbose.
134 - When using verbosity 5 (C(-vvvvv)) the C(stdout) output will include debug output.
135 - This module will install or upgrade Chocolatey when needed.
136 author:
137 - Trond Hindenes (@trondhindenes)
138 - Peter Mounce (@petemounce)
139 - Pepe Barbe (@elventear)
140 - Adam Keech (@smadam813)
141 - Pierre Templier (@ptemplier)
142 '''
143 
144 # TODO:
145 # * Better parsing when a package has dependencies - currently fails
146 # * Time each item that is run
147 # * Support 'changed' with gems - would require shelling out to `gem list` first and parsing, kinda defeating the point of using chocolatey.
148 # * Version provided not as string might be translated to 6,6 depending on Locale (results in errors)
149 
150 EXAMPLES = r'''
151 - name: Install git
152   win_chocolatey:
153     name: git
154     state: present
155 
156 - name: Upgrade installed packages
157   win_chocolatey:
158     name: all
159     state: latest
160 
161 - name: Install notepadplusplus version 6.6
162   win_chocolatey:
163     name: notepadplusplus.install
164     version: '6.6'
165 
166 - name: Install git from specified repository
167   win_chocolatey:
168     name: git
169     source: https://someserver/api/v2/
170 
171 - name: Uninstall git
172   win_chocolatey:
173     name: git
174     state: absent
175 
176 - name: install multiple packages
177   win_chocolatey:
178     name: '{{ item }}'
179     state: absent
180   with_items:
181   - pscx
182   - windirstat
183 
184 - name: uninstall multiple packages
185   win_chocolatey:
186     name: '{{ item }}'
187     state: absent
188   with_items:
189   - pscx
190   - windirstat
191 
192 - name: Install curl using proxy
193   win_chocolatey:
194     name: curl
195     proxy_url: http://proxy-server:8080/
196     proxy_username: joe
197     proxy_password: p@ssw0rd
198 
199 - name: Install curl with proxy credentials that contain quotes
200   win_chocolatey:
201     name: curl
202     proxy_url: http://proxy-server:8080/
203     proxy_username: user with \"escaped\" double quotes
204     proxy_password: pass with \"escaped\" double quotes
205 '''
206 
207 RETURN = r'''
208 choco_bootstrap_output:
209   description: DEPRECATED, will be removed in 2.6, use stdout instead.
210   returned: changed, choco task returned a failure
211   type: str
212   sample: Chocolatey upgraded 1/1 packages.
213 choco_error_cmd:
214   description: DEPRECATED, will be removed in 2.6, use command instead.
215   returned: changed, choco task returned a failure
216   type: str
217   sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound
218 choco_error_log:
219   description: DEPRECATED, will be removed in 2.6, use stdout instead.
220   returned: changed, choco task returned a failure
221   type: str
222   sample: sysinternals not installed. The package was not found with the source(s) listed
223 command:
224   description: The full command used in the chocolatey task.
225   returned: changed
226   type: str
227   sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound
228 rc:
229   description: The return code from the chocolatey task.
230   returned: changed
231   type: int
232   sample: 0
233 stdout:
234   description: The stdout from the chocolatey task. The verbosity level of the
235     messages are affected by Ansible verbosity setting, see notes for more
236     details.
237   returned: changed
238   type: str
239   sample: Chocolatey upgraded 1/1 packages.
240 '''
241
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lib/ansible/modules/windows/win_chocolatey.py b/lib/ansible/modules/windows/win_chocolatey.py
--- a/lib/ansible/modules/windows/win_chocolatey.py
+++ b/lib/ansible/modules/windows/win_chocolatey.py
@@ -133,6 +133,9 @@
 - When using verbosity 4 (C(-vvvv)) the C(stdout) output will be more verbose.
 - When using verbosity 5 (C(-vvvvv)) the C(stdout) output will include debug output.
 - This module will install or upgrade Chocolatey when needed.
+- Some packages need an interactive user logon in order to install.  You can use (C(become)) to achieve this.
+- Even if you are connecting as local Administrator, using (C(become)) to become Administrator will give you an interactive user logon, see examples below.
+- Use (M(win_hotfix) to install hotfixes instead of (M(win_chocolatey)) as (M(win_hotfix)) avoids using wusa.exe which cannot be run remotely.
 author:
 - Trond Hindenes (@trondhindenes)
 - Peter Mounce (@petemounce)
@@ -173,10 +176,10 @@
     name: git
     state: absent
 
-- name: install multiple packages
+- name: Install multiple packages
   win_chocolatey:
     name: '{{ item }}'
-    state: absent
+    state: present
   with_items:
   - pscx
   - windirstat
@@ -202,6 +205,13 @@
     proxy_url: http://proxy-server:8080/
     proxy_username: user with \"escaped\" double quotes
     proxy_password: pass with \"escaped\" double quotes
+
+- name: Install a package that requires 'become'
+  win_chocolatey:
+    name: officepro2013
+  become: yes
+  become_user: Administrator
+  become_method: runas
 '''
 
 RETURN = r'''

{"golden_diff": "diff --git a/lib/ansible/modules/windows/win_chocolatey.py b/lib/ansible/modules/windows/win_chocolatey.py\n--- a/lib/ansible/modules/windows/win_chocolatey.py\n+++ b/lib/ansible/modules/windows/win_chocolatey.py\n@@ -133,6 +133,9 @@\n - When using verbosity 4 (C(-vvvv)) the C(stdout) output will be more verbose.\n - When using verbosity 5 (C(-vvvvv)) the C(stdout) output will include debug output.\n - This module will install or upgrade Chocolatey when needed.\n+- Some packages need an interactive user logon in order to install.  You can use (C(become)) to achieve this.\n+- Even if you are connecting as local Administrator, using (C(become)) to become Administrator will give you an interactive user logon, see examples below.\n+- Use (M(win_hotfix) to install hotfixes instead of (M(win_chocolatey)) as (M(win_hotfix)) avoids using wusa.exe which cannot be run remotely.\n author:\n - Trond Hindenes (@trondhindenes)\n - Peter Mounce (@petemounce)\n@@ -173,10 +176,10 @@\n     name: git\n     state: absent\n \n-- name: install multiple packages\n+- name: Install multiple packages\n   win_chocolatey:\n     name: '{{ item }}'\n-    state: absent\n+    state: present\n   with_items:\n   - pscx\n   - windirstat\n@@ -202,6 +205,13 @@\n     proxy_url: http://proxy-server:8080/\n     proxy_username: user with \\\"escaped\\\" double quotes\n     proxy_password: pass with \\\"escaped\\\" double quotes\n+\n+- name: Install a package that requires 'become'\n+  win_chocolatey:\n+    name: officepro2013\n+  become: yes\n+  become_user: Administrator\n+  become_method: runas\n '''\n \n RETURN = r'''\n", "issue": "win_chocolatey: Cannot install hotfixes (KB####) over WinRM\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\n<!--- Name of the module/plugin/task/feature -->\r\n- `win_chocolatey`\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from \u201cansible --version\u201d between quotes below -->\r\n```\r\nansible 2.3.1.0\r\n  config file = /etc/ansible/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.12 (default, May  5 2017, 21:21:54) [GCC 6.3.0]\r\n```\r\n\r\n##### CONFIGURATION\r\n- Default\r\n\r\n##### OS / ENVIRONMENT\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say \u201cN/A\u201d for anything that is not platform-specific.\r\nAlso mention the specific version of what you are trying to control,\r\ne.g. if this is a network bug the version of firmware on the network device.\r\n-->\r\n- Ansible on **Gentoo**\r\n- Target system is **Windows via WinRM**\r\n\r\n##### SUMMARY\r\n[Microsoft does not support](https://support.microsoft.com/en-us/help/2773898/windows-update-standalone-installer-wusa-returns-0x5-error-access-deni) using WUSA over a WinRM connection. If WUSA.exe has a WinRM session for an ancestor, it will exit immediately with \"Access denied.\"\r\n\r\nChocolatey packages that install Windows hotfixes (kb######) use WUSA to install the update after downloading it. If the Chocolatey command is running within a WinRM session, it encounters the same problem.\r\n\r\nSpecial-casing win_chocolatey for names beginning with \"kb\" is no solution either; some Chocolatey packages depend on these hotfix packages, perhaps even indirectly.\r\n\r\nThis could be argued as a bug with the Chocolatey packages themselves, as there exists some condition under which installation will fail. However, I believe this is appropriate as an Ansible bug, because the `win_chocolatey` task cannot install hotfixes (or packages depending on them) at all.\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem, using a minimal test-case.\r\nFor new features, show how the feature would be used.\r\n-->\r\n\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n```yaml\r\n- name: Demonstrate bug with installing hotfixes over WinRM\r\n  hosts: all\r\n  tasks:\r\n    - name: Install Chocolatey\r\n      raw: \"iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))\"\r\n    - name: Attempt to install KB3033929\r\n      win_chocolatey: name=kb3033929\r\n```\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\nPlease see [this gist](https://gist.github.com/CFSworks/490cf68574739df11b9deaaee1fcaa67) if you would like to reproduce the bug in Vagrant.\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\nHotfix package should install like any other Chocolatey package.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\n==> default: Running provisioner: ansible...\r\n    default: Running ansible-playbook...\r\n\r\nPLAY [Demonstrate bug with installing hotfixes over WinRM] *********************\r\n\r\nTASK [Gathering Facts] *********************************************************\r\nok: [default]\r\n\r\nTASK [Install Chocolatey] ******************************************************\r\nchanged: [default]\r\n\r\nTASK [Attempt to install KB3033929] ********************************************\r\nfatal: [default]: FAILED! => {\"changed\": false, \"choco_error_cmd\": \"choco.exe install -dv -y kb3033929 -timeout 2700\", \"choco_error_log\": null, \"failed\": true, \"msg\": \"Error installing kb3033929\", \"rc\": 5}\r\n        to retry, use: --limit @/home/cfsworks/Desktop/winbug/playbook.retry\r\n\r\nPLAY RECAP *********************************************************************\r\ndefault                    : ok=2    changed=1    unreachable=0    failed=1   \r\n\r\nAnsible failed to complete successfully. Any error output should be\r\nvisible above. Please fix these errors and try again.\r\n```\r\n\n", "before_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# (c) 2014, Trond Hindenes <trond@hindenes.com>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n\n# this is a windows documentation stub.  actual code lives in the .ps1\n# file of the same name\n\nANSIBLE_METADATA = {'metadata_version': '1.1',\n                    'status': ['preview'],\n                    'supported_by': 'community'}\n\nDOCUMENTATION = r'''\n---\nmodule: win_chocolatey\nversion_added: \"1.9\"\nshort_description: Manage packages using chocolatey\ndescription:\n    - Manage packages using Chocolatey (U(http://chocolatey.org/)).\n    - If Chocolatey is missing from the system, the module will install it.\n    - List of packages can be found at U(http://chocolatey.org/packages).\nrequirements:\n- chocolatey >= 0.10.5 (will be upgraded if older)\noptions:\n  name:\n    description:\n      - Name of the package to be installed.\n      - This must be a single package name.\n    required: yes\n  state:\n    description:\n      - State of the package on the system.\n    choices:\n      - absent\n      - downgrade\n      - latest\n      - present\n      - reinstalled\n    default: present\n  force:\n    description:\n      - Forces install of the package (even if it already exists).\n      - Using C(force) will cause ansible to always report that a change was made.\n    type: bool\n    default: 'no'\n  upgrade:\n    description:\n      - If package is already installed it, try to upgrade to the latest version or to the specified version.\n      - As of Ansible v2.3 this is deprecated, set parameter C(state) to C(latest) for the same result.\n    type: bool\n    default: 'no'\n  version:\n    description:\n      - Specific version of the package to be installed.\n      - Ignored when C(state) is set to C(absent).\n  source:\n    description:\n      - Specify source rather than using default chocolatey repository.\n  install_args:\n    description:\n      - Arguments to pass to the native installer.\n    version_added: '2.1'\n  params:\n    description:\n      - Parameters to pass to the package\n    version_added: '2.1'\n  allow_empty_checksums:\n    description:\n      - Allow empty checksums to be used.\n    type: bool\n    default: 'no'\n    version_added: '2.2'\n  ignore_checksums:\n    description:\n      - Ignore checksums altogether.\n    type: bool\n    default: 'no'\n    version_added: '2.2'\n  ignore_dependencies:\n    description:\n      - Ignore dependencies, only install/upgrade the package itself.\n    type: bool\n    default: 'no'\n    version_added: '2.1'\n  timeout:\n    description:\n      - The time to allow chocolatey to finish before timing out.\n    default: 2700\n    version_added: '2.3'\n    aliases: [ execution_timeout ]\n  skip_scripts:\n    description:\n    - Do not run I(chocolateyInstall.ps1) or I(chocolateyUninstall.ps1) scripts.\n    type: bool\n    default: 'no'\n    version_added: '2.4'\n  proxy_url:\n    description:\n      - Proxy url used to install chocolatey and the package.\n    version_added: '2.4'\n  proxy_username:\n    description:\n      - Proxy username used to install chocolatey and the package.\n      - When dealing with a username with double quote characters C(\"), they\n        need to be escaped with C(\\) beforehand. See examples for more details.\n    version_added: '2.4'\n  proxy_password:\n    description:\n      - Proxy password used to install chocolatey and the package.\n      - See notes in C(proxy_username) when dealing with double quotes in a\n        password.\n    version_added: '2.4'\nnotes:\n- Provide the C(version) parameter value as a string (e.g. C('6.1')), otherwise it\n  is considered to be a floating-point number and depending on the locale could\n  become C(6,1), which will cause a failure.\n- When using verbosity 2 or less (C(-vv)) the C(stdout) output will be restricted.\n- When using verbosity 4 (C(-vvvv)) the C(stdout) output will be more verbose.\n- When using verbosity 5 (C(-vvvvv)) the C(stdout) output will include debug output.\n- This module will install or upgrade Chocolatey when needed.\nauthor:\n- Trond Hindenes (@trondhindenes)\n- Peter Mounce (@petemounce)\n- Pepe Barbe (@elventear)\n- Adam Keech (@smadam813)\n- Pierre Templier (@ptemplier)\n'''\n\n# TODO:\n# * Better parsing when a package has dependencies - currently fails\n# * Time each item that is run\n# * Support 'changed' with gems - would require shelling out to `gem list` first and parsing, kinda defeating the point of using chocolatey.\n# * Version provided not as string might be translated to 6,6 depending on Locale (results in errors)\n\nEXAMPLES = r'''\n- name: Install git\n  win_chocolatey:\n    name: git\n    state: present\n\n- name: Upgrade installed packages\n  win_chocolatey:\n    name: all\n    state: latest\n\n- name: Install notepadplusplus version 6.6\n  win_chocolatey:\n    name: notepadplusplus.install\n    version: '6.6'\n\n- name: Install git from specified repository\n  win_chocolatey:\n    name: git\n    source: https://someserver/api/v2/\n\n- name: Uninstall git\n  win_chocolatey:\n    name: git\n    state: absent\n\n- name: install multiple packages\n  win_chocolatey:\n    name: '{{ item }}'\n    state: absent\n  with_items:\n  - pscx\n  - windirstat\n\n- name: uninstall multiple packages\n  win_chocolatey:\n    name: '{{ item }}'\n    state: absent\n  with_items:\n  - pscx\n  - windirstat\n\n- name: Install curl using proxy\n  win_chocolatey:\n    name: curl\n    proxy_url: http://proxy-server:8080/\n    proxy_username: joe\n    proxy_password: p@ssw0rd\n\n- name: Install curl with proxy credentials that contain quotes\n  win_chocolatey:\n    name: curl\n    proxy_url: http://proxy-server:8080/\n    proxy_username: user with \\\"escaped\\\" double quotes\n    proxy_password: pass with \\\"escaped\\\" double quotes\n'''\n\nRETURN = r'''\nchoco_bootstrap_output:\n  description: DEPRECATED, will be removed in 2.6, use stdout instead.\n  returned: changed, choco task returned a failure\n  type: str\n  sample: Chocolatey upgraded 1/1 packages.\nchoco_error_cmd:\n  description: DEPRECATED, will be removed in 2.6, use command instead.\n  returned: changed, choco task returned a failure\n  type: str\n  sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound\nchoco_error_log:\n  description: DEPRECATED, will be removed in 2.6, use stdout instead.\n  returned: changed, choco task returned a failure\n  type: str\n  sample: sysinternals not installed. The package was not found with the source(s) listed\ncommand:\n  description: The full command used in the chocolatey task.\n  returned: changed\n  type: str\n  sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound\nrc:\n  description: The return code from the chocolatey task.\n  returned: changed\n  type: int\n  sample: 0\nstdout:\n  description: The stdout from the chocolatey task. The verbosity level of the\n    messages are affected by Ansible verbosity setting, see notes for more\n    details.\n  returned: changed\n  type: str\n  sample: Chocolatey upgraded 1/1 packages.\n'''\n", "path": "lib/ansible/modules/windows/win_chocolatey.py"}], "after_files": [{"content": "#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n# (c) 2014, Trond Hindenes <trond@hindenes.com>\n#\n# This file is part of Ansible\n#\n# Ansible is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Ansible is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.\n\n# this is a windows documentation stub.  actual code lives in the .ps1\n# file of the same name\n\nANSIBLE_METADATA = {'metadata_version': '1.1',\n                    'status': ['preview'],\n                    'supported_by': 'community'}\n\nDOCUMENTATION = r'''\n---\nmodule: win_chocolatey\nversion_added: \"1.9\"\nshort_description: Manage packages using chocolatey\ndescription:\n    - Manage packages using Chocolatey (U(http://chocolatey.org/)).\n    - If Chocolatey is missing from the system, the module will install it.\n    - List of packages can be found at U(http://chocolatey.org/packages).\nrequirements:\n- chocolatey >= 0.10.5 (will be upgraded if older)\noptions:\n  name:\n    description:\n      - Name of the package to be installed.\n      - This must be a single package name.\n    required: yes\n  state:\n    description:\n      - State of the package on the system.\n    choices:\n      - absent\n      - downgrade\n      - latest\n      - present\n      - reinstalled\n    default: present\n  force:\n    description:\n      - Forces install of the package (even if it already exists).\n      - Using C(force) will cause ansible to always report that a change was made.\n    type: bool\n    default: 'no'\n  upgrade:\n    description:\n      - If package is already installed it, try to upgrade to the latest version or to the specified version.\n      - As of Ansible v2.3 this is deprecated, set parameter C(state) to C(latest) for the same result.\n    type: bool\n    default: 'no'\n  version:\n    description:\n      - Specific version of the package to be installed.\n      - Ignored when C(state) is set to C(absent).\n  source:\n    description:\n      - Specify source rather than using default chocolatey repository.\n  install_args:\n    description:\n      - Arguments to pass to the native installer.\n    version_added: '2.1'\n  params:\n    description:\n      - Parameters to pass to the package\n    version_added: '2.1'\n  allow_empty_checksums:\n    description:\n      - Allow empty checksums to be used.\n    type: bool\n    default: 'no'\n    version_added: '2.2'\n  ignore_checksums:\n    description:\n      - Ignore checksums altogether.\n    type: bool\n    default: 'no'\n    version_added: '2.2'\n  ignore_dependencies:\n    description:\n      - Ignore dependencies, only install/upgrade the package itself.\n    type: bool\n    default: 'no'\n    version_added: '2.1'\n  timeout:\n    description:\n      - The time to allow chocolatey to finish before timing out.\n    default: 2700\n    version_added: '2.3'\n    aliases: [ execution_timeout ]\n  skip_scripts:\n    description:\n    - Do not run I(chocolateyInstall.ps1) or I(chocolateyUninstall.ps1) scripts.\n    type: bool\n    default: 'no'\n    version_added: '2.4'\n  proxy_url:\n    description:\n      - Proxy url used to install chocolatey and the package.\n    version_added: '2.4'\n  proxy_username:\n    description:\n      - Proxy username used to install chocolatey and the package.\n      - When dealing with a username with double quote characters C(\"), they\n        need to be escaped with C(\\) beforehand. See examples for more details.\n    version_added: '2.4'\n  proxy_password:\n    description:\n      - Proxy password used to install chocolatey and the package.\n      - See notes in C(proxy_username) when dealing with double quotes in a\n        password.\n    version_added: '2.4'\nnotes:\n- Provide the C(version) parameter value as a string (e.g. C('6.1')), otherwise it\n  is considered to be a floating-point number and depending on the locale could\n  become C(6,1), which will cause a failure.\n- When using verbosity 2 or less (C(-vv)) the C(stdout) output will be restricted.\n- When using verbosity 4 (C(-vvvv)) the C(stdout) output will be more verbose.\n- When using verbosity 5 (C(-vvvvv)) the C(stdout) output will include debug output.\n- This module will install or upgrade Chocolatey when needed.\n- Some packages need an interactive user logon in order to install.  You can use (C(become)) to achieve this.\n- Even if you are connecting as local Administrator, using (C(become)) to become Administrator will give you an interactive user logon, see examples below.\n- Use (M(win_hotfix) to install hotfixes instead of (M(win_chocolatey)) as (M(win_hotfix)) avoids using wusa.exe which cannot be run remotely.\nauthor:\n- Trond Hindenes (@trondhindenes)\n- Peter Mounce (@petemounce)\n- Pepe Barbe (@elventear)\n- Adam Keech (@smadam813)\n- Pierre Templier (@ptemplier)\n'''\n\n# TODO:\n# * Better parsing when a package has dependencies - currently fails\n# * Time each item that is run\n# * Support 'changed' with gems - would require shelling out to `gem list` first and parsing, kinda defeating the point of using chocolatey.\n# * Version provided not as string might be translated to 6,6 depending on Locale (results in errors)\n\nEXAMPLES = r'''\n- name: Install git\n  win_chocolatey:\n    name: git\n    state: present\n\n- name: Upgrade installed packages\n  win_chocolatey:\n    name: all\n    state: latest\n\n- name: Install notepadplusplus version 6.6\n  win_chocolatey:\n    name: notepadplusplus.install\n    version: '6.6'\n\n- name: Install git from specified repository\n  win_chocolatey:\n    name: git\n    source: https://someserver/api/v2/\n\n- name: Uninstall git\n  win_chocolatey:\n    name: git\n    state: absent\n\n- name: Install multiple packages\n  win_chocolatey:\n    name: '{{ item }}'\n    state: present\n  with_items:\n  - pscx\n  - windirstat\n\n- name: uninstall multiple packages\n  win_chocolatey:\n    name: '{{ item }}'\n    state: absent\n  with_items:\n  - pscx\n  - windirstat\n\n- name: Install curl using proxy\n  win_chocolatey:\n    name: curl\n    proxy_url: http://proxy-server:8080/\n    proxy_username: joe\n    proxy_password: p@ssw0rd\n\n- name: Install curl with proxy credentials that contain quotes\n  win_chocolatey:\n    name: curl\n    proxy_url: http://proxy-server:8080/\n    proxy_username: user with \\\"escaped\\\" double quotes\n    proxy_password: pass with \\\"escaped\\\" double quotes\n\n- name: Install a package that requires 'become'\n  win_chocolatey:\n    name: officepro2013\n  become: yes\n  become_user: Administrator\n  become_method: runas\n'''\n\nRETURN = r'''\nchoco_bootstrap_output:\n  description: DEPRECATED, will be removed in 2.6, use stdout instead.\n  returned: changed, choco task returned a failure\n  type: str\n  sample: Chocolatey upgraded 1/1 packages.\nchoco_error_cmd:\n  description: DEPRECATED, will be removed in 2.6, use command instead.\n  returned: changed, choco task returned a failure\n  type: str\n  sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound\nchoco_error_log:\n  description: DEPRECATED, will be removed in 2.6, use stdout instead.\n  returned: changed, choco task returned a failure\n  type: str\n  sample: sysinternals not installed. The package was not found with the source(s) listed\ncommand:\n  description: The full command used in the chocolatey task.\n  returned: changed\n  type: str\n  sample: choco.exe install -r --no-progress -y sysinternals --timeout 2700 --failonunfound\nrc:\n  description: The return code from the chocolatey task.\n  returned: changed\n  type: int\n  sample: 0\nstdout:\n  description: The stdout from the chocolatey task. The verbosity level of the\n    messages are affected by Ansible verbosity setting, see notes for more\n    details.\n  returned: changed\n  type: str\n  sample: Chocolatey upgraded 1/1 packages.\n'''\n", "path": "lib/ansible/modules/windows/win_chocolatey.py"}]}