macosansiblehomebrewnagiosnagiosxi

Run brew restart command using Homebrew module for Ansible


I have been trying to run the command

brew services restart nrpe

with the help of Ansible's homebrew module.

I have gone through the documentation (homebrew ansible doc) but I couldn't find an example which does a similar thing. I have tried the following:

    - homebrew:
        name: nrpe
        state: present
        install_options: services,restart

but it didn't work. Please let me know the correct way to run the command brew services restart nrpe.

P.S. - Installation of nrpe or other services though homebrew is working great.

Edit 1 - Also including the Nagios tag because this might also be faced by the nagios community.


Solution

  • According to the documentation of the homebrew ansible module, the command :

    brew services restart nrpe
    

    seems not implemented. The solution could be to use the command module:

    - name: restart the nrpe service
      command: brew services restart nrpe