2

I'm trying to set permissions to some windows directory like this

# ansible example.com -m raw -a 'icacls D:\somedir\ /grant "! ЗАО. Руководство":F' -vvvvv 

and get windows error about invalid parameters

No config file found; using defaults Loaded callback minimal of type stdout, v2.0 File lookup using /etc/ansible/host_files/example.com/mvs as file <example.com> ESTABLISH WINRM CONNECTION FOR USER: mvs on PORT 5985 TO example.com <example.com> WINRM CONNECT: transport=plaintext endpoint=http://example.com:5985/wsman <example.com> EXEC icacls D:\somedir\ /grant "! . C:>2>4AB2>" :F <example.com> WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Unrestricted', '-EncodedCommand', 'aQBjAGEAYwBsAHMAIABEADoAXAAxAGMAXAAgAC8AZwByAGEAbgB0ACAAIgAhACAAFwQQBB4ELgAgACAEQwQ6BD4EMgQ+BDQEQQRCBDIEPgQiACAAOgBGAA=='] <example.com> WINRM RESULT u'<Response code 1, out "", err "Invalid parameter "!">' example.com | FAILED | rc=1 >> Invalid parameter "! ���. �㪮����⢮" 

I see 2 problems:

  1. Strange encoding or decoding of cyrillic parameter "! ЗАО. Руководство" (this is a group name in the windows) that passing from Ansible to windows host.

  2. Adding extra space beetwen group name and permission

    "encoded bla-bla-bla": F

instead of

"encoded bla-bla-bla":F 

How to fix it?

Ansible using from source (checked out at 17 August 2015)

# ansible --version ansible 2.0.0 (devel 4068598c15) last updated 2015/08/17 23:09:54 (GMT +600) lib/ansible/modules/core: (detached HEAD dea5f5d15e) last updated 2015/08/17 23:10:13 (GMT +600) lib/ansible/modules/extras: (detached HEAD 210ee3febc) last updated 2015/08/17 23:10:35 (GMT +600) v1/ansible/modules/core: (detached HEAD f8d8af17cd) last updated 2015/08/17 23:10:53 (GMT +600) v1/ansible/modules/extras: (detached HEAD 495ad450e5) last updated 2015/08/17 23:11:11 (GMT +600) config file = configured module search path = None 

and running on Gentoo Linux

# uname -a Linux web 3.10.4-gentoo #1 SMP Sat Aug 3 02:25:18 NOVT 2013 x86_64 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz GenuineIntel GNU/Linux 

On other side - Windows Server 2012 R2 Standard in KVM (on vultr.com)

2
  • Does this occur if you put the icacls command in a play book rather than on the command line? Commented Dec 20, 2015 at 11:45
  • 1
    A hint to solution: you have met some particular mojibake case. Unicode codepoints for . Руководство are 002E 0020 0420 0443 043A 043E 0432 043E 0434 0441 0442 0432 043E and those for . C:>2>4AB2> are 002E 0020 0020 0043 003A 003E 0032 003E 0034 0041 0042 0032 003E i.e. all higher bytes were set to 00. Unicode codepoints for ! ЗАО. are 0021 0020 0417 0410 041E 002E and that's why this string is shortened to ! . i.e. only printable characters from 0021 0020 0017 0010 001E 002E. Strings from <example.com> EXEC log. Commented May 11, 2016 at 14:42

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.