I just found out that Ansible does not handle Sparse Files (A file with 
true empty space inside it) properly with the copy module.  I don't think 
this is a bug, but somebody should mention this in the documentation. 

http://en.wikipedia.org/wiki/Sparse_file

Code to make a sparse file

#!/usr/bin/perl
## Code Blatantly stolen from Elizabeth Zwicky
#
open (HOLEYFILE, ">filewithbighole") ||
    warn "Can't create filewithbighole\n";

    select (HOLEYFILE);
    $| = 1;
    select (STDOUT);

    seek (HOLEYFILE, 1024* 1024 * 1024, 0); 
    print HOLEYFILE "After the hole\n";

    
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
 
= stat HOLEYFILE;

    if ($blocks * $blksize == $size) {
        warn "My holey file had no holes!\n";
    }

    close HOLEYFILE;


Ansible command

 

ansible AIX-7.1 -m copy -a "src=/home/ME/filewithbighole 
dest=/tmp/filewithbighole"

It fails as running out of disk space.  It's not a big deal as there are 
workarounds, like tar-ing up the file with the -S option to efficiently handle 
Sparse files.


[ME@ansible ~]$ ls -l filewithbighole
-rw-r--r--. 1 urew users 1073741839 Oct  5 18:44 filewithbighole

[ME@ansible ~]$ du -k filewithbighole
4       filewithbighole

[ME@ansible ~]$ !tar
tar -Scf filewithbighole.tar ./filewithbighole 

[ME@ansible ~]$ ls -lt filewithbighole.tar
-rw-r--r--. 1 urew users 10240 Oct  5 18:48 filewithbighole.tar

[ME@ansible ~]$ du -k filewithbighole.tar
12      filewithbighole.tar


>>>>Ericw

-- 
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/5928585b-e458-4e0c-b9a4-fc056a3164f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to