FAQ
- name: Create test
   file:
     path: /srv/test
     state: directory
     mode: 2770
     owner: root
     group: admin

Output of -v
{"changed": true, "gid": 6003, "group": "admin", "mode": "05322", "owner":
"root", "path": "/srv/test", "size": 4096, "state": "directory", "uid": 0}

So the mode of 2770 somehow gets converted to 05322

So any mode with SetGID, SetUID or SetSticky, gets mangled.
Tried in 1.6 and 1.7

1770 -> 03352
2770 -> 05322
4770 -> 01242

I should convert the end permissions to octal and see if there is a
pattern. Will do later. Just want to post this for now and see if someone
knows anything about this.

Thanks
Deon

--
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-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Greg Andrews at Aug 10, 2014 at 10:39 pm
    There's no leading "0" on your mode number 2770. In Perl, the run-time
    parses numbers as decimal unless they have certain hint prefixes, like "0x"
    for hexadecimal and "0" for octal.

    I don't know how Python parses numbers, but 2770 decimal = 5322 octal, so
    it looks like that may be the source of the confusion. The ansible.com
    docs for the file module don't address this explicitly, but both the
    examples have a leading "0" in the mode number. It looks to me like a mode
    number of "02770" is what you need.

       -Greg


    On Sun, Aug 10, 2014 at 10:00 AM, Deon Bredenhann wrote:

    - name: Create test
    file:
    path: /srv/test
    state: directory
    mode: 2770
    owner: root
    group: admin

    Output of -v
    {"changed": true, "gid": 6003, "group": "admin", "mode": "05322", "owner":
    "root", "path": "/srv/test", "size": 4096, "state": "directory", "uid": 0}

    So the mode of 2770 somehow gets converted to 05322

    So any mode with SetGID, SetUID or SetSticky, gets mangled.
    Tried in 1.6 and 1.7

    1770 -> 03352
    2770 -> 05322
    4770 -> 01242

    I should convert the end permissions to octal and see if there is a
    pattern. Will do later. Just want to post this for now and see if someone
    knows anything about this.

    Thanks
    Deon

    --
    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-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPdwyX6ka_TymsSuJqdp0UijOwrAsT8_K%3DVQbu3tqEiM%3Dk57hA%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael DeHaan at Aug 11, 2014 at 12:28 pm
    Ansible contains some fuzzy logic for this.

    Basically, if the number is a string, it will assume octal.

    If you pass in a decimal, as you have done above, it will assume you know
    what you are doing. (Most people use short-form arguments in Ansible, here
    you've split to another line and passed a decimal - which is fine).

    So yes, this would be it.

    Alternatively, this would also fit:

    mode: "777"



    On Sun, Aug 10, 2014 at 6:39 PM, Greg Andrews wrote:


    There's no leading "0" on your mode number 2770. In Perl, the run-time
    parses numbers as decimal unless they have certain hint prefixes, like "0x"
    for hexadecimal and "0" for octal.

    I don't know how Python parses numbers, but 2770 decimal = 5322 octal, so
    it looks like that may be the source of the confusion. The ansible.com
    docs for the file module don't address this explicitly, but both the
    examples have a leading "0" in the mode number. It looks to me like a mode
    number of "02770" is what you need.

    -Greg


    On Sun, Aug 10, 2014 at 10:00 AM, Deon Bredenhann wrote:

    - name: Create test
    file:
    path: /srv/test
    state: directory
    mode: 2770
    owner: root
    group: admin

    Output of -v
    {"changed": true, "gid": 6003, "group": "admin", "mode": "05322",
    "owner": "root", "path": "/srv/test", "size": 4096, "state": "directory",
    "uid": 0}

    So the mode of 2770 somehow gets converted to 05322

    So any mode with SetGID, SetUID or SetSticky, gets mangled.
    Tried in 1.6 and 1.7

    1770 -> 03352
    2770 -> 05322
    4770 -> 01242

    I should convert the end permissions to octal and see if there is a
    pattern. Will do later. Just want to post this for now and see if someone
    knows anything about this.

    Thanks
    Deon

    --
    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-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAPdwyX6ka_TymsSuJqdp0UijOwrAsT8_K%3DVQbu3tqEiM%3Dk57hA%40mail.gmail.com
    <https://groups.google.com/d/msgid/ansible-project/CAPdwyX6ka_TymsSuJqdp0UijOwrAsT8_K%3DVQbu3tqEiM%3Dk57hA%40mail.gmail.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    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-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzQHqPnNVUU%3DgUCMhmzSinAGSbSAOVh9VuGP0%3DT3gYbmg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Deon Bredenhann at Aug 12, 2014 at 8:32 am
    Thank you Greg and Michael.

    That was the whole solution to the problem.
    On Monday, 11 August 2014 14:28:25 UTC+2, Michael DeHaan wrote:

    Ansible contains some fuzzy logic for this.

    Basically, if the number is a string, it will assume octal.

    If you pass in a decimal, as you have done above, it will assume you know
    what you are doing. (Most people use short-form arguments in Ansible, here
    you've split to another line and passed a decimal - which is fine).

    So yes, this would be it.

    Alternatively, this would also fit:

    mode: "777"




    On Sun, Aug 10, 2014 at 6:39 PM, Greg Andrews <hva...@gmail.com
    <javascript:>> wrote:
    There's no leading "0" on your mode number 2770. In Perl, the run-time
    parses numbers as decimal unless they have certain hint prefixes, like "0x"
    for hexadecimal and "0" for octal.

    I don't know how Python parses numbers, but 2770 decimal = 5322 octal, so
    it looks like that may be the source of the confusion. The ansible.com
    docs for the file module don't address this explicitly, but both the
    examples have a leading "0" in the mode number. It looks to me like a mode
    number of "02770" is what you need.

    -Greg



    On Sun, Aug 10, 2014 at 10:00 AM, Deon Bredenhann <dbred...@gmail.com
    <javascript:>> wrote:
    - name: Create test
    file:
    path: /srv/test
    state: directory
    mode: 2770
    owner: root
    group: admin

    Output of -v
    {"changed": true, "gid": 6003, "group": "admin", "mode": "05322",
    "owner": "root", "path": "/srv/test", "size": 4096, "state": "directory",
    "uid": 0}

    So the mode of 2770 somehow gets converted to 05322

    So any mode with SetGID, SetUID or SetSticky, gets mangled.
    Tried in 1.6 and 1.7

    1770 -> 03352
    2770 -> 05322
    4770 -> 01242

    I should convert the end permissions to octal and see if there is a
    pattern. Will do later. Just want to post this for now and see if someone
    knows anything about this.

    Thanks
    Deon

    --
    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 <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com
    <https://groups.google.com/d/msgid/ansible-project/36ed2d34-e94d-475f-b8a8-a1a00631fdd5%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    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 <javascript:>.
    To post to this group, send email to ansible...@googlegroups.com
    <javascript:>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/ansible-project/CAPdwyX6ka_TymsSuJqdp0UijOwrAsT8_K%3DVQbu3tqEiM%3Dk57hA%40mail.gmail.com
    <https://groups.google.com/d/msgid/ansible-project/CAPdwyX6ka_TymsSuJqdp0UijOwrAsT8_K%3DVQbu3tqEiM%3Dk57hA%40mail.gmail.com?utm_medium=email&utm_source=footer>
    .

    For more options, visit https://groups.google.com/d/optout.
    --
    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-project+unsubscribe@googlegroups.com.
    To post to this group, send email to ansible-project@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3676b9b7-fd3c-4698-ae25-81f7d6208656%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupansible-project @
postedAug 10, '14 at 5:00p
activeAug 12, '14 at 8:32a
posts4
users3

People

Translate

site design / logo © 2021 Grokbase