Skip to content

subversion

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version 0.7.

You need further requirements to be able to use this module, see the Requirements section for details.

Synopsis

  • Deploy given repository URL / revision to dest. If dest exists, update to the specified revision, otherwise perform a checkout.

Requirements

The following Python packages are needed on the host that executes this module:

Parameters

Parameter Defaults / Choices Comments
checkout
bool
Default: yes
If V(false), do not check out the repository if it does not exist locally.
Version Added: 2.3
dest
path
Absolute path where the repository should be deployed.
The destination directory must be specified unless O(checkout=no), O(update=no), and O(export=no).
executable
path
Path to svn executable to use. If not supplied, the normal mechanism for resolving binary paths will be used.
Version Added: 1.4
export
bool
Default: no
If V(true), do export instead of checkout/update.
Version Added: 1.6
force
bool
Default: no
If V(true), modified files will be discarded. If V(false), module will fail if it encounters modified files. Prior to 1.9 the default was V(true).
in_place
bool
Default: no
If the directory exists, then the working copy will be checked-out over-the-top using C(svn checkout --force); if force is specified then existing files with different content are reverted.
Version Added: 2.6
password
str
C(--password) parameter passed to svn when svn is less than version 1.10.0. This is not secure and the password will be leaked to argv.
C(--password-from-stdin) parameter when svn is greater or equal to version 1.10.0.
repo
str
required
The subversion URL to the repository.
revision
str
Default: HEAD
Specific revision to checkout.
switch
bool
Default: yes
If V(false), do not call svn switch before update.
Version Added: 2.0
update
bool
Default: yes
If V(false), do not retrieve new revisions from the origin repository.
Version Added: 2.3
username
str
C(--username) parameter passed to svn.
validate_certs
bool
Default: no
If V(false), passes the C(--trust-server-cert) flag to svn.
If V(true), does not pass the flag.
Version Added: 2.11

Notes

Note

  • This module does not handle externals.

Examples

- name: Checkout subversion repository to specified folder
  ansible.builtin.subversion:
    repo: svn+ssh://an.example.org/path/to/repo
    dest: /src/checkout

- name: Export subversion directory to folder
  ansible.builtin.subversion:
    repo: svn+ssh://an.example.org/path/to/repo
    dest: /src/export
    export: yes

- name: Get information about the repository whether or not it has already been cloned locally
  ansible.builtin.subversion:
    repo: svn+ssh://an.example.org/path/to/repo
    dest: /src/checkout
    checkout: no
    update: no

Authors