Operation not permitted error, Vagrant-cachier, Ansible Unarchive module

Problem:

Setting up DrupalVM to use the vagrant-cachier plugin, I was getting "Operation not permitted ..." errors in the task Untar Xdebug.

Apparently, because the task was running with become,  tar was trying to change the owner / group of the unarchived files.  From the man page:

--same-owner
try extracting files with the same ownership as exists in the archive (default for superuser)

However, on an nfs synced folder, that's not allowed.

Solution:

Add --no-same-owner as an extra_opts argument:

- name: Untar some file.
  unarchive:
    src: "https://example.com/archive.tgz"
    dest: "/some/dir"
    extra_opts: "--no-same-owner"
    creates: "/some/dir/unarchived"
    copy: No

 

Add new comment