Vagrant Failed to Upload a File to the Guest Vm via Scp Due to a Permissions File Already Exists

  • AnsibleFest
  • Products
  • Community
  • Webinars & Training
  • Weblog

Documentation


copy - Copies files to remote locations¶

  • Synopsis
  • Parameters
  • Notes
  • Examples
  • Return Values
  • Status
    • Back up
    • Author

Synopsis¶

  • The copy module copies a file from the local or remote auto to a location on the remote machine. Utilize the fetch module to copy files from remote locations to the local box. If you need variable interpolation in copied files, employ the template module.
  • For Windows targets, use the win_copy module instead.

Parameters¶

Parameter Choices/Defaults Comments
attributes

(added in two.3)

Default:

None

Attributes the file or directory should have. To get supported flags look at the human being page for chattr on the target system. This string should incorporate the attributes in the same gild as the i displayed by lsattr.

aliases: attr

backup
    Choices:
  • no ←

  • yep

Create a backup file including the timestamp information and so you can get the original file back if you somehow clobbered information technology incorrectly.

checksum

(added in 2.5)

SHA1 checksum of the file being transferred. Used to valdiate that the copy of the file was successful.

If this is not provided, ansible will use the local calculated checksum of the src file.

content

When used instead of src, sets the contents of a file straight to the specified value. For annihilation advanced or with formatting also look at the template module.

decrypt

(added in 2.4)

    Choices:
  • no
  • yeah
Default:

Yes

This option controls the autodecryption of source files using vault.

dest

required

Remote absolute path where the file should be copied to. If src is a directory, this must be a directory too. If dest is a nonexistent path and if either dest ends with "/" or src is a directory, dest is created. If src and dest are files, the parent directory of dest isn't created: the task fails if it doesn't already be.

directory_mode

(added in 1.five)

When doing a recursive re-create prepare the fashion for the directories. If this is non prepare we will use the organisation defaults. The fashion is but assail directories which are newly created, and volition not affect those that already existed.

follow

(added in 1.8)

    Choices:
  • no ←

  • yes

This flag indicates that filesystem links in the destination, if they exist, should be followed.

force
    Choices:
  • no
  • yeah ←

the default is yes, which will replace the remote file when contents are dissimilar than the source. If no, the file will only be transferred if the destination does not exist.

aliases: thirsty

group Default:

None

Proper noun of the grouping that should own the file/directory, as would exist fed to chown.

local_follow

(added in 2.four)

    Choices:
  • no
  • yes ←

This flag indicates that filesystem links in the source tree, if they exist, should exist followed.

mode Default:

None

Mode the file or directory should exist. For those used to /usr/bin/chmod remember that modes are actually octal numbers (similar 0644 or 01777). Leaving off the leading zero will likely take unexpected results. As of version 1.8, the style may be specified every bit a symbolic mode (for example, u+rwx or u=rw,one thousand=r,o=r).

owner Default:

None

Proper noun of the user that should own the file/directory, as would be fed to chown.

remote_src

(added in two.0)

    Choices:
  • no ←

  • yep

If no, it will search for src at originating/main machine.

If aye it will go to the remote/target automobile for the src. Default is no.

Currently remote_src does not back up recursive copying.

selevel Default:

s0

Level part of the SELinux file context. This is the MLS/MCS attribute, sometimes known every bit the range. _default feature works equally for seuser.

serole Default:

None

Part part of SELinux file context, _default feature works as for seuser.

setype Default:

None

Type part of SELinux file context, _default characteristic works as for seuser.

seuser Default:

None

User part of SELinux file context. Will default to organisation policy, if applicable. If fix to _default, it will employ the user portion of the policy if available.

src

Local path to a file to copy to the remote server; can exist absolute or relative. If path is a directory, it is copied recursively. In this case, if path ends with "/", but within contents of that directory are copied to destination. Otherwise, if information technology does non end with "/", the directory itself with all contents is copied. This behavior is like to Rsync.

unsafe_writes

(added in 2.ii)

    Choices:
  • no ←

  • yes

Normally this module uses atomic operations to forestall data corruption or inconsistent reads from the target files, sometimes systems are configured or just cleaved in ways that prevent this. Ane example are docker mounted files, they cannot be updated atomically and tin only be done in an unsafe manner.

This boolean selection allows ansible to fall back to unsafe methods of updating files for those cases in which you exercise non have any other choice. Be aware that this is subject field to race weather and tin lead to information corruption.

validate Default:

None

The validation command to run before copying into identify. The path to the file to validate is passed in via '%s' which must be present as in the example below. The command is passed securely and so beat features like expansion and pipes won't piece of work.


Notes¶

Annotation

  • The copy module recursively copy facility does not scale to lots (>hundreds) of files. For alternative, see synchronize module, which is a wrapper around rsync .
  • For Windows targets, utilize the win_copy module instead.

Examples¶

                                    -                  name                  :                  instance copying file with owner and permissions                  copy                  :                  src                  :                  /srv/myfiles/foo.conf                  dest                  :                  /etc/foo.conf                  owner                  :                  foo                  group                  :                  foo                  style                  :                  0644                  -                  proper name                  :                  The same example as above, but using a symbolic mode equivalent to 0644                  copy                  :                  src                  :                  /srv/myfiles/foo.conf                  dest                  :                  /etc/foo.conf                  owner                  :                  foo                  grouping                  :                  foo                  mode                  :                  u=rw,thou=r,o=r                  -                  name                  :                  Another symbolic way example, adding some permissions and removing others                  re-create                  :                  src                  :                  /srv/myfiles/foo.conf                  dest                  :                  /etc/foo.conf                  owner                  :                  foo                  grouping                  :                  foo                  manner                  :                  u+rw,thou-wx,o-rwx                  -                  proper noun                  :                  Copy a new "ntp.conf file into place, backing upwardly the original if it differs from the copied version                  copy                  :                  src                  :                  /mine/ntp.conf                  dest                  :                  /etc/ntp.conf                  owner                  :                  root                  group                  :                  root                  manner                  :                  0644                  backup                  :                  yeah                  -                  name                  :                  Copy a new "sudoers" file into place, after passing validation with visudo                  copy                  :                  src                  :                  /mine/sudoers                  dest                  :                  /etc/sudoers                  validate                  :                  /usr/sbin/visudo -cf %s                  -                  name                  :                  Copy a "sudoers" file on the remote auto for editing                  copy                  :                  src                  :                  /etc/sudoers                  dest                  :                  /etc/sudoers.edit                  remote_src                  :                  yes                  validate                  :                  /usr/sbin/visudo -cf %s                  -                  name                  :                  Copy using the 'content' for inline data                  copy                  :                  content                  :                  '#                                                      This                                                      file                                                      was                                                      moved                                                      to                                                      /etc/other.conf'                  dest                  :                  /etc/mine.conf'                

Return Values¶

Common return values are documented here, the following are the fields unique to this module:

Primal Returned Description
backup_file

string

changed and if backup=yes

name of backup file created

Sample:

/path/to/[electronic mail protected]:09~

checksum

cord

success

sha1 checksum of the file afterwards running copy

Sample:

6e642bb8dd5c2e027bf21dd923337cbb4214f827

dest

string

success

destination file/path

Sample:

/path/to/file.txt

gid

int

success

grouping id of the file, after execution

Sample:

100

group

string

success

group of the file, afterward execution

Sample:

httpd

md5sum

string

when supported

md5 checksum of the file later running copy

Sample:

2a5aeecc61dc98c4d780b14b330e3282

mode

cord

success

permissions of the target, subsequently execution

Sample:

420

possessor

cord

success

owner of the file, after execution

Sample:

httpd

size

int

success

size of the target, after execution

Sample:

1220

src

string

changed

source file used for the copy on the target machine

Sample:

/abode/httpd/.ansible/tmp/ansible-tmp-1423796390.97-147729857856000/source

state

string

success

state of the target, after execution

Sample:

file

uid

int

success

owner id of the file, after execution

Sample:

100

Condition¶

This module is flagged as stableinterface which ways that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

Author¶

  • Ansible Core Team
  • Michael DeHaan

Hint

If y'all notice any issues in this documentation you tin can edit this document to improve it.

delorenzoleord1942.blogspot.com

Source: https://docs.ansible.com/ansible/2.5/modules/copy_module.html

0 Response to "Vagrant Failed to Upload a File to the Guest Vm via Scp Due to a Permissions File Already Exists"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel