ansible.builtin.win_say (v2.3.0.0-1) — module

Text to speech module for Windows to speak messages and optionally play sounds

| "added in version" 2.3 of ansible.builtin"

Authors: Jon Hawkesworth (@jhawkesworth)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.3.0.0.post1

Description

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.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  # Warn of impending deployment
- win_say:
    msg: Warning, deployment commencing in 5 minutes, please log out.
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  # 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  # example 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  # 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

Inputs

    
msg:
    default: none
    description:
    - The text to be spoken.  Use either msg or msg_file.  Optional so that you can use
      this module just to play sounds.
    required: false

voice:
    default: system default voice
    description:
    - Which voice to use. See notes for how to discover installed voices.  If the requested
      voice is not available the default voice will be used. Example voice names from
      Windows 10 are 'Microsoft Zira Desktop' and 'Microsoft Hazel Desktop'.
    required: false

msg_file:
    default: none
    description:
    - Full path to a windows format text file containing the text to be spokend.  Use
      either msg or msg_file.  Optional so that you can use this module just to play sounds.
    required: false

speech_speed:
    default: 0
    description:
    - How fast or slow to speak the text.  Must be an integer value in the range -10 to
      10.  -10 is slowest, 10 is fastest.
    required: false

end_sound_path:
    default: null
    description:
    - Full path to a C(.wav) file containing a sound to play after the text has been spoken.  Useful
      on conference calls to alert other speakers that ansible has finished speaking.
    required: false

start_sound_path:
    default: null
    description:
    - Full path to a C(.wav) file containing a sound to play before the text is spoken.  Useful
      on conference calls to alert other speakers that ansible has something to say.
    required: false

Outputs

message_text:
  description: the text that the module attempted to speak
  returned: success
  sample: Warning, deployment commencing in 5 minutes.
  type: string
voice:
  description: the voice used to speak the text.
  returned: success
  sample: Microsoft Hazel Desktop
  type: string
voice_info:
  description: the voice used to speak the text.
  returned: when requested voice could not be loaded
  sample: Could not load voice TestVoice, using system default voice
  type: string