|
|
@ -118,6 +118,7 @@ extends_documentation_fragment:
|
|
|
|
- validate
|
|
|
|
- validate
|
|
|
|
notes:
|
|
|
|
notes:
|
|
|
|
- The M(ansible.builtin.copy) module recursively copy facility does not scale to lots (>hundreds) of files.
|
|
|
|
- The M(ansible.builtin.copy) module recursively copy facility does not scale to lots (>hundreds) of files.
|
|
|
|
|
|
|
|
- Supports C(check_mode).
|
|
|
|
seealso:
|
|
|
|
seealso:
|
|
|
|
- module: ansible.builtin.assemble
|
|
|
|
- module: ansible.builtin.assemble
|
|
|
|
- module: ansible.builtin.fetch
|
|
|
|
- module: ansible.builtin.fetch
|
|
|
@ -132,7 +133,7 @@ author:
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = r'''
|
|
|
|
EXAMPLES = r'''
|
|
|
|
- name: Copy file with owner and permissions
|
|
|
|
- name: Copy file with owner and permissions
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /srv/myfiles/foo.conf
|
|
|
|
src: /srv/myfiles/foo.conf
|
|
|
|
dest: /etc/foo.conf
|
|
|
|
dest: /etc/foo.conf
|
|
|
|
owner: foo
|
|
|
|
owner: foo
|
|
|
@ -140,7 +141,7 @@ EXAMPLES = r'''
|
|
|
|
mode: '0644'
|
|
|
|
mode: '0644'
|
|
|
|
|
|
|
|
|
|
|
|
- name: Copy file with owner and permission, using symbolic representation
|
|
|
|
- name: Copy file with owner and permission, using symbolic representation
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /srv/myfiles/foo.conf
|
|
|
|
src: /srv/myfiles/foo.conf
|
|
|
|
dest: /etc/foo.conf
|
|
|
|
dest: /etc/foo.conf
|
|
|
|
owner: foo
|
|
|
|
owner: foo
|
|
|
@ -148,7 +149,7 @@ EXAMPLES = r'''
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
|
|
|
|
|
|
|
|
- name: Another symbolic mode example, adding some permissions and removing others
|
|
|
|
- name: Another symbolic mode example, adding some permissions and removing others
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /srv/myfiles/foo.conf
|
|
|
|
src: /srv/myfiles/foo.conf
|
|
|
|
dest: /etc/foo.conf
|
|
|
|
dest: /etc/foo.conf
|
|
|
|
owner: foo
|
|
|
|
owner: foo
|
|
|
@ -156,7 +157,7 @@ EXAMPLES = r'''
|
|
|
|
mode: u+rw,g-wx,o-rwx
|
|
|
|
mode: u+rw,g-wx,o-rwx
|
|
|
|
|
|
|
|
|
|
|
|
- name: Copy a new "ntp.conf" file into place, backing up the original if it differs from the copied version
|
|
|
|
- name: Copy a new "ntp.conf" file into place, backing up the original if it differs from the copied version
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /mine/ntp.conf
|
|
|
|
src: /mine/ntp.conf
|
|
|
|
dest: /etc/ntp.conf
|
|
|
|
dest: /etc/ntp.conf
|
|
|
|
owner: root
|
|
|
|
owner: root
|
|
|
@ -165,31 +166,31 @@ EXAMPLES = r'''
|
|
|
|
backup: yes
|
|
|
|
backup: yes
|
|
|
|
|
|
|
|
|
|
|
|
- name: Copy a new "sudoers" file into place, after passing validation with visudo
|
|
|
|
- name: Copy a new "sudoers" file into place, after passing validation with visudo
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /mine/sudoers
|
|
|
|
src: /mine/sudoers
|
|
|
|
dest: /etc/sudoers
|
|
|
|
dest: /etc/sudoers
|
|
|
|
validate: /usr/sbin/visudo -csf %s
|
|
|
|
validate: /usr/sbin/visudo -csf %s
|
|
|
|
|
|
|
|
|
|
|
|
- name: Copy a "sudoers" file on the remote machine for editing
|
|
|
|
- name: Copy a "sudoers" file on the remote machine for editing
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /etc/sudoers
|
|
|
|
src: /etc/sudoers
|
|
|
|
dest: /etc/sudoers.edit
|
|
|
|
dest: /etc/sudoers.edit
|
|
|
|
remote_src: yes
|
|
|
|
remote_src: yes
|
|
|
|
validate: /usr/sbin/visudo -csf %s
|
|
|
|
validate: /usr/sbin/visudo -csf %s
|
|
|
|
|
|
|
|
|
|
|
|
- name: Copy using inline content
|
|
|
|
- name: Copy using inline content
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
content: '# This file was moved to /etc/other.conf'
|
|
|
|
content: '# This file was moved to /etc/other.conf'
|
|
|
|
dest: /etc/mine.conf
|
|
|
|
dest: /etc/mine.conf
|
|
|
|
|
|
|
|
|
|
|
|
- name: If follow=yes, /path/to/file will be overwritten by contents of foo.conf
|
|
|
|
- name: If follow=yes, /path/to/file will be overwritten by contents of foo.conf
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /etc/foo.conf
|
|
|
|
src: /etc/foo.conf
|
|
|
|
dest: /path/to/link # link to /path/to/file
|
|
|
|
dest: /path/to/link # link to /path/to/file
|
|
|
|
follow: yes
|
|
|
|
follow: yes
|
|
|
|
|
|
|
|
|
|
|
|
- name: If follow=no, /path/to/link will become a file and be overwritten by contents of foo.conf
|
|
|
|
- name: If follow=no, /path/to/link will become a file and be overwritten by contents of foo.conf
|
|
|
|
copy:
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: /etc/foo.conf
|
|
|
|
src: /etc/foo.conf
|
|
|
|
dest: /path/to/link # link to /path/to/file
|
|
|
|
dest: /path/to/link # link to /path/to/file
|
|
|
|
follow: no
|
|
|
|
follow: no
|
|
|
@ -197,62 +198,62 @@ EXAMPLES = r'''
|
|
|
|
|
|
|
|
|
|
|
|
RETURN = r'''
|
|
|
|
RETURN = r'''
|
|
|
|
dest:
|
|
|
|
dest:
|
|
|
|
description: Destination file/path
|
|
|
|
description: Destination file/path.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: /path/to/file.txt
|
|
|
|
sample: /path/to/file.txt
|
|
|
|
src:
|
|
|
|
src:
|
|
|
|
description: Source file used for the copy on the target machine
|
|
|
|
description: Source file used for the copy on the target machine.
|
|
|
|
returned: changed
|
|
|
|
returned: changed
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: /home/httpd/.ansible/tmp/ansible-tmp-1423796390.97-147729857856000/source
|
|
|
|
sample: /home/httpd/.ansible/tmp/ansible-tmp-1423796390.97-147729857856000/source
|
|
|
|
md5sum:
|
|
|
|
md5sum:
|
|
|
|
description: MD5 checksum of the file after running copy
|
|
|
|
description: MD5 checksum of the file after running copy.
|
|
|
|
returned: when supported
|
|
|
|
returned: when supported
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: 2a5aeecc61dc98c4d780b14b330e3282
|
|
|
|
sample: 2a5aeecc61dc98c4d780b14b330e3282
|
|
|
|
checksum:
|
|
|
|
checksum:
|
|
|
|
description: SHA1 checksum of the file after running copy
|
|
|
|
description: SHA1 checksum of the file after running copy.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: 6e642bb8dd5c2e027bf21dd923337cbb4214f827
|
|
|
|
sample: 6e642bb8dd5c2e027bf21dd923337cbb4214f827
|
|
|
|
backup_file:
|
|
|
|
backup_file:
|
|
|
|
description: Name of backup file created
|
|
|
|
description: Name of backup file created.
|
|
|
|
returned: changed and if backup=yes
|
|
|
|
returned: changed and if backup=yes
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: /path/to/file.txt.2015-02-12@22:09~
|
|
|
|
sample: /path/to/file.txt.2015-02-12@22:09~
|
|
|
|
gid:
|
|
|
|
gid:
|
|
|
|
description: Group id of the file, after execution
|
|
|
|
description: Group id of the file, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: int
|
|
|
|
type: int
|
|
|
|
sample: 100
|
|
|
|
sample: 100
|
|
|
|
group:
|
|
|
|
group:
|
|
|
|
description: Group of the file, after execution
|
|
|
|
description: Group of the file, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: httpd
|
|
|
|
sample: httpd
|
|
|
|
owner:
|
|
|
|
owner:
|
|
|
|
description: Owner of the file, after execution
|
|
|
|
description: Owner of the file, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: httpd
|
|
|
|
sample: httpd
|
|
|
|
uid:
|
|
|
|
uid:
|
|
|
|
description: Owner id of the file, after execution
|
|
|
|
description: Owner id of the file, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: int
|
|
|
|
type: int
|
|
|
|
sample: 100
|
|
|
|
sample: 100
|
|
|
|
mode:
|
|
|
|
mode:
|
|
|
|
description: Permissions of the target, after execution
|
|
|
|
description: Permissions of the target, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: 0644
|
|
|
|
sample: 0644
|
|
|
|
size:
|
|
|
|
size:
|
|
|
|
description: Size of the target, after execution
|
|
|
|
description: Size of the target, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: int
|
|
|
|
type: int
|
|
|
|
sample: 1220
|
|
|
|
sample: 1220
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description: State of the target, after execution
|
|
|
|
description: State of the target, after execution.
|
|
|
|
returned: success
|
|
|
|
returned: success
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
sample: file
|
|
|
|
sample: file
|
|
|
|