ansible.builtin.powershell – Windows PowerShell

Note

This shell plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name powershell even without specifying the collections: keyword. However, we recommend you use the FQCN for easy linking to the plugin documentation and to avoid conflicting with other collections that may have the same shell plugin name.

Synopsis

  • The only option when using ‘winrm’ or ‘psrp’ as a connection plugin.
  • Can also be used when using ‘ssh’ as a connection plugin and the DefaultShell has been configured to PowerShell.

Parameters

Parameter Choices/Defaults Configuration Comments
async_dir
string
added in 2.8 of ansible.builtin
Default:
"%USERPROFILE%\\.ansible_async"
ini entries:

[powershell]
async_dir = %USERPROFILE%\.ansible_async

var: ansible_async_dir
Directory in which ansible will keep async job information.
Before Ansible 2.8, this was set to remote_tmp + "\.ansible_async".
environment
list / elements=string
Default:
[{}]
List of dictionaries of environment variables and their values to use when executing commands.
remote_tmp
string
Default:
"%TEMP%"
ini entries:

[powershell]
remote_tmp = %TEMP%

var: ansible_remote_tmp
Temporary directory to use on targets when copying files to the host.
set_module_language
boolean
    Choices:
  • no
  • yes
Controls if we set the locale for modules when executing on the target.
Windows only supports no as an option.

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/powershell_shell.html