win_say – Text to speech module for Windows to speak messages and optionally play sounds¶
Synopsis¶
- Uses .NET libraries to convert text to speech and optionally play .wav sounds. Audio Service needs to be running and some kind of speakers or headphones need to be attached to the windows target(s) for the speech to be audible.
Parameters¶
Notes¶
Note
Needs speakers or headphones to do anything useful.
To find which voices are installed, run the following Powershell commands.
Add-Type -AssemblyName System.Speech $speech = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer $speech.GetInstalledVoices() | ForEach-Object { $_.VoiceInfo } $speech.Dispose()
Speech can be surprisingly slow, so it’s best to keep message text short.
See Also¶
See also
- win_msg – Sends a message to logged in users on Windows hosts
- The official documentation on the win_msg module.
- win_toast – Sends Toast windows notification to logged in users on Windows 10 or later hosts
- The official documentation on the win_toast module.
Examples¶
- name: Warn of impending deployment
win_say:
msg: Warning, deployment commencing in 5 minutes, please log out.
- name: Using a different voice and a start sound
win_say:
start_sound_path: C:\Windows\Media\ding.wav
msg: Warning, deployment commencing in 5 minutes, please log out.
voice: Microsoft Hazel Desktop
- name: With start and end sound
win_say:
start_sound_path: C:\Windows\Media\Windows Balloon.wav
msg: New software installed
end_sound_path: C:\Windows\Media\chimes.wav
- name: Text from file example
win_say:
start_sound_path: C:\Windows\Media\Windows Balloon.wav
msg_file: AppData\Local\Temp\morning_report.txt
end_sound_path: C:\Windows\Media\chimes.wav
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Jon Hawkesworth (@jhawkesworth)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.