Directory always marked as changed

Hello,

I have the following in a role definition for jenkins:

- name: Ensure jenkins .vnc directory does exist.
  file:
    path: /var/lib/jenkins/.vnc/
    state: directory
    owner: jenkins
    group: jenkins
    mode: 0750

Whenever I run the playbook, this directory creation is always marked
as changed.

Immediately before this I run:

- name: Ensure jenkins .m2 directory does exist.
  file:
    path: /var/lib/jenkins/.m2/
    state: directory
    owner: jenkins
    group: jenkins
    mode: 0750

and this one is only created once and marked as unchanged.

Regards Mirko

This is the output when run with -vvvv:

TASK: [jenkins | Ensure jenkins .m2 directory does exist.] ********************

<vagrant> ESTABLISH CONNECTION FOR USER: mirko

<vagrant> REMOTE_MODULE file group=jenkins state=directory
path=/var/lib/jenkins/.m2/ owner=jenkins

<vagrant> EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s
-o ControlPath="/Users/mirko/.ansible/cp/ansible-ssh-%h-%p-%r" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 vagrant /bin/sh -c
'sudo -k && sudo -H -S -p "[sudo via ansible,
key=rbqtthfimuwodmabehkrbxsfieetegtb] password: " -u root /bin/sh -c
'"'"'echo SUDO-SUCCESS-rbqtthfimuwodmabehkrbxsfieetegtb;
LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python'"'"''

ok: [vagrant] => {"changed": false, "gid": 108, "group": "jenkins",
"mode": "0750", "owner": "jenkins", "path": "/var/lib/jenkins/.m2/",
"size": 4096, "state": "directory", "uid": 105}

TASK: [jenkins | Ensure jenkins .vnc directory does exist.] *******************

<vagrant> ESTABLISH CONNECTION FOR USER: mirko

<vagrant> REMOTE_MODULE file group=jenkins state=directory
path=/var/lib/jenkins/.vnc/ owner=jenkins

<vagrant> EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s
-o ControlPath="/Users/mirko/.ansible/cp/ansible-ssh-%h-%p-%r" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10 vagrant /bin/sh -c
'sudo -k && sudo -H -S -p "[sudo via ansible,
key=pwxhksukesiwspzugtteoadivjokjvaq] password: " -u root /bin/sh -c
'"'"'echo SUDO-SUCCESS-pwxhksukesiwspzugtteoadivjokjvaq;
LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python'"'"''

changed: [vagrant] => {"changed": true, "gid": 108, "group":
"jenkins", "mode": "0750", "owner": "jenkins", "path":
"/var/lib/jenkins/.vnc/", "size": 4096, "state": "directory", "uid":
105}

I am using ansible-1.8.2 on Mac OS X, the provisioned host is a
vagrant instance.
Regards Mirko

Hello,

has no one a hint what might be going wrong :-).
Regards Mirko

Things work as expected for me in my vagrant test.

http://paste.openstack.org/show/150780/

What version of Ansible were you using?

Thanks!

Hello,

sorry for the noise and thanks for all answers. I had copied an old /etc/defaults/jenkins configuration file where the mode was always changed to 0700. So every time ansible checked whether Jenkins was running by calling the init.d script, the mode was reset to above value.

Regards
Mirko