|
|
@ -33,12 +33,12 @@ options:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- What version of the repository to check out. This can be
|
|
|
|
- What version of the repository to check out. This can be
|
|
|
|
the literal string C(HEAD), a branch name, a tag name.
|
|
|
|
the literal string C(HEAD), a branch name, a tag name.
|
|
|
|
It can also be a I(SHA-1) hash, in which case C(refspec) needs
|
|
|
|
It can also be a I(SHA-1) hash, in which case I(refspec) needs
|
|
|
|
to be specified if the given revision is not already available.
|
|
|
|
to be specified if the given revision is not already available.
|
|
|
|
default: "HEAD"
|
|
|
|
default: "HEAD"
|
|
|
|
accept_hostkey:
|
|
|
|
accept_hostkey:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- if C(yes), ensure that "-o StrictHostKeyChecking=no" is
|
|
|
|
- If C(yes), ensure that "-o StrictHostKeyChecking=no" is
|
|
|
|
present as an ssh option.
|
|
|
|
present as an ssh option.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'no'
|
|
|
|
default: 'no'
|
|
|
@ -57,7 +57,7 @@ options:
|
|
|
|
version_added: "1.5"
|
|
|
|
version_added: "1.5"
|
|
|
|
reference:
|
|
|
|
reference:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Reference repository (see "git clone --reference ...")
|
|
|
|
- Reference repository (see "git clone --reference ...").
|
|
|
|
version_added: "1.4"
|
|
|
|
version_added: "1.4"
|
|
|
|
remote:
|
|
|
|
remote:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -77,7 +77,7 @@ options:
|
|
|
|
- If C(yes), any modified files in the working
|
|
|
|
- If C(yes), any modified files in the working
|
|
|
|
repository will be discarded. Prior to 0.7, this was always
|
|
|
|
repository will be discarded. Prior to 0.7, this was always
|
|
|
|
'yes' and could not be disabled. Prior to 1.9, the default was
|
|
|
|
'yes' and could not be disabled. Prior to 1.9, the default was
|
|
|
|
`yes`
|
|
|
|
`yes`.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'no'
|
|
|
|
default: 'no'
|
|
|
|
version_added: "0.7"
|
|
|
|
version_added: "0.7"
|
|
|
@ -89,13 +89,13 @@ options:
|
|
|
|
version_added: "1.2"
|
|
|
|
version_added: "1.2"
|
|
|
|
clone:
|
|
|
|
clone:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- If C(no), do not clone the repository even if it does not exist locally
|
|
|
|
- If C(no), do not clone the repository even if it does not exist locally.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'yes'
|
|
|
|
default: 'yes'
|
|
|
|
version_added: "1.9"
|
|
|
|
version_added: "1.9"
|
|
|
|
update:
|
|
|
|
update:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- If C(no), do not retrieve new revisions from the origin repository
|
|
|
|
- If C(no), do not retrieve new revisions from the origin repository.
|
|
|
|
- Operations like archive will work on the existing (old) repository and might
|
|
|
|
- Operations like archive will work on the existing (old) repository and might
|
|
|
|
not respond to changes to the options version or remote.
|
|
|
|
not respond to changes to the options version or remote.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
@ -108,7 +108,7 @@ options:
|
|
|
|
version_added: "1.4"
|
|
|
|
version_added: "1.4"
|
|
|
|
bare:
|
|
|
|
bare:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- if C(yes), repository will be created as a bare repo, otherwise
|
|
|
|
- If C(yes), repository will be created as a bare repo, otherwise
|
|
|
|
it will be a standard repo with a workspace.
|
|
|
|
it will be a standard repo with a workspace.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'no'
|
|
|
|
default: 'no'
|
|
|
@ -121,7 +121,7 @@ options:
|
|
|
|
|
|
|
|
|
|
|
|
recursive:
|
|
|
|
recursive:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- if C(no), repository will be cloned without the --recursive
|
|
|
|
- If C(no), repository will be cloned without the --recursive
|
|
|
|
option, skipping sub-modules.
|
|
|
|
option, skipping sub-modules.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
|
default: 'yes'
|
|
|
|
default: 'yes'
|
|
|
@ -129,7 +129,7 @@ options:
|
|
|
|
|
|
|
|
|
|
|
|
track_submodules:
|
|
|
|
track_submodules:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- if C(yes), submodules will track the latest commit on their
|
|
|
|
- If C(yes), submodules will track the latest commit on their
|
|
|
|
master branch (or other branch specified in .gitmodules). If
|
|
|
|
master branch (or other branch specified in .gitmodules). If
|
|
|
|
C(no), submodules will be kept at the revision specified by the
|
|
|
|
C(no), submodules will be kept at the revision specified by the
|
|
|
|
main project. This is equivalent to specifying the --remote flag
|
|
|
|
main project. This is equivalent to specifying the --remote flag
|
|
|
@ -140,8 +140,8 @@ options:
|
|
|
|
|
|
|
|
|
|
|
|
verify_commit:
|
|
|
|
verify_commit:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- if C(yes), when cloning or checking out a C(version) verify the
|
|
|
|
- If C(yes), when cloning or checking out a I(version) verify the
|
|
|
|
signature of a GPG signed commit. This requires C(git) version>=2.1.0
|
|
|
|
signature of a GPG signed commit. This requires git version>=2.1.0
|
|
|
|
to be installed. The commit MUST be signed and the public key MUST
|
|
|
|
to be installed. The commit MUST be signed and the public key MUST
|
|
|
|
be present in the GPG keyring.
|
|
|
|
be present in the GPG keyring.
|
|
|
|
type: bool
|
|
|
|
type: bool
|
|
|
@ -153,14 +153,14 @@ options:
|
|
|
|
- Specify archive file path with extension. If specified, creates an
|
|
|
|
- Specify archive file path with extension. If specified, creates an
|
|
|
|
archive file of the specified format containing the tree structure
|
|
|
|
archive file of the specified format containing the tree structure
|
|
|
|
for the source tree.
|
|
|
|
for the source tree.
|
|
|
|
Allowed archive formats ["zip", "tar.gz", "tar", "tgz"]
|
|
|
|
Allowed archive formats ["zip", "tar.gz", "tar", "tgz"].
|
|
|
|
- This will clone and perform git archive from local directory as not
|
|
|
|
- This will clone and perform git archive from local directory as not
|
|
|
|
all git servers support git archive.
|
|
|
|
all git servers support git archive.
|
|
|
|
version_added: "2.4"
|
|
|
|
version_added: "2.4"
|
|
|
|
|
|
|
|
|
|
|
|
archive_prefix:
|
|
|
|
archive_prefix:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Specify a prefix to add to each file path in archive. Requires C(archive) to be specified.
|
|
|
|
- Specify a prefix to add to each file path in archive. Requires I(archive) to be specified.
|
|
|
|
version_added: "2.10"
|
|
|
|
version_added: "2.10"
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
|
|
|
|
|
|
|
@ -188,47 +188,48 @@ notes:
|
|
|
|
one solution is to use the option accept_hostkey. Another solution is to
|
|
|
|
one solution is to use the option accept_hostkey. Another solution is to
|
|
|
|
add the remote host public key in C(/etc/ssh/ssh_known_hosts) before calling
|
|
|
|
add the remote host public key in C(/etc/ssh/ssh_known_hosts) before calling
|
|
|
|
the git module, with the following command: ssh-keyscan -H remote_host.com >> /etc/ssh/ssh_known_hosts."
|
|
|
|
the git module, with the following command: ssh-keyscan -H remote_host.com >> /etc/ssh/ssh_known_hosts."
|
|
|
|
|
|
|
|
- Supports C(check_mode).
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
- name: Git checkout
|
|
|
|
- name: Git checkout
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: 'https://foosball.example.org/path/to/repo.git'
|
|
|
|
repo: 'https://foosball.example.org/path/to/repo.git'
|
|
|
|
dest: /srv/checkout
|
|
|
|
dest: /srv/checkout
|
|
|
|
version: release-0.22
|
|
|
|
version: release-0.22
|
|
|
|
|
|
|
|
|
|
|
|
- name: Read-write git checkout from github
|
|
|
|
- name: Read-write git checkout from github
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: git@github.com:mylogin/hello.git
|
|
|
|
repo: git@github.com:mylogin/hello.git
|
|
|
|
dest: /home/mylogin/hello
|
|
|
|
dest: /home/mylogin/hello
|
|
|
|
|
|
|
|
|
|
|
|
- name: Just ensuring the repo checkout exists
|
|
|
|
- name: Just ensuring the repo checkout exists
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: 'https://foosball.example.org/path/to/repo.git'
|
|
|
|
repo: 'https://foosball.example.org/path/to/repo.git'
|
|
|
|
dest: /srv/checkout
|
|
|
|
dest: /srv/checkout
|
|
|
|
update: no
|
|
|
|
update: no
|
|
|
|
|
|
|
|
|
|
|
|
- name: Just get information about the repository whether or not it has already been cloned locally
|
|
|
|
- name: Just get information about the repository whether or not it has already been cloned locally
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: 'https://foosball.example.org/path/to/repo.git'
|
|
|
|
repo: 'https://foosball.example.org/path/to/repo.git'
|
|
|
|
dest: /srv/checkout
|
|
|
|
dest: /srv/checkout
|
|
|
|
clone: no
|
|
|
|
clone: no
|
|
|
|
update: no
|
|
|
|
update: no
|
|
|
|
|
|
|
|
|
|
|
|
- name: Checkout a github repo and use refspec to fetch all pull requests
|
|
|
|
- name: Checkout a github repo and use refspec to fetch all pull requests
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://github.com/ansible/ansible-examples.git
|
|
|
|
repo: https://github.com/ansible/ansible-examples.git
|
|
|
|
dest: /src/ansible-examples
|
|
|
|
dest: /src/ansible-examples
|
|
|
|
refspec: '+refs/pull/*:refs/heads/*'
|
|
|
|
refspec: '+refs/pull/*:refs/heads/*'
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create git archive from repo
|
|
|
|
- name: Create git archive from repo
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://github.com/ansible/ansible-examples.git
|
|
|
|
repo: https://github.com/ansible/ansible-examples.git
|
|
|
|
dest: /src/ansible-examples
|
|
|
|
dest: /src/ansible-examples
|
|
|
|
archive: /tmp/ansible-examples.zip
|
|
|
|
archive: /tmp/ansible-examples.zip
|
|
|
|
|
|
|
|
|
|
|
|
- name: Clone a repo with separate git directory
|
|
|
|
- name: Clone a repo with separate git directory
|
|
|
|
git:
|
|
|
|
ansible.builtin.git:
|
|
|
|
repo: https://github.com/ansible/ansible-examples.git
|
|
|
|
repo: https://github.com/ansible/ansible-examples.git
|
|
|
|
dest: /src/ansible-examples
|
|
|
|
dest: /src/ansible-examples
|
|
|
|
separate_git_dir: /src/ansible-examples.git
|
|
|
|
separate_git_dir: /src/ansible-examples.git
|
|
|
@ -236,12 +237,12 @@ EXAMPLES = '''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = '''
|
|
|
|
RETURN = '''
|
|
|
|
after:
|
|
|
|
after:
|
|
|
|
description: last commit revision of the repository retrieved during the update
|
|
|
|
description: Last commit revision of the repository retrieved during the update.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: 4c020102a9cd6fe908c9a4a326a38f972f63a903
|
|
|
|
sample: 4c020102a9cd6fe908c9a4a326a38f972f63a903
|
|
|
|
before:
|
|
|
|
before:
|
|
|
|
description: commit revision before the repository was updated, "null" for new repository
|
|
|
|
description: Commit revision before the repository was updated, "null" for new repository.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: 67c04ebe40a003bda0efb34eacfb93b0cafdf628
|
|
|
|
sample: 67c04ebe40a003bda0efb34eacfb93b0cafdf628
|
|
|
@ -256,12 +257,12 @@ warnings:
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: Your git version is too old to fully support the depth argument. Falling back to full checkouts.
|
|
|
|
sample: Your git version is too old to fully support the depth argument. Falling back to full checkouts.
|
|
|
|
git_dir_now:
|
|
|
|
git_dir_now:
|
|
|
|
description: Contains the new path of .git directory if it's changed
|
|
|
|
description: Contains the new path of .git directory if it is changed.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: /path/to/new/git/dir
|
|
|
|
sample: /path/to/new/git/dir
|
|
|
|
git_dir_before:
|
|
|
|
git_dir_before:
|
|
|
|
description: Contains the original path of .git directory if it's changed
|
|
|
|
description: Contains the original path of .git directory if it is changed.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: /path/to/old/git/dir
|
|
|
|
sample: /path/to/old/git/dir
|
|
|
|