Debian Codegraph @

ansible_collections/community/windows/plugins/modules/win_toast.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright: (c) 2017, Jon Hawkesworth (@jhawkesworth) <[email protected]>
5 # Copyright: (c) 2017, Ansible Project
6 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
7
8 DOCUMENTATION = r'''
9 ---
10 module: win_toast
11 short_description: Sends Toast windows notification to logged in users on Windows 10 or later hosts
12 description:
13 - Sends alerts which appear in the Action Center area of the windows desktop.
14 options:
15 expire:
16 description:
17 - How long in seconds before the notification expires.
18 type: int
19 default: 45
20 group:
21 description:
22 - Which notification group to add the notification to.
23 type: str
24 default: Powershell
25 msg:
26 description:
27 - The message to appear inside the notification.
28 - May include \n to format the message to appear within the Action Center.
29 type: str
30 default: Hello, World!
31 popup:
32 description:
33 - If C(no), the notification will not pop up and will only appear in the Action Center.
34 type: bool
35 default: yes
36 tag:
37 description:
38 - The tag to add to the notification.
39 type: str
40 default: Ansible
41 title:
42 description:
43 - The notification title, which appears in the pop up..
44 type: str
45 default: Notification HH:mm
46 notes:
47 - 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.
48 - The module does not fail if there are no logged in users to notify.
49 - Messages are only sent to the local host where the module is run.
50 - You must run this module with async, otherwise it will hang until the expire period has passed.
51 seealso:
52 - module: community.windows.win_msg
53 - module: community.windows.win_say
54 author:
55 - Jon Hawkesworth (@jhawkesworth)
56 '''
57
58 EXAMPLES = r'''
59 - name: Warn logged in users of impending upgrade (note use of async to stop the module from waiting until notification expires).
60 community.windows.win_toast:
61 expire: 60
62 title: System Upgrade Notification
63 msg: Automated upgrade about to start. Please save your work and log off before {{ deployment_start_time }}
64 async: 60
65 poll: 0
66 '''
67
68 RETURN = r'''
69 expire_at_utc:
70 description: Calculated utc date time when the notification expires.
71 returned: always
72 type: str
73 sample: 07 July 2017 04:50:54
74 no_toast_sent_reason:
75 description: Text containing the reason why a notification was not sent.
76 returned: when no logged in users are detected
77 type: str
78 sample: No logged in users to notify
79 sent_localtime:
80 description: local date time when the notification was sent.
81 returned: always
82 type: str
83 sample: 07 July 2017 05:45:54
84 time_taken:
85 description: How long the module took to run on the remote windows host in seconds.
86 returned: always
87 type: float
88 sample: 0.3706631999999997
89 toast_sent:
90 description: Whether the module was able to send a toast notification or not.
91 returned: always
92 type: bool
93 sample: false
94 '''