Thanks Kai, I tried and narrowed down the following:
# strace on isdir
$ diff nfs_{bad,good}.log
1,2c1,2
< user2 ~> sudo -H strace -f python -c 'import os; print
os.path.isdir("nfsdir")'
< execve("/usr/bin/python", ["python", "-c", "import os; print
os.path.isdir(\""...], [/* 17 vars */]) = 0
---
> user1 ~$ sudo -H strace -f python -c 'import os; print
os.path.isdir("nfsdir")'
> execve("/usr/bin/python", ["python", "-c", "import os; print
os.path.isdir(\""...], [/* 14 vars */]) = 0
762,765c762,765
< stat("nfsdir", 0xADDRESS) = -1 EACCES (Permission denied)
< fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
< write(1, "False\n", 6False
< ) = 6
---
> stat("nfsdir", {st_mode=S_IFDIR|0755, st_size=4, ...}) = 0
> fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 7), ...}) = 0
> write(1, "True\n", 5True
> ) = 5
So isdir is failing on the bad system, specifically a stat call is failing.
And running stat directly confirms this:
# stats on dirs
$ diff {bad,good}_stat.log
1,2c1,9
< user2 ~> sudo stat nfsdir
< stat: cannot stat '/home/user2/nfsdir': Permission denied
---
> user1 ~$ sudo stat nfsdir
> File: nfsdir
> Size: 4 Blocks: 3 IO Block: 8192 directory
> Device: 36h/54d Inode: 384033 Links: 2
> Access: (0755/drwxr-xr-x) Uid: ( 5954/ user1) Gid: ( 101/ users)
> Access: 2019-06-06 14:14:23.025878969 -0400
> Modify: 2019-08-14 15:37:43.576408706 -0400
> Change: 2019-08-14 15:37:43.576408706 -0400
> Birth: -
So the "bad" machine is setup to not allow sudo to be able to see the nfs
mount for the network user "user2".
On Wednesday, August 14, 2019 at 4:16:53 PM UTC-4, Kai Stian Olstad wrote:
>
> On 14.08.2019 21:12, Larry Kyrala wrote:
> > "matched": 0,
> > "msg": "deployments/ was skipped as it does not seem to be a valid
> > directory or it cannot be accessed\n"
> > }
> >
> >
> >
> >
> > # script that is failing - deploy/main.yml:
> >
> >
> > - name: find deployments
> > find:
> > paths: deployments/
> > patterns: "*.json"
> > excludes: "sample_deployment.json"
> > register: files_matched
> >
> >
> >
> >
> > # directory permissions from within the VM:
>
> It can be a few possibilities, since you are using relative path it
> might not search in correct paths.
> The easiest way to see what happens might be strace on the failing
> machine
>
> strace -f ansible-playbook deploy.yml --ask-become-pass 2>&1 | grep
> deployments
>
> This will show every system call against deployments
>
>
> The find module stops after it test deployments/ is a directory with
> os.path.isdir, you can test it with this code and is should print True,
> since you are using become you should run this with sudo.
>
> sudo -H python -c 'import os; print os.path.isdir("deployments/")'
>
>
> --
> Kai Stian Olstad
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/38f04648-0b47-4f41-8741-078378593b77%40googlegroups.com.