Skip to content

Instantly share code, notes, and snippets.

@jeffpatton1971
Last active October 26, 2015 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffpatton1971/09ef1ed1d16bb555290f to your computer and use it in GitHub Desktop.
Save jeffpatton1971/09ef1ed1d16bb555290f to your computer and use it in GitHub Desktop.
define multiple instance names for mesos based on nodegroups
root@salt:/srv# cat pillar/top.sls
base:
'*':
- disabled
- admins
'all_access':
- match: nodegroup
- users
- contractors
'platformcluster':
- match: nodegroup
- mesos
'platformops':
- match: nodegroup
- mesos
root@salt:/srv# cat pillar/mesos/init.sls
mesos:
- platformcluster:
- instance: ninjaz
- platformops:
- instance: lazers
root@salt:/srv# cat salt/top.sls
base:
'*':
- disabled
- admins
'all_access':
- match: nodegroup
- users
- contractors
'platformcluster':
- match: nodegroup
- collectd
root@salt:/srv# cat salt/collectd/init.sls
Install_collectd:
pkg.installed:
- pkgs:
- collectd
/etc/collectd/collectd.conf:
file:
- managed
- source: salt://collectd/files/collectd.conf
- user: root
- group: root
- mode: 644
- require:
- pkg: Install_collectd
{% if 'slave' in salt['grains.get']('role') %}
/etc/collectd/collectd.conf.d/mesos-slave.conf:
file:
- managed
- source: salt://collectd/files/mesos-slave.conf
- user: root
- group: root
- mode: 644
- template: jinja
- require:
- pkg: Install_collectd
/usr/lib/collectd/python/mesos-slave.py:
file:
- managed
- source: salt://collectd/files/mesos-slave.py
- user: root
- group: root
- mode: 755
- require:
- pkg: Install_collectd
{% endif %}
root@salt:/srv# cat salt/collectd/files/mesos-slave.conf
<LoadPlugin "python">
Globals true
</LoadPlugin>
<Plugin "python">
ModulePath "/usr/lib/collectd/python/"
Import "mesos-slave"
<Module "mesos-slave">
Instance "{{ THIS ShOULD BE FROM THE PILLAR }}"
Host "{{ salt['grains.get']('fqdn') }}"
Port 5051
Verbose false
Version "0.23.0"
</Module>
</Plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment