Skip to content

Instantly share code, notes, and snippets.

@gordonm
Created June 8, 2012 16:59
Show Gist options
  • Save gordonm/2896872 to your computer and use it in GitHub Desktop.
Save gordonm/2896872 to your computer and use it in GitHub Desktop.
Salt state example
include:
- yum.omd
mon-required-pkgs:
pkg.installed:
- names:
- omd-0.54
- mod_ssl
- check_mk-agent-mon
- require:
- file: /etc/yum.repos.d/omd.repo
preinstall.sh:
file.managed:
- source: salt://mon-server/scripts/preinstall.sh
- name: /usr/local/bin/preinstall.sh
- user: root
- group: root
- mode: 700
- template: jinja
postinstall.sh:
file.managed:
- source: salt://mon-server/scripts/postinstall.sh
- name: /usr/local/bin/postinstall.sh
- user: root
- group: root
- mode: 700
- template: jinja
check_mk_config.py:
file.managed:
- source: salt://mon-server/scripts/check_mk_config.py
- name: /usr/local/bin/check_mk_config.py
- user: root
- group: root
- mode: 700
- template: jinja
/usr/local/bin/preinstall.sh:
cmd.run:
- require:
- file: preinstall.sh
- pkg: mon-required-pkgs
nagios:
file.recurse:
- source: salt://mon-server/nagios
- name: /opt/omd/sites/{{ grains.location }}/etc/nagios/conf.d
- user: {{ grains.location }}
- group: {{ grains.location }}
- mode: 664
- require:
- file: check_mk
check_mk:
file.managed:
- source: salt://mon-server/check_mk/main.mk
- name: /opt/omd/sites/{{ grains.location }}/etc/check_mk/main.mk
- user: {{ grains.location }}
- group: {{ grains.location }}
- mode: 644
- template: jinja
- require:
- file: check_mk_config.py
- pkg: mon-required-pkgs
- cmd: /usr/local/bin/preinstall.sh
/usr/local/bin/postinstall.sh:
cmd.run:
- order: last
- require:
- file: postinstall.sh
- pkg: mon-required-pkgs
# vim: set ft=yaml ts=2 sw=2 et sts=2:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment