| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- ---
- # tasks/plugins.yml: Deploy available checks/plugins/handlers/filters/mutators
- - include_vars: "{{ ansible_distribution }}.yml"
- - name: Ensure Sensu plugin directory exists
- file:
- dest: "{{ sensu_config_path }}/plugins"
- state: directory
- owner: "{{ sensu_user_name }}"
- group: "{{ sensu_group_name }}"
- - name: Ensure any remote plugins defined are present
- shell: sensu-install -p {{ item }}
- with_items: sensu_remote_plugins
- changed_when: false
- when: sensu_remote_plugins > 0
- - name: Register available checks
- local_action: command ls {{ static_data_store }}/sensu/checks
- register: sensu_available_checks
- changed_when: false
- - name: Deploy check plugins
- copy:
- src: "{{ static_data_store }}/sensu/checks/{{ item }}/"
- dest: "{{ sensu_config_path }}/plugins/"
- mode: 0755
- owner: "{{ sensu_user_name }}"
- group: "{{ sensu_group_name }}"
- when: sensu_available_checks.stdout.find('{{ item }}') != -1
- with_flattened:
- - group_names
- notify: restart sensu-client service
- - name: Deploy handler plugins
- copy:
- src: "{{ static_data_store }}/sensu/handlers/"
- dest: "{{ sensu_config_path }}/plugins/"
- mode: 0755
- owner: "{{ sensu_user_name }}"
- group: "{{ sensu_group_name }}"
- notify: restart sensu-client service
- - name: Deploy filter plugins
- copy:
- src: "{{ static_data_store }}/sensu/filters/"
- dest: "{{ sensu_config_path }}/plugins/"
- mode: 0755
- owner: "{{ sensu_user_name }}"
- group: "{{ sensu_group_name }}"
- notify: restart sensu-client service
- - name: Deploy mutator plugins
- copy:
- src: "{{ static_data_store }}/sensu/mutators/"
- dest: "{{ sensu_config_path }}/plugins/"
- mode: 0755
- owner: "{{ sensu_user_name }}"
- group: "{{ sensu_group_name }}"
- notify: restart sensu-client service
- - name: Deploy check/handler/filter/mutator definitions to the master
- template:
- src: "{{ static_data_store }}/sensu/definitions/{{ item }}.j2"
- dest: "{{ sensu_config_path }}/conf.d/{{ item }}"
- owner: "{{ sensu_user_name }}"
- group: "{{ sensu_group_name }}"
- when: sensu_master
- with_lines:
- - ls {{ static_data_store }}/sensu/definitions | sed 's/\.j2//'
- notify: restart sensu-server service
|