airflow.providers.microsoft.winrm.operators.winrm

Module Contents

Classes

WinRMOperator

WinRMOperator to execute commands on given remote host using the winrm_hook.

class airflow.providers.microsoft.winrm.operators.winrm.WinRMOperator(*, winrm_hook: Optional[airflow.providers.microsoft.winrm.hooks.winrm.WinRMHook] = None, ssh_conn_id: Optional[str] = None, remote_host: Optional[str] = None, command: Optional[str] = None, ps_path: Optional[str] = None, output_encoding: str = 'utf-8', timeout: int = 10, **kwargs)[source]

Bases: airflow.models.BaseOperator

WinRMOperator to execute commands on given remote host using the winrm_hook.

Parameters
  • winrm_hook (airflow.providers.microsoft.winrm.hooks.winrm.WinRMHook) -- predefined ssh_hook to use for remote execution

  • ssh_conn_id (str) -- connection id from airflow Connections

  • remote_host (str) -- remote host to connect

  • command (str) -- command to execute on remote host. (templated)

  • ps_path (str) -- path to powershell, powershell for v5.1- and pwsh for v6+. If specified, it will execute the command as powershell script.

  • output_encoding (str) -- the encoding used to decode stout and stderr

  • timeout (int) -- timeout for executing the command.

template_fields :Sequence[str] = ['command'][source]
template_fields_renderers[source]
execute(self, context: airflow.utils.context.Context) Union[list, str][source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?