# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import subprocess
DOCUMENTATION = \
'''
---
module: synchronize
short_description: An Ansible action plugin using rsync to make synchronizing a file paths in your playbooks quick and easy.
description:
- An Ansible action plugin using rsync to make synchronizing a file paths in your playbooks quick and easy. Of course you could just use the command action to call rsync yourself, but you also have to add a fair number of boilerplate options and host facts. You still may need to call rsync directly via C(command) or C(shell). The synchronize action is meant to do common things with C(rsync) easily. It does not provide access to the full power of rsync.
options:
src:
description:
- Path on the source machine that will be synchronized to the destination; The path can be absolute or relative.
required: true
default: null
dest:
description:
- Path on the destination machine that will be synchronized from the source; The path can be absolute or relative.
required: true
default: null
mode:
description:
- Specify the direction of the synchroniztion. In push mode the localhost or delgate is the source; In pull mode the inventory hostname in context is the source.
required: false
choices: [ 'push', 'pull' ]
default: 'push'
verbosity:
description:
- An integrater controling the amount of information returned during processing. The greater the value the more information rsync will report back. See the C(-v, --verbose) option of the rsync man page for details. If verbosity is not defined or a value of 0 is assumed, the C(--quiet) option is passed and information is supressed.
required: false
default: 0
delete:
description:
- Delete files that don't exist (after transfer, not before) in C(src) path.
choices: [ 'yes', 'no' ]
default: 'no'
required: false
rsync_path:
description:
- Specify rsync to run on the remote machine. See C(--rsync-path) on the rsync man page.