feat(macos): add darwin support

This commit is contained in:
noelmcloughlin 2020-08-01 13:52:38 +01:00
parent dfa7ec3204
commit e92704da1f
2 changed files with 20 additions and 0 deletions

View File

@ -19,6 +19,7 @@ memcached:
{%- else %} {%- else %}
pkg.installed: pkg.installed:
- name: {{ memcached.server }} - name: {{ memcached.server }}
- runas: {{ memcached.rootuser }}
{%- endif %} {%- endif %}
- require_in: - require_in:
- service: memcached - service: memcached

View File

@ -1,3 +1,9 @@
{%- if grains.os == 'MacOS' %}
{%- set rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %}
{%- else %}
{%- set rootuser == 'root' %}
{%- endif %}
{% set defaults = { {% set defaults = {
'config':{ 'config':{
'daemonize': True, 'daemonize': True,
@ -15,18 +21,27 @@
} }
} %} } %}
{% set memcached = salt['grains.filter_by']({ {% set memcached = salt['grains.filter_by']({
'Default':{
'server': 'memcached',
'service': 'memcached',
'python': 'python-python-memcached',
'config_file': '/etc/memcached.conf',
'rootuser': {{ rootuser }},
},
'Suse':{ 'Suse':{
'server': 'memcached', 'server': 'memcached',
'service': 'memcached', 'service': 'memcached',
'python': 'python-python-memcached', 'python': 'python-python-memcached',
'config_file': '/etc/memcached.conf', 'config_file': '/etc/memcached.conf',
'libmemcached': 'libmemcached-devel', 'libmemcached': 'libmemcached-devel',
'rootuser': {{ rootuser }},
}, },
'FreeBSD':{ 'FreeBSD':{
'server': 'memcached', 'server': 'memcached',
'service': 'memcached', 'service': 'memcached',
'config_file': '/usr/local/etc/rc.d/memcached', 'config_file': '/usr/local/etc/rc.d/memcached',
'libmemcached': 'libmemcached-devel', 'libmemcached': 'libmemcached-devel',
'rootuser': {{ rootuser }},
}, },
'Debian':{ 'Debian':{
'server': 'memcached', 'server': 'memcached',
@ -34,6 +49,7 @@
'python': 'python-memcache', 'python': 'python-memcache',
'config_file': '/etc/memcached.conf', 'config_file': '/etc/memcached.conf',
'libmemcached': 'libmemcached-dev', 'libmemcached': 'libmemcached-dev',
'rootuser': {{ rootuser }},
}, },
'RedHat': { 'RedHat': {
'server': 'memcached', 'server': 'memcached',
@ -41,6 +57,7 @@
'python': 'python-memcached', 'python': 'python-memcached',
'config_file': '/etc/sysconfig/memcached', 'config_file': '/etc/sysconfig/memcached',
'libmemcached': 'libmemcached-devel', 'libmemcached': 'libmemcached-devel',
'rootuser': {{ rootuser }},
}, },
'Gentoo':{ 'Gentoo':{
'server': 'net-misc/memcached', 'server': 'net-misc/memcached',
@ -48,6 +65,7 @@
'python': 'dev-python/python-memcache', 'python': 'dev-python/python-memcache',
'config_file': '/etc/conf.d/memcached', 'config_file': '/etc/conf.d/memcached',
'libmemcached': 'dev-libs/libmemcached', 'libmemcached': 'dev-libs/libmemcached',
'rootuser': {{ rootuser }},
}, },
'Arch':{ 'Arch':{
'server': 'memcached', 'server': 'memcached',
@ -55,5 +73,6 @@
'python': 'python2-memcached', 'python': 'python2-memcached',
'config_file': '/etc/memcached', 'config_file': '/etc/memcached',
'libmemcached': 'libmemcached', 'libmemcached': 'libmemcached',
'rootuser': {{ rootuser }},
}, },
}, merge=salt['pillar.get']('memcached:lookup')) %} }, merge=salt['pillar.get']('memcached:lookup')) %}