paulbsd-salt/states/sensu/agent.sls
2020-07-30 14:07:27 +02:00

78 lines
1.6 KiB
Plaintext

---
{%- 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.j2
- user: root
- group: root
- template: jinja
- 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