Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve examples - windows/win_robocopy.py #18831

Merged
merged 1 commit into from
Dec 15, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 27 additions & 22 deletions lib/ansible/modules/windows/win_robocopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,39 @@
- Works on Windows 7, Windows 8, Windows Server 2k8, and Windows Server 2k12
"""

EXAMPLES = """
# Syncs the contents of one directory to another.
$ ansible -i hosts all -m win_robocopy -a "src=C:\\DirectoryOne dest=C:\\DirectoryTwo"
EXAMPLES = r'''
- name: Sync the contents of one directory to another
win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo

# Sync the contents of one directory to another, including subdirectories.
$ ansible -i hosts all -m win_robocopy -a "src=C:\\DirectoryOne dest=C:\\DirectoryTwo recurse=true"
- name: Sync the contents of one directory to another, including subdirectories
win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
recurse: True

# Sync the contents of one directory to another, and remove any files/directories found in destination that do not exist in the source.
$ ansible -i hosts all -m win_robocopy -a "src=C:\\DirectoryOne dest=C:\\DirectoryTwo purge=true"
- name: Sync the contents of one directory to another, and remove any files/directories found in destination that do not exist in the source
win_robocopy:
src: C:\DirectoryOne
dest: C:\DirectoryTwo
purge: True

# Sample sync
---
- name: Sync Two Directories
- name: Sync content in recursive mode, removing any files/directories found in destination that do not exist in the source
win_robocopy:
src: "C:\\DirectoryOne
dest: "C:\\DirectoryTwo"
recurse: true
purge: true
src: C:\DirectoryOne
dest: C:\DirectoryTwo
recurse: True
purge: True

---
- name: Sync Two Directories
- name: Sync Two Directories in recursive and purging mode, specifying additional special flags
win_robocopy:
src: "C:\\DirectoryOne
dest: "C:\\DirectoryTwo"
recurse: true
purge: true
flags: '/XD SOME_DIR /XF SOME_FILE /MT:32'
"""
src: C:\DirectoryOne
dest: C:\DirectoryTwo
recurse: True
purge: True
flags: /XD SOME_DIR /XF SOME_FILE /MT:32
'''

RETURN = '''
src:
Expand Down