paulbsd-salt/states/sensu/agent.sls

76 lines
1.6 KiB
Plaintext
Raw Normal View History

2020-07-10 00:58:55 +02:00
---
{%- from "sensu/map.jinja" import sensu with context %}
sensu-group:
group.present:
- name: sensu
- gid: 900
sensu-user:
user.present:
- name: sensu
- uid: 900
- gid: 900
- allow_uid_change: True
sensu-agent-bin:
file.managed:
- name: /usr/sbin/sensu-agent
- source: {{ sensu.fetch_url }}/sensu-agent-{{ salt['grains.get']('kernel')|lower }}-{{ salt['grains.get']('osarch')|lower }}
- skip_verify: True
- user: root
- group: root
- mode: 0755
- watch_in:
- service: sensu-agent-service
sensu-agent-service-file:
file.managed:
- name: /etc/systemd/system/sensu-agent.service
- source: salt://sensu/sensu-agent.service
- user: root
- group: root
- mode: 0644
sensu-agent-cache-dir:
file.directory:
- name: /var/cache/sensu
- user: sensu
- group: sensu
- mode: 0750
- recurse:
- user
- group
- require:
- user: sensu-user
- group: sensu-group
sensu-agent-config-dir:
file.directory:
- name: /etc/sensu
- user: sensu
- group: sensu
- mode: 0750
- require:
- user: sensu-user
- group: sensu-group
sensu-agent-config-file:
file.managed:
- name: /etc/sensu/agent.yml
- source: salt://sensu/agent.yml.j2
- user: sensu
- group: sensu
- mode: 0640
- template: jinja
- watch_in:
- service: sensu-agent-service
- require:
- file: sensu-agent-config-dir
- file: sensu-agent-cache-dir
sensu-agent-service:
service.running:
- name: sensu-agent
- enable: True
- require:
- file: sensu-agent-config-file