Reputation: 419
I have the following inside a playbook of Ansible 2.3.0.0:
- name: Disable SSL2, SSL3, RC4. Activate TLS
win_regedit:
path: 'HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\{{ item.path }}'
name: "{{ item.name }}"
data: "{{ item.data }}"
type: dword
with_items:
# more items working correctly
- { path: "Ciphers\\RC4 128/128", name: 'Enabled', data: 0 }
- { path: "Ciphers\\RC4 40/128", name: 'Enabled', data: 0 }
- { path: "Ciphers\\RC4 56/128", name: 'Enabled', data: 0 }
I've tried every single combination of quotes and slashes I could think of to escape the /
, and still either throws syntax error or considers the last 128
as another folder of the registry path rather than part of the key itself.
Is there any way Ansible can take that 128/128
literally and not as part of a path?
Upvotes: 1
Views: 1522
Reputation: 419
Thanks to @KonstantinSuvorov I've done a workaround that, although ugly, works. Perform this step to create the registry key directly with PowerShell before the win_regedit
:
- win_shell: $path=new-item -path 'HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers';$key = (get-item HKLM:\).OpenSubKey("System\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers", $true);$key.CreateSubKey('RC4 128/128');$key.CreateSubKey('RC4 40/128');$key.CreateSubKey('RC4 56/128');$key.Close()
Upvotes: 0
Reputation: 68289
Sorry, but you are out of luck with win_regedit
and forward slash.
win_regedit
use PowerShell and Get-ItemProperty with friends under the hood.
And PowerShell treat forward slash character as level separator, whether you escape it or not.
You can google for some ways to overcome this in PowerShell (example1, example2).
But with win_regedit
Ansible module you can't use that tricks.
So either you write your own PowerShell script with tricks from above articles and use script
module, or prepare registry template and use win_regmerge
module (it uses reg.exe
under the hood) to import required settings.
Upvotes: 1