ansible-collections / ansible-consul

:satellite: Ansible role for Hashicorp Consul clusters

Home Page:https://galaxy.ansible.com/ansible-community/consul/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Handlers fail on macOS

nre-ableton opened this issue · comments

I know that the ansible-consul role doesn't officially support macOS, and although I would be interested in adding support for that platform, this is an entirely different discussion which involves a bit more planning.

In the meantime, I've written a wrapper role around ansible-consul to add some basic support for Mac hosts. Namely, I'm interested in using ansible-consul's config.yml task to generate the config.json file. The task itself works fine on Mac, but it notifies handlers that use the service module, which is not supported on Mac.

I'm happy to write my own handlers to deal with the launchctl service management, but in the meantime, it would be nice if this role's handlers were a bit more specific. Namely, I would propose changing the handlers to look like this:

--- a/handlers/restart_consul.yml
+++ b/handlers/restart_consul.yml
@@ -3,7 +3,9 @@
 - name: restart consul on unix
   service:
     name: consul
     state: restarted
-  when: ansible_os_family != "Windows"
+  when:
+    - ansible_os_family != "Darwin"
+    - ansible_os_family != "Windows"
   listen: 'restart consul'

I've got a PR ready to submit to fix this, but I just wanted to get the blessing of the project contributors before doing so, since this is mentioned in the contribution guidelines. Thanks!

It’s been a week with no input on this issue, so I went ahead and created a PR: #478