Much appreciated Jordan! Thank you Lukas
Am Montag, 6. Mai 2019 22:34:22 UTC+2 schrieb Jordan Borean: > > Hi > > The "force" parameter controls what check is used to determine whether a > copy needs to occur; > > - force=no: The file on the controller is only copied when dest does > not already exist. > - force=yes (default): The file on the controller is only copied when > dest does not exist, or dest has a different checksum > > The checksum part in the docs just refers to how checksums are not used to > detect when a copy needs to occur. Here is an example workflow for win_copy > when remote_src=no: > > 1. If using content, it builds a tmp file on the controller that has > the content placed in it > 2. Builds a listing of the file(s) to copy from the controller to the > destination file > 1. If force=yes, this listing will include the sha1 checksum of > each file to by copied across > 3. Sends this listing across to the Windows host. It then filters the > list to include the file(s) that need to be copied across > 1. When force=no, files are only set to be copied when they don't > exist, no checksum is done here > 2. When force=yes, files are set to be copied when they don't > exist, or their checksum does not match that value in the listing sent > by > the controller > 4. The controller then checks the returned list, if there are no files > to copy, it returns 'changed=False' > 5. If only a single file needs to be copied, it is sent across as is. > If multiple files need to be copied, it is compressed to a single zip > which > is then sent across > 1. When sending a file it is first sent to a temp directory, this > is controlled with the ansible_remote_tmp variable > 2. Before copying the file a sha1 checksum of the src path is > performed, this happens regardless of the force setting > 3. After copying, a sha1 checksum is calculated and compared > against the src checksum. If it does not match then a failure will occur > 6. Once the file is copied across, the file is then copied to the > correct dest path > 1. If a single file, this is just copied as is > 2. If it is multiple files (zip), the zip is expanded and copied to > the proper dest paths > > As you can see there are multiple steps in the win_copy execution. The > force module option just controls the idempotency checks, Ansible will > still perform a checksum validation when copying the file to ensure nothing > was lost during the transfer so there shouldn't be any uncaught corruption. > If you are wanting to hard code a checksum for a file with a specific > checksum this would still need to be done with win_stat or stat + > 'delegate_to: localhost' before the file is actually copied. > > Unfortunately I think force is a poor name for this module option but it > is there for historical and compatibility reasons with the copy module. > > Thanks > > Jordan > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ef22213d-e90e-4735-934b-aeae931092f3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
