win_say: Port to use CSharpUtil AnsibleBasic (#48361)

* port win-say to use CSharpUtil AnsibleBasic and add warning when requested voice not found

* win_say: fixes following code review: use C# style properties consistently; prefix changelog fragments

* fix invalid yaml in change log fragment

* win_say: fixes following code review: use generic module parameter validation where possible

* remove redundant setting of Result.changed to false, simplified some logic for readability.

* fix serialisation issue when message text is drawn from a file; allows tests to be run not in check mode and fix up some test descriptions
This commit is contained in:
jhawkesworth 2018-11-18 21:07:12 +00:00 committed by Jordan Borean
commit 361acd3547
3 changed files with 65 additions and 57 deletions

View file

@ -4,21 +4,21 @@
- name: Warn of impending deployment
win_say:
msg: Warning, deployment commencing in 5 minutes, please log out.
check_mode: yes
check_mode: "{{ win_say_check_mode |default('yes') }}"
- name: Using a different voice and a start sound
- name: Using a specified voice and a start sound
win_say:
msg: Warning, deployment commencing in 5 minutes, please log out.
start_sound_path: C:\Windows\Media\ding.wav
voice: Microsoft Hazel Desktop
check_mode: yes
check_mode: "{{ win_say_check_mode |default('yes') }}"
- name: Example with start and end sound
win_say:
msg: New software installed
start_sound_path: C:\Windows\Media\Windows Balloon.wav
end_sound_path: C:\Windows\Media\chimes.wav
check_mode: yes
check_mode: "{{ win_say_check_mode |default('yes') }}"
- name: Create message file
win_copy:
@ -30,15 +30,15 @@
msg_file: C:\Windows\Temp\win_say_message.txt
start_sound_path: C:\Windows\Media\Windows Balloon.wav
end_sound_path: C:\Windows\Media\chimes.wav
check_mode: yes
check_mode: "{{ win_say_check_mode |default('yes') }}"
- name: Remove message file
win_file:
path: C:\Windows\Temp\win_say_message.txt
state: absent
- name: Different spech peed
- name: Different speech speed
win_say:
speech_speed: 5
msg: Stay calm and proceed to the closest fire exit.
check_mode: yes
check_mode: "{{ win_say_check_mode |default('yes') }}"