ansible / ansible.windows / 2.3.0 / filter / quote Quotes argument(s) for various Windows shells Authors: Jordan Borean (@jborean93)ansible.windows.quote (2.3.0) — filter
Install with ansible-galaxy collection install ansible.windows:==2.3.0
collections: - name: ansible.windows version: 2.3.0
Quotes argument(s) for the various Windows command line shells.
Defaults to escaping arguments based on the Win32 C argv parsing rules that M(ansible.windows.win_command) uses.
Using I(shell='cmd') or I(shell='powershell') can be set to escape arguments for those respective shells.
Each value is escaped in a way to ensure the process gets the literal argument passed in and meta chars escaped.
- name: Escape an argument for win_command ansible.windows.win_command: cmd: my.exe {{ argument1 | ansible.windows.quote }}
- name: Escape an argument for PowerShell ansible.windows.win_shell: | $var = {{ argument1 | ansible.windows.quote(shell='powershell') }} Write-Host $var
shell: choices: - None - cmd - powershell default: None description: - The shell to quote the arguments for. - By default no shell is used and the arguments are quoted with the Win32 C quoting rules. type: string _input: description: - The string, list, or dict of values to quote. - A string or list of strings will be quoted. - When using a dict as the input, the final form will be in C(KEY="value") to match the MSI parameter format. required: true type: raw
_value: description: - The quoted input value(s) as a single space delimited string. type: string