Ansible Windows ACL











up vote
0
down vote

favorite












Using Ansible 2.7, I want to change ACL for a particular Windows folder, if it exists.



Here the code I use :



  - name: check that folder exists
win_stat:
path: C:Program Files (x86)MyFolder
register: folderPresent

- name: cut ACL inheritance and copy existing ones
win_acl_inheritance:
path: C:Program Files (x86)MyFolder
state: absent
reorganize: yes
when: folderPresent.stat.exists

- name: Add write right for authenticated users
win_acl:
path: C:Program Files (x86)MyFolder
user: ThisMachineUtilisateurs
rights: Write
type: allow
state: present
inherit: ContainerInherit, ObjectInherit
propagation: 'InheritOnly'
when: folderPresent.stat.exists


The problem occurs with the win_acl command. I get : "an error occurred when attempting to present Write permission(s) on C:Program Files (x86)MyFolder", followed by a french nessage "Impossible de traduire certaines ou toutes les références d'identité." (that translates to impossible to translate some or all identity references).



The Windows machines I am dealing with are installed in French, so my assumption is that I am not specifying the ACL target user correctly.



So far I have tried many variations for the "user" parameter for the win_acl command :




  • ThisMachineUtilisateurs

  • BUILTINUtilisateurs

  • ThisMachineUsers

  • S-1-5-32-545

  • ...


But none of them works...










share|improve this question


























    up vote
    0
    down vote

    favorite












    Using Ansible 2.7, I want to change ACL for a particular Windows folder, if it exists.



    Here the code I use :



      - name: check that folder exists
    win_stat:
    path: C:Program Files (x86)MyFolder
    register: folderPresent

    - name: cut ACL inheritance and copy existing ones
    win_acl_inheritance:
    path: C:Program Files (x86)MyFolder
    state: absent
    reorganize: yes
    when: folderPresent.stat.exists

    - name: Add write right for authenticated users
    win_acl:
    path: C:Program Files (x86)MyFolder
    user: ThisMachineUtilisateurs
    rights: Write
    type: allow
    state: present
    inherit: ContainerInherit, ObjectInherit
    propagation: 'InheritOnly'
    when: folderPresent.stat.exists


    The problem occurs with the win_acl command. I get : "an error occurred when attempting to present Write permission(s) on C:Program Files (x86)MyFolder", followed by a french nessage "Impossible de traduire certaines ou toutes les références d'identité." (that translates to impossible to translate some or all identity references).



    The Windows machines I am dealing with are installed in French, so my assumption is that I am not specifying the ACL target user correctly.



    So far I have tried many variations for the "user" parameter for the win_acl command :




    • ThisMachineUtilisateurs

    • BUILTINUtilisateurs

    • ThisMachineUsers

    • S-1-5-32-545

    • ...


    But none of them works...










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Using Ansible 2.7, I want to change ACL for a particular Windows folder, if it exists.



      Here the code I use :



        - name: check that folder exists
      win_stat:
      path: C:Program Files (x86)MyFolder
      register: folderPresent

      - name: cut ACL inheritance and copy existing ones
      win_acl_inheritance:
      path: C:Program Files (x86)MyFolder
      state: absent
      reorganize: yes
      when: folderPresent.stat.exists

      - name: Add write right for authenticated users
      win_acl:
      path: C:Program Files (x86)MyFolder
      user: ThisMachineUtilisateurs
      rights: Write
      type: allow
      state: present
      inherit: ContainerInherit, ObjectInherit
      propagation: 'InheritOnly'
      when: folderPresent.stat.exists


      The problem occurs with the win_acl command. I get : "an error occurred when attempting to present Write permission(s) on C:Program Files (x86)MyFolder", followed by a french nessage "Impossible de traduire certaines ou toutes les références d'identité." (that translates to impossible to translate some or all identity references).



      The Windows machines I am dealing with are installed in French, so my assumption is that I am not specifying the ACL target user correctly.



      So far I have tried many variations for the "user" parameter for the win_acl command :




      • ThisMachineUtilisateurs

      • BUILTINUtilisateurs

      • ThisMachineUsers

      • S-1-5-32-545

      • ...


      But none of them works...










      share|improve this question













      Using Ansible 2.7, I want to change ACL for a particular Windows folder, if it exists.



      Here the code I use :



        - name: check that folder exists
      win_stat:
      path: C:Program Files (x86)MyFolder
      register: folderPresent

      - name: cut ACL inheritance and copy existing ones
      win_acl_inheritance:
      path: C:Program Files (x86)MyFolder
      state: absent
      reorganize: yes
      when: folderPresent.stat.exists

      - name: Add write right for authenticated users
      win_acl:
      path: C:Program Files (x86)MyFolder
      user: ThisMachineUtilisateurs
      rights: Write
      type: allow
      state: present
      inherit: ContainerInherit, ObjectInherit
      propagation: 'InheritOnly'
      when: folderPresent.stat.exists


      The problem occurs with the win_acl command. I get : "an error occurred when attempting to present Write permission(s) on C:Program Files (x86)MyFolder", followed by a french nessage "Impossible de traduire certaines ou toutes les références d'identité." (that translates to impossible to translate some or all identity references).



      The Windows machines I am dealing with are installed in French, so my assumption is that I am not specifying the ACL target user correctly.



      So far I have tried many variations for the "user" parameter for the win_acl command :




      • ThisMachineUtilisateurs

      • BUILTINUtilisateurs

      • ThisMachineUsers

      • S-1-5-32-545

      • ...


      But none of them works...







      windows ansible acl






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 7 at 13:43









      M-Jack

      1014




      1014
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          An Ansible bug affect win_acl when dealing with folders such as :




          • c:Program Files

          • c:Program Files (x86)

          • c:Windows


          So the workaround that worked for me was to use a Windows command instead of the Ansible win_acl module :



          win_shell: icacls 'C:/Program Files (x86)/MyFolder/' /grant '*S-1-5-11:(OI)(CI)F' /T


          Where :





          • 'C:/Program Files (x86)/MyFolder/' target folder, using / and not , surrounded with quoted because of the spaces inside


          • *S-1-5-1 a well-known Windows SID for Authenticated Users, the star starts an SID instead of a group or a user name (I was not able here to use anything else than an SID)


          • (OI)(CI) : propagates inheritance to both files and folders


          • /T : do it recursively on sub-folders






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190678%2fansible-windows-acl%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            An Ansible bug affect win_acl when dealing with folders such as :




            • c:Program Files

            • c:Program Files (x86)

            • c:Windows


            So the workaround that worked for me was to use a Windows command instead of the Ansible win_acl module :



            win_shell: icacls 'C:/Program Files (x86)/MyFolder/' /grant '*S-1-5-11:(OI)(CI)F' /T


            Where :





            • 'C:/Program Files (x86)/MyFolder/' target folder, using / and not , surrounded with quoted because of the spaces inside


            • *S-1-5-1 a well-known Windows SID for Authenticated Users, the star starts an SID instead of a group or a user name (I was not able here to use anything else than an SID)


            • (OI)(CI) : propagates inheritance to both files and folders


            • /T : do it recursively on sub-folders






            share|improve this answer

























              up vote
              0
              down vote













              An Ansible bug affect win_acl when dealing with folders such as :




              • c:Program Files

              • c:Program Files (x86)

              • c:Windows


              So the workaround that worked for me was to use a Windows command instead of the Ansible win_acl module :



              win_shell: icacls 'C:/Program Files (x86)/MyFolder/' /grant '*S-1-5-11:(OI)(CI)F' /T


              Where :





              • 'C:/Program Files (x86)/MyFolder/' target folder, using / and not , surrounded with quoted because of the spaces inside


              • *S-1-5-1 a well-known Windows SID for Authenticated Users, the star starts an SID instead of a group or a user name (I was not able here to use anything else than an SID)


              • (OI)(CI) : propagates inheritance to both files and folders


              • /T : do it recursively on sub-folders






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                An Ansible bug affect win_acl when dealing with folders such as :




                • c:Program Files

                • c:Program Files (x86)

                • c:Windows


                So the workaround that worked for me was to use a Windows command instead of the Ansible win_acl module :



                win_shell: icacls 'C:/Program Files (x86)/MyFolder/' /grant '*S-1-5-11:(OI)(CI)F' /T


                Where :





                • 'C:/Program Files (x86)/MyFolder/' target folder, using / and not , surrounded with quoted because of the spaces inside


                • *S-1-5-1 a well-known Windows SID for Authenticated Users, the star starts an SID instead of a group or a user name (I was not able here to use anything else than an SID)


                • (OI)(CI) : propagates inheritance to both files and folders


                • /T : do it recursively on sub-folders






                share|improve this answer












                An Ansible bug affect win_acl when dealing with folders such as :




                • c:Program Files

                • c:Program Files (x86)

                • c:Windows


                So the workaround that worked for me was to use a Windows command instead of the Ansible win_acl module :



                win_shell: icacls 'C:/Program Files (x86)/MyFolder/' /grant '*S-1-5-11:(OI)(CI)F' /T


                Where :





                • 'C:/Program Files (x86)/MyFolder/' target folder, using / and not , surrounded with quoted because of the spaces inside


                • *S-1-5-1 a well-known Windows SID for Authenticated Users, the star starts an SID instead of a group or a user name (I was not able here to use anything else than an SID)


                • (OI)(CI) : propagates inheritance to both files and folders


                • /T : do it recursively on sub-folders







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 7 at 16:09









                M-Jack

                1014




                1014






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190678%2fansible-windows-acl%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    這個網誌中的熱門文章

                    Post-Redirect-Get with Spring WebFlux and Thymeleaf

                    Xamarin.form Move up view when keyboard appear

                    JBPM : POST request for execute process go wrong