HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/python3.9/site-packages/ansible_collections/sensu/sensu_go/roles/agent/handlers/main.yml
---
- name: Restart Linux agent
  service:
    name: sensu-agent
    state: restarted
  when: manage_sensu_agent_service | default(False)

- name: Restart Windows agent
  action:
    module: win_service
    name: SensuAgent
    state: restarted
  when: manage_sensu_agent_service | default(False)

# You probably noticed that we use some black magic in the previous handler.
# Let us explain what it does and why did we bring it into the daylight.
#
# Under normal circumstances, we would write the previous handler as
#
# - name: Restart Windows agent
#   win_service:
#     name: SensuAgent
#     state: restarted
#
# When Ansible loads this handler, it makes sure it can find the win_service
# module. And this is where things start to go downhill for us. Because we do
# not have a guarantee that win_service module will be available (win_service
# is not part of a certified collection), this eagerness prevents operating in
# certain situations where win_service module is not even needed.
#
# And this is why we use the alternative form that forces Ansible to lazy-load
# the module at the task/handler execution time.
#
# Of course, it would be much easier if we could declare ansible.windows as our
# dependency, but this is not possible at the moment.