community.windows.win_toast (2.2.0) — module

Sends Toast windows notification to logged in users on Windows 10 or later hosts

Authors: Jon Hawkesworth (@jhawkesworth)

Install collection

Install with ansible-galaxy collection install community.windows:==2.2.0


Add to requirements.yml

  collections:
    - name: community.windows
      version: 2.2.0

Description

Sends alerts which appear in the Action Center area of the windows desktop.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Warn logged in users of impending upgrade (note use of async to stop the module from waiting until notification expires).
  community.windows.win_toast:
    expire: 60
    title: System Upgrade Notification
    msg: Automated upgrade about to start.  Please save your work and log off before {{ deployment_start_time }}
  async: 60
  poll: 0

Inputs

    
msg:
    default: Hello, World!
    description:
    - The message to appear inside the notification.
    - May include \n to format the message to appear within the Action Center.
    type: str

tag:
    default: Ansible
    description:
    - The tag to add to the notification.
    type: str

group:
    default: Powershell
    description:
    - Which notification group to add the notification to.
    type: str

popup:
    default: true
    description:
    - If C(no), the notification will not pop up and will only appear in the Action Center.
    type: bool

title:
    default: Notification HH:mm
    description:
    - The notification title, which appears in the pop up..
    type: str

expire:
    default: 45
    description:
    - How long in seconds before the notification expires.
    type: int

Outputs

expire_at_utc:
  description: Calculated utc date time when the notification expires.
  returned: always
  sample: 07 July 2017 04:50:54
  type: str
no_toast_sent_reason:
  description: Text containing the reason why a notification was not sent.
  returned: when no logged in users are detected
  sample: No logged in users to notify
  type: str
sent_localtime:
  description: local date time when the notification was sent.
  returned: always
  sample: 07 July 2017 05:45:54
  type: str
time_taken:
  description: How long the module took to run on the remote windows host in seconds.
  returned: always
  sample: 0.3706631999999997
  type: float
toast_sent:
  description: Whether the module was able to send a toast notification or not.
  returned: always
  sample: false
  type: bool

See also