From 9f0aecbe19cef3e756dafde77cbb5cd2b3570f85 Mon Sep 17 00:00:00 2001 From: Tomoyuki Sakurai Date: Thu, 5 Oct 2017 16:02:12 +0700 Subject: [PATCH] [bugfix] introduce new handler Restart sensu services (#11) * [bugfix] introduce new handler Restart sensu services fixes #10 the handler is intended to be called when all sensu services should be restarted, such as when one of configuration files changes. * QA * [bugfix] restart sensu-client when patched * [bugfix] add `listen` to existing one instead of creating new one * add OpenBSD 6.1, update boxes * update meta --- .kitchen.yml | 13 +++++++++++++ handlers/main.yml | 1 + meta/main.yml | 1 + tasks/install-FreeBSD.yml | 2 ++ tasks/install-OpenBSD.yml | 1 + tasks/main.yml | 4 ++-- 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 63174ea..2290b9a 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -54,6 +54,19 @@ platforms: driver: box: trombik/ansible-openbsd-6.0-amd64 box_check_update: false + box_version: 1.1.0 + driver_config: + ssh: + shell: '/bin/sh' + provisioner: + extra_vars: + ansible_python_interpreter: '/usr/local/bin/python' + + - name: openbsd-6.1-amd64 + driver: + box: trombik/ansible-openbsd-6.1-amd64 + box_check_update: false + box_version: 1.4.0 driver_config: ssh: shell: '/bin/sh' diff --git a/handlers/main.yml b/handlers/main.yml index 6409a4e..b25ea02 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -4,3 +4,4 @@ service: name: "{{ sensu_client_service }}" state: restarted + listen: "Restart sensu services" diff --git a/meta/main.yml b/meta/main.yml index ec6618b..e7fc3ea 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -12,6 +12,7 @@ galaxy_info: - name: OpenBSD versions: - 6.0 + - 6.1 - name: Ubuntu versions: - trusty diff --git a/tasks/install-FreeBSD.yml b/tasks/install-FreeBSD.yml index 75d3a72..540b4af 100644 --- a/tasks/install-FreeBSD.yml +++ b/tasks/install-FreeBSD.yml @@ -12,6 +12,7 @@ backup: yes src: files/FreeBSD/patch-sensu-client dest: /usr/local/etc/rc.d/sensu-client + notify: Restart sensu-client - name: Get the path to "lib/sensu/transport/rabbitmq.rb" shell: "{{ sensu_client_gem_binary }} content sensu-transport | grep 'lib/sensu/transport/rabbitmq.rb$'" @@ -25,3 +26,4 @@ backup: yes src: files/FreeBSD/patch_undefined_method_for_nilclass dest: "{{ register_gem_content_sensu_transport.stdout }}" + notify: Restart sensu-client diff --git a/tasks/install-OpenBSD.yml b/tasks/install-OpenBSD.yml index f027315..7347968 100644 --- a/tasks/install-OpenBSD.yml +++ b/tasks/install-OpenBSD.yml @@ -23,6 +23,7 @@ src: OpenBSD.rc.j2 dest: /etc/rc.d/sensu_client mode: 0555 + validate: sh -n %s - name: Create sensu_client_group group: diff --git a/tasks/main.yml b/tasks/main.yml index d7cc131..bab3e9a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -31,7 +31,7 @@ src: config.json.j2 dest: "{{ sensu_client_config_file }}" validate: "python -c 'import sys; import json; json.loads(open(sys.argv[1]).read())' %s" - notify: Restart sensu-client + notify: Restart sensu services - name: Create sensu_client_log_dir @@ -47,7 +47,7 @@ dest: "{{ sensu_client_conf_d_dir }}/{{ item }}.json" validate: "python -c 'import sys; import json; json.loads(open(sys.argv[1]).read())' %s" with_items: "{{ sensu_client_config_fragments.keys() }}" - notify: Restart sensu-client + notify: Restart sensu services - include: "plugins.yml"