Directory always marked as changed

128 views
Skip to first unread message

Mirko Friedenhagen

unread,
Dec 10, 2014, 2:46:46 PM12/10/14
to ansible-project
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
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/ (http://osrc.dfm.io/mfriedenhagen)
https://bitbucket.org/mfriedenhagen/

Mirko Friedenhagen

unread,
Dec 10, 2014, 2:52:09 PM12/10/14
to ansible-project
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.

Mirko Friedenhagen

unread,
Dec 14, 2014, 3:16:26 PM12/14/14
to ansible-project
Hello,

has no one a hint what might be going wrong :-).
On Wed, Dec 10, 2014 at 8:46 PM, Mirko Friedenhagen
<mfried...@gmail.com> wrote:

John Dewey

unread,
Dec 14, 2014, 5:08:46 PM12/14/14
to ansible...@googlegroups.com
Things work as expected for me in my vagrant test.

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
Dec 15, 2014, 7:06:07 AM12/15/14
to ansible...@googlegroups.com
What version of Ansible were you using?

Thanks!

Mirko Friedenhagen

unread,
Dec 15, 2014, 12:26:55 PM12/15/14
to ansible-project

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
--
Sent from my mobile

Reply all
Reply to author
Forward
0 new messages