@ -99,25 +104,25 @@ Function Get-WmiErrorMessage($return_value) {
switch($return_value){
switch($return_value){
1{"Not Supported: The request is not supported"}
1{"Not Supported: The request is not supported"}
2{"Access Denied: The user did not have the necessary access"}
2{"Access Denied: The user did not have the necessary access"}
3{"Dependent Servies Running: The service cannot be stopped because other services that are running are dependent on it"}
3{"Dependent Services Running: The service cannot be stopped because other services that are running are dependent on it"}
4{"Invalid Service Control: Thre requested control code is not valid, or it is unacceptable to the service"}
4{"Invalid Service Control: The requested control code is not valid, or it is unacceptable to the service"}
5{"The requested control code cannot be sent to the service because the state of the service is equal to 0, 1, or 2"}
5{"Service Cannot Accept Control: The requested control code cannot be sent to the service because the state of the service (Win32_BaseService.State property) is equal to 0, 1, or 2"}
6{"Service Not Ative: The service has not been started"}
6{"Service Not Active: The service has not been started"}
7{"Service Request Timeout: The service did not response to the start request in a timely fashion"}
7{"Service Request Timeout: The service did not respond to the start request in a timely fashion"}
8{"Unknown Failure: Unknown failure when starting the service"}
8{"Unknown Failure: Unknown failure when starting the service"}
9{"Path Not Found: THe directory path to the service executable file was not found"}
9{"Path Not Found: The directory path to the service executable file was not found"}
10{"Service Already Running: The service is already running"}
10{"Service Already Running: The service is already running"}
11{"Service Database Locked: The database to add a new service is locked"}
11{"Service Database Locked: The database to add a new service is locked"}
12{"Service Dependency Deleted: A dependency this service relies on has been removed from the system"}
12{"Service Dependency Deleted: A dependency this service relies on has been removed from the system"}
13{"Service Dependency Failure: The service failed to find the service needed from a dependent service"}
13{"Service Dependency Failure: The service failed to find the service needed from a dependent service"}
14{"Servoce Disabled: The service has been disbaled from the system"}
14{"Service Disabled: The service has been disabled from the system"}
15{"Service Logon Failed: The service does not have the correct authentication to run on this system"}
15{"Service Logon Failed: The service does not have the correct authentication to run on the system"}
16{"Service Marked For Deletion: This service is being removed from the system"}
16{"Service Marked For Deletion: This service is being removed from the system"}
17{"Service No Thread: The service has no execution thread"}
17{"Service No Thread: The service has no execution thread"}
18{"Status Circular Dependecy: The service has circular dependencies when it starts"}
18{"Status Circular Dependency: The service has circular dependencies when it starts"}
19{"Status Duplicate Name: A service is running under the same name"}
19{"Status Duplicate Name: A service is running under the same name"}
20{"Status Invalid Name: The service name has invalide characters"}
20{"Status Invalid Name: The service name has invalid characters"}
21{"Status Invalid Paramter: Invalid paramters have been passed to the service"}
21{"Status Invalid Parameter: Invalid parameters have been passed to the service"}
22{"Status Invalid Service Account: The account under which this service runs is either invalid or lacks the permissions to run the service"}
22{"Status Invalid Service Account: The account under which this service runs is either invalid or lacks the permissions to run the service"}
23{"Status Service Exists: The service exists in the database of services available from the system"}
23{"Status Service Exists: The service exists in the database of services available from the system"}
24{"Service Already Paused: The service is currently paused in the system"}
24{"Service Already Paused: The service is currently paused in the system"}
@ -140,33 +145,19 @@ Function Set-ServiceStartMode($svc, $start_mode) {
failed_when:win_service_removed_failed.msg != "Cannot stop service 'Test Service New (TestService)' because it has dependent services. It can only be stopped if the Force flag is set."
- name:remove the service while ignoring dependencies
win_service:
name:"{{test_win_service_name}}"
force_dependent_services:True
state:absent
register:win_service_removed
register:win_service_removed
- name:check that removing the service succeeds with changes
- name:check that removing the service while ignoring dependencies succeeds with changes
assert:
assert:
that:
that:
- "win_service_removed|changed"
- "win_service_removed|changed"
@ -839,6 +849,7 @@
- name:make sure all services are removed in the end
- name:make sure all services are removed in the end