Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install local PKI scripts: Text file busy #38

Open
starise opened this issue Feb 9, 2016 · 4 comments
Open

Install local PKI scripts: Text file busy #38

starise opened this issue Feb 9, 2016 · 4 comments

Comments

@starise
Copy link

starise commented Feb 9, 2016

I stumbled upon this error:

TASK [debops.pki : Install local PKI scripts] **********************************
task path: /home/vagrant/catena/roles/debops.pki/tasks/main.yml:32
ESTABLISH LOCAL CONNECTION FOR USER: vagrant
localhost EXEC rc=flag; [ -r /home/vagrant/catena/inventory/../secret/pki/lib/pki-authority ] || rc=2; [ -f /home/vagrant/catena/inventory/../secret/pki/lib/pki-authority ] || rc=1; [ -d /home/vagrant/catena/inventory/../secret/pki/lib/pki-authority ] && rc=3; /usr/bin/python -V 2>/dev/null || rc=4; [ x"$rc" != "xflag" ] && echo "${rc}  "/home/vagrant/catena/inventory/../secret/pki/lib/pki-authority && exit 0; (/usr/bin/python -c 'import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();
afile = open("'/home/vagrant/catena/inventory/../secret/pki/lib/pki-authority'", "rb")
buf = afile.read(BLOCKSIZE)
while len(buf) > 0:
        hasher.update(buf)
        buf = afile.read(BLOCKSIZE)
afile.close()
print(hasher.hexdigest())' 2>/dev/null) || (/usr/bin/python -c 'import sha; BLOCKSIZE = 65536; hasher = sha.sha();
afile = open("'/home/vagrant/catena/inventory/../secret/pki/lib/pki-authority'", "rb")
buf = afile.read(BLOCKSIZE)
while len(buf) > 0:
        hasher.update(buf)
        buf = afile.read(BLOCKSIZE)
afile.close()
print(hasher.hexdigest())' 2>/dev/null) || (echo '0  '/home/vagrant/catena/inventory/../secret/pki/lib/pki-authority)
localhost EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1455030274.0-84911499590959 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1455030274.0-84911499590959 )" )
localhost PUT /home/vagrant/catena/roles/debops.pki/files/secret/pki/lib/pki-authority TO /home/vagrant/.ansible/tmp/ansible-tmp-1455030274.0-84911499590959/source
localhost EXEC ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1455030274.01-251127249931061 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1455030274.01-251127249931061 )" )
localhost PUT /tmp/tmpEWM0vg TO /home/vagrant/.ansible/tmp/ansible-tmp-1455030274.01-251127249931061/copy
localhost EXEC LANG=it_IT.UTF-8 LC_ALL=it_IT.UTF-8 LC_MESSAGES=it_IT.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1455030274.01-251127249931061/copy; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1455030274.01-251127249931061/" > /dev/null 2>&1
fatal: [catena -> localhost]: FAILED! => {"changed": false, "checksum": "9164ed19f42472f4c5dc197731c47f3240789134", "failed": true, "invocation": {"module_args": {"backup": false, "content": null, "delimiter": null, "dest": "/home/vagrant/catena/inventory/../secret/pki/lib/", "directory_mode": null, "follow": false, "force": true, "group": null, "mode": "0755", "original_basename": "pki-authority", "owner": null, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/home/vagrant/.ansible/tmp/ansible-tmp-1455030274.0-84911499590959/source", "validate": null}}, "msg": "Could not replace file: /home/vagrant/.ansible/tmp/ansible-tmp-1455030274.0-84911499590959/source to /home/vagrant/catena/inventory/../secret/pki/lib/pki-authority: [Errno 26] Text file busy"}

Ansible installed and running into the guest machine (ubuntu 14.04, windows 10 host) where /home/vagrant/ is a mounted shared folder via Vagrant/Virtualbox.

Any suggestion?

@drybjed
Copy link
Member

drybjed commented Feb 9, 2016

It seems to be an issue with Ansible and non-POSIX filesystems mounted by Vagrant. Seems to be quite a popular bug when Ansible is messing with the shared folders...

For a quick fix, you could try moving the secret/ DebOps directory, either relative to Ansible inventory, or absolute, to somewhere inside of the Virtualbox filesystem. You can use these variables to change its location through Ansible inventory, so that debops.pki role can pick it up in the new place.

Alternatively you could try copying the files/secret/pki/lib/pki-authority script to secret/pki/lib/ directory and see if Ansible will "accept it" without raising an error.

As for the long term solution, since this will probably show up often due to people using Vagrant frequently... I'm not sure yet. Use non-POSIX filesystem for DebOps secret/ directory?

@starise
Copy link
Author

starise commented Feb 9, 2016

Thanks a lot for your fast and very detailed answer. Either solutions work. Manually copying these files to secret/pki/lib (and make sure they are always there) looks like a faster solution.

Solve permanently the issue it's a little problematic, because Windows doesn't work natively with POSIX file systems and has in general bad interoperability with 3rd party platforms.

@thiagotalma
Copy link
Contributor

I would love to see this problem solved.... 😍

@drybjed
Copy link
Member

drybjed commented Apr 18, 2016

@thiagotalma Not using Vagrant shared folders for DebOps secret/ directory should solve this issue. For example try using an NFS-mounted share stored in a Linux host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants