1

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.

Aryak Sengupta
  • 1,727
  • 2
  • 18
  • 23

1 Answers1

1

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
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
  • I tried this but I got this error. `fatal: [192.168.2.91]: FAILED! => {"changed": false, "cmd": "brew services restart nrpe", "failed": true, "msg": "[Errno 2] No such file or directory", "rc": 2}` . I have also tried other modules like `shell`, `script` etc. but none of them seem to work with the `brew` command. – Aryak Sengupta Jun 08 '17 at 05:43
  • 1
    Add full path to `brew`. – Konstantin Suvorov Jun 08 '17 at 06:21
  • @KonstantinSuvorov Yes, I had tried with the full path and it worked. – Aryak Sengupta Jun 08 '17 at 06:49