file mode

Hi folks.

Perhaps i´m wrong, but if i set a file mode with:

  • file:
    path: /usr/lib/rssh/rssh_chroot_helper
    mode: 4755

I would expect something like:
-rwsr-xr-x 1 root root 30728 Nov 8 2014 rssh_chroot_helper

But i get this as result:

–w–w–wt 1 root root 30728 Nov 8 2014 rssh_chroot_helper

Am i going wrong or is this a bug?

kind regards
Michael

It documented under mode parameter here
https://docs.ansible.com/ansible/file_module.html#options

"For those used to /usr/bin/chmod remember that modes are actually octal numbers (like 0644). Leaving off the leading zero will likely have unexpected results."

What you actually want is this:

oct(4755)
‘0o11223’

→ rwsr-xr-x

But this is what you got:

oct(658)
‘0o1222’
→ -w–w–wt

In your case Ansible dropping the trailing “3”.

Just use 04755 as mode argument.