diff --git a/tests/integration/targets/vmware_rest_appliance/tasks/appliance_services.yml b/tests/integration/targets/vmware_rest_appliance/tasks/appliance_services.yml new file mode 100644 index 00000000..c043ee64 --- /dev/null +++ b/tests/integration/targets/vmware_rest_appliance/tasks/appliance_services.yml @@ -0,0 +1,100 @@ +--- +- name: Manage and test ntpd service + block: + - name: Get information about the ntpd service + vmware.vmware_rest.appliance_services_info: + service: ntpd + register: initial_ntpd_info + + - name: Debug initial ntpd service info + ansible.builtin.debug: + var: initial_ntpd_info + + - name: Stop the ntpd service + vmware.vmware_rest.appliance_services: + service: ntpd + state: stop + register: stop_result + + - name: Debug stop result + ansible.builtin.debug: + var: stop_result + + - name: Get information about the ntpd service after it is stopped + vmware.vmware_rest.appliance_services_info: + service: ntpd + register: after_stop_ntpd_info + + - name: Debug ntpd service info after it is stopped + ansible.builtin.debug: + var: after_stop_ntpd_info + + - name: Validate ntpd service is stopped + ansible.builtin.assert: + that: + - after_stop_ntpd_info.failed == false + - after_stop_ntpd_info.value.state == "STOPPED" + fail_msg: "Failed to stop the ntpd service." + + - name: Start the ntpd service + vmware.vmware_rest.appliance_services: + service: ntpd + state: start + register: start_result + + - name: Debug start result + ansible.builtin.debug: + var: start_result + + - name: Get information about the ntpd service after it has started + vmware.vmware_rest.appliance_services_info: + service: ntpd + register: after_start_ntpd_info + + - name: Debug ntpd service info after it has started + ansible.builtin.debug: + var: after_start_ntpd_info + + - name: Validate ntpd service is started + ansible.builtin.assert: + that: + - after_start_ntpd_info.failed == false + - after_start_ntpd_info.value.state == "STARTED" + fail_msg: "Failed to start the ntpd service." + + - name: Restart the ntpd service + vmware.vmware_rest.appliance_services: + service: ntpd + state: restart + register: restart_result + + - name: Debug restart result + ansible.builtin.debug: + var: restart_result + + - name: Get information about the ntpd service after it is restarted + vmware.vmware_rest.appliance_services_info: + service: ntpd + register: after_restart_ntpd_info + + - name: Debug ntpd service info after it is restarted + ansible.builtin.debug: + var: after_restart_ntpd_info + + - name: Validate ntpd service is restarted + ansible.builtin.assert: + that: + - after_restart_ntpd_info.failed == false + - after_restart_ntpd_info.value.state == "STARTED" + fail_msg: "Failed to restart the ntpd service." + + always: + - name: Ensure ntpd service is started + vmware.vmware_rest.appliance_services: + service: ntpd + state: start + register: ensure_started_result + + - name: Debug ensure started result + ansible.builtin.debug: + var: ensure_started_result diff --git a/tests/integration/targets/vmware_rest_appliance/tasks/main.yml b/tests/integration/targets/vmware_rest_appliance/tasks/main.yml index 14e9176f..b77f86b9 100644 --- a/tests/integration/targets/vmware_rest_appliance/tasks/main.yml +++ b/tests/integration/targets/vmware_rest_appliance/tasks/main.yml @@ -3,14 +3,12 @@ - import_tasks: appliance_localaccounts.yml - import_tasks: appliance_monitoring.yml - import_tasks: appliance_networking_dns_hostname.yml +- import_tasks: appliance_networking_proxy.yml +- import_tasks: appliance_services.yml +- import_tasks: appliance_system.yml +- import_tasks: appliance_time.yml # - import_tasks: appliance_networking.yml - There is a bug # - import_tasks: appliance_networking_firewall_inbound.yml - There is a bug # - import_tasks: appliance_networking_interfaces_ipv4.yml - There is a bug # - import_tasks: appliance_networking_interfaces_ipv6.yml - There is a bug -- import_tasks: appliance_networking_proxy.yml -# - import_tasks: appliance_services.yml -# - import_tasks: appliance_shutdown.yml -- import_tasks: appliance_system.yml -# - import_tasks: appliance_system_storage.yml - There is a bug -- import_tasks: appliance_time.yml -# - import_tasks: appliance_vmon_service.yml \ No newline at end of file +# - import_tasks: appliance_system_storage.yml - There is a bug \ No newline at end of file