Skip to content

Latest commit

 

History

History
281 lines (246 loc) · 10.8 KB

community.windows.win_toast_module.rst

File metadata and controls

281 lines (246 loc) · 10.8 KB

community.windows.win_toast

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

  • Sends alerts which appear in the Action Center area of the windows desktop.
Parameter Choices/Defaults Comments
expire
integer
Default:
45
How long in seconds before the notification expires.
group
string
Default:
"Powershell"
Which notification group to add the notification to.
msg
string
Default:
"Hello, World!"
The message to appear inside the notification.
May include \n to format the message to appear within the Action Center.
popup
boolean
    Choices:
  • no
  • yes ←
If no, the notification will not pop up and will only appear in the Action Center.
tag
string
Default:
"Ansible"
The tag to add to the notification.
title
string
Default:
"Notification HH:mm"
The notification title, which appears in the pop up..

Note

  • This module must run on a windows 10 or Server 2016 host, so ensure your play targets windows hosts, or delegates to a windows host.
  • The module does not fail if there are no logged in users to notify.
  • Messages are only sent to the local host where the module is run.
  • You must run this module with async, otherwise it will hang until the expire period has passed.
.. seealso::

   :ref:`community.windows.win_msg_module`
      The official documentation on the **community.windows.win_msg** module.
   :ref:`community.windows.win_say_module`
      The official documentation on the **community.windows.win_say** module.


- 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

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
expire_at_utc
string
always
Calculated utc date time when the notification expires.

Sample:
07 July 2017 04:50:54
no_toast_sent_reason
string
when no logged in users are detected
Text containing the reason why a notification was not sent.

Sample:
No logged in users to notify
sent_localtime
string
always
local date time when the notification was sent.

Sample:
07 July 2017 05:45:54
time_taken
float
always
How long the module took to run on the remote windows host in seconds.

Sample:
0.3706631999999997
toast_sent
boolean
always
Whether the module was able to send a toast notification or not.



Authors

  • Jon Hawkesworth (@jhawkesworth)