Skip to content

Commit

Permalink
Expand notes in win_copy and become (#583)
Browse files Browse the repository at this point in the history
* Expand notes in win_copy and become

Adds an extra note to further clarify what needs to be done when using
win_copy with a become user that is not a member of the Administrators
group on the target Windows host.

* Update plugins/modules/win_copy.py

Co-authored-by: ChrisNicoll-Pro <[email protected]>

---------

Co-authored-by: ChrisNicoll-Pro <[email protected]>
  • Loading branch information
jborean93 and ChrisNicoll-Pro authored Feb 8, 2024
1 parent 58913c6 commit d2de2bc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions plugins/modules/win_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

DOCUMENTATION = r'''
DOCUMENTATION = r"""
---
module: win_copy
short_description: Copies files to remote locations on windows hosts
Expand Down Expand Up @@ -90,6 +90,10 @@
- Because win_copy runs over WinRM, it is not a very efficient transfer
mechanism. If sending large files consider hosting them on a web service and
using M(ansible.windows.win_get_url) instead.
- When using become with a user that is not an Administrator, the remote temp
directory must be set to one that is accessible to both the become and
connection user with C(ansible_remote_tmp). See the examples for more
information.
seealso:
- module: ansible.builtin.assemble
- module: ansible.builtin.copy
Expand All @@ -98,9 +102,9 @@
author:
- Jon Hawkesworth (@jhawkesworth)
- Jordan Borean (@jborean93)
'''
"""

EXAMPLES = r'''
EXAMPLES = r"""
- name: Copy a single file
ansible.windows.win_copy:
src: /srv/myfiles/foo.conf
Expand Down Expand Up @@ -155,9 +159,9 @@
# This ensures the become user will have permissions for the operation
# Make sure to specify a folder both the ansible_user and the become_user have access to (i.e not %TEMP% which is user specific and requires Admin)
ansible_remote_tmp: 'c:\tmp'
'''
"""

RETURN = r'''
RETURN = r"""
backup_file:
description: Name of the backup file that was created.
returned: if backup=yes
Expand Down Expand Up @@ -193,4 +197,4 @@
returned: changed, src is a file
type: str
sample: foo.txt
'''
"""

0 comments on commit d2de2bc

Please sign in to comment.