Bläddra i källkod

Add more options for client configuration customization (#51)

* Make it possible to customize client display name

* Make it possible to customize client subscriptions
Daniel Miranda 9 år sedan
förälder
incheckning
9336657773
3 ändrade filer med 6 tillägg och 2 borttagningar
  1. 2 0
      defaults/main.yml
  2. 2 0
      docs/role_variables.md
  3. 2 2
      templates/client.json.j2

+ 2 - 0
defaults/main.yml

@@ -44,6 +44,8 @@ sensu_master: false
 sensu_user_name: sensu
 sensu_remote_plugins: ~
 sensu_transport: rabbitmq
+sensu_client_name: "{{ ansible_hostname }}"
+sensu_client_subscriptions: "{{ group_names }}"
 
 # Sensu/RabbitMQ SSL certificate properties
 sensu_ssl_gen_certs: true

+ 2 - 0
docs/role_variables.md

@@ -53,6 +53,8 @@ _Note: The above options are intended to provide users with flexibility. This al
 | `sensu_master` | `false` | Determines if a node is to act as the Sensu "master" node |
 | `sensu_user_name`| sensu | The name of the Sensu service user |
 | `sensu_remote_plugins` | _undefined_ | A list of plugins to install via `sensu-install` (Ruby Gems) |
+| `sensu_client_name` | `"{{ ansible_hostname }}"` | Sensu client identification (for display purposes) |
+| `sensu_client_subscriptions` | `"{{ group_names }}"` | Sensu client subscriptions |
 
 ### Sensu/RabbitMQ SSL certificate properties
 ``` yaml

+ 2 - 2
templates/client.json.j2

@@ -1,7 +1,7 @@
 {
   "client": {
-    "name": "{{ ansible_hostname }}",
+    "name": "{{ sensu_client_name }}",
     "address": "{{ ansible_default_ipv4['address'] }}",
-      "subscriptions": {{ group_names | to_nice_json }}
+    "subscriptions": {{ sensu_client_subscriptions | to_nice_json(indent=6) }}
   }
 }