2019-01-01 19:44:04 +00:00
|
|
|
---
|
2019-02-16 18:00:14 +00:00
|
|
|
- include_tasks: 'backend-dependencies-{{ ansible_os_family|lower }}.yml'
|
|
|
|
|
2019-01-01 19:44:04 +00:00
|
|
|
- name: install sensu-backend packages
|
2019-02-16 18:00:14 +00:00
|
|
|
package:
|
2019-01-01 19:44:04 +00:00
|
|
|
name: '{{ packages }}'
|
|
|
|
vars:
|
|
|
|
packages:
|
|
|
|
- sensu-go-backend
|
|
|
|
- sensu-go-cli
|
|
|
|
register: result
|
|
|
|
retries: 3
|
|
|
|
delay: 1
|
|
|
|
until: result is success
|
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: copy backend configuration file
|
|
|
|
copy:
|
|
|
|
content: '{{ sensu_backend_full_config|to_nice_yaml }}'
|
|
|
|
dest: /etc/sensu/backend.yml
|
|
|
|
owner: root
|
|
|
|
group: sensu
|
|
|
|
mode: 0640
|
|
|
|
notify: restart sensu-backend
|
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: enable and start sensu-backend service
|
|
|
|
systemd:
|
|
|
|
name: sensu-backend
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: wait sensu backend is started
|
|
|
|
wait_for:
|
|
|
|
port: '{{ sensu_api_url.split(":")[2]|default(80) }}'
|
|
|
|
delay: 5
|
|
|
|
tags: sensu
|
|
|
|
|
2019-05-06 12:15:54 +00:00
|
|
|
- name: manage cluster roles
|
|
|
|
sensugo_cluster_role:
|
2019-01-01 19:44:04 +00:00
|
|
|
name: '{{ item.name }}'
|
2019-05-06 12:15:54 +00:00
|
|
|
rules: '{{ item.rules }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
state: '{{ item.state|default("present") }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
2019-05-06 12:15:54 +00:00
|
|
|
loop: '{{ sensu_cluster_roles }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|
|
|
|
|
2019-05-06 12:15:54 +00:00
|
|
|
- name: manage users
|
|
|
|
sensugo_user:
|
2019-01-01 19:44:04 +00:00
|
|
|
name: '{{ item.name }}'
|
2019-05-06 12:15:54 +00:00
|
|
|
groups: '{{ item.groups }}'
|
|
|
|
password: '{{ item.password }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
state: '{{ item.state|default("present") }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
2019-05-06 12:15:54 +00:00
|
|
|
loop: '{{ sensu_users }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: manage namespaces
|
|
|
|
sensugo_namespace:
|
|
|
|
name: '{{ item.name }}'
|
|
|
|
state: '{{ item.state|default("present") }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
|
|
|
loop: '{{ sensu_namespaces }}'
|
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: manage assets
|
|
|
|
sensugo_asset:
|
|
|
|
name: '{{ item.name }}'
|
2019-02-15 19:09:49 +00:00
|
|
|
namespaces: '{{ item.namespaces|default(["default"]) }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
url: '{{ item.url }}'
|
|
|
|
sha512: '{{ item.sha512 }}'
|
|
|
|
filters: '{{ item.filters|default([]) }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
|
|
|
loop: '{{ sensu_assets }}'
|
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: manage filters
|
|
|
|
sensugo_filter:
|
|
|
|
name: '{{ item.name }}'
|
2019-02-15 19:09:49 +00:00
|
|
|
namespaces: '{{ item.namespaces|default(["default"]) }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
action: '{{ item.action|default("allow") }}'
|
|
|
|
expressions: '{{ item.expressions }}'
|
|
|
|
runtime_assets: '{{ item.runtime_assets|default([]) }}'
|
|
|
|
state: '{{ item.state|default("present") }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
|
|
|
loop: '{{ sensu_filters }}'
|
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|
|
|
|
|
2019-03-13 22:16:50 +00:00
|
|
|
- name: manage mutators
|
|
|
|
sensugo_mutator:
|
|
|
|
name: '{{ item.name }}'
|
|
|
|
namespaces: '{{ item.namespaces|default(["default"]) }}'
|
|
|
|
command: '{{ item.command }}'
|
|
|
|
options: '{{ item.options|default({}) }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
|
|
|
loop: '{{ sensu_mutators }}'
|
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-03-13 22:16:50 +00:00
|
|
|
tags: sensu
|
|
|
|
|
2019-01-01 19:44:04 +00:00
|
|
|
- name: manage handlers
|
|
|
|
sensugo_handler:
|
|
|
|
name: '{{ item.name }}'
|
2019-02-15 19:09:49 +00:00
|
|
|
namespaces: '{{ item.namespaces|default(["default"]) }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
type: '{{ item.type|default("pipe") }}'
|
|
|
|
command: '{{ item.command }}'
|
|
|
|
filters: '{{ item.filters|default([]) }}'
|
|
|
|
options: '{{ item.options|default({}) }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
|
|
|
loop: '{{ sensu_handlers }}'
|
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|
|
|
|
|
|
|
|
- name: manage checks
|
|
|
|
sensugo_check:
|
|
|
|
name: '{{ item.name }}'
|
2019-02-15 19:09:49 +00:00
|
|
|
namespaces: '{{ item.namespaces|default(["default"]) }}'
|
2019-05-09 09:08:36 +00:00
|
|
|
labels: '{{ item.labels|default({}) }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
command: '{{ item.command }}'
|
|
|
|
handlers: '{{ item.handlers|default([]) }}'
|
|
|
|
subscriptions: '{{ item.subscriptions }}'
|
|
|
|
interval: '{{ item.interval|default(60) }}'
|
|
|
|
options: '{{ item.options|default({}) }}'
|
|
|
|
state: '{{ item.state|default("present") }}'
|
|
|
|
api_url: '{{ sensu_api_url }}'
|
|
|
|
api_user: '{{ sensu_api_user }}'
|
|
|
|
api_password: '{{ sensu_api_password }}'
|
|
|
|
loop: '{{ sensu_checks }}'
|
|
|
|
run_once: true
|
2019-03-14 06:44:09 +00:00
|
|
|
no_log: '{{ sensu_no_log }}'
|
2019-01-01 19:44:04 +00:00
|
|
|
tags: sensu
|