Merge pull request #9 from iamseth/master

add RedHat config file support
This commit is contained in:
Nitin Madhok 2014-11-17 14:16:07 -05:00
commit e6b2f44415
3 changed files with 34 additions and 1 deletions

View File

@ -1,13 +1,19 @@
{% from 'memcached/map.jinja' import memcached with context %}
include: include:
- memcached - memcached
/etc/memcached.conf: {{ memcached.config_file }}:
file: file:
- managed - managed
- template: jinja - template: jinja
- user: root - user: root
- group: root - group: root
- mode: 644 - mode: 644
{% if grains['os_family'] == 'Debian' %}
- source: salt://memcached/templates/memcached.conf - source: salt://memcached/templates/memcached.conf
{% elif grains['os_family'] == 'RedHat' %}
- source: salt://memcached/templates/sysconfig/memcached
{% endif %}
- watch_in: - watch_in:
- service: memcached - service: memcached

View File

@ -18,10 +18,12 @@
'server': 'memcached', 'server': 'memcached',
'service': 'memcached', 'service': 'memcached',
'python': 'python-memcache', 'python': 'python-memcache',
'config_file': '/etc/memcached.conf',
}, },
'RedHat': { 'RedHat': {
'server': 'memcached', 'server': 'memcached',
'service': 'memcached', 'service': 'memcached',
'python': 'python-memcached', 'python': 'python-memcached',
'config_file': '/etc/sysconfig/memcached',
}, },
}, merge=salt['pillar.get']('memcached:lookup')) %} }, merge=salt['pillar.get']('memcached:lookup')) %}

View File

@ -0,0 +1,25 @@
{% from 'memcached/macros.sls' import get_config_item with context -%}
PORT="{{ get_config_item('port') }}"
USER="{{ get_config_item('user') }}"
MAXCONN="{{ get_config_item('max_connections') }}"
CACHESIZE="{{ get_config_item('memory_cap') }}"
OPTIONS="-l {{ get_config_item('listen_address') }}"
{% if get_config_item('lock_paged_memory') == 'True' %}
OPTIONS="$OPTIONS -k"
{% endif %}
{% if get_config_item('error_on_mem_full') == 'True' %}
OPTIONS="$OPTIONS -M"
{% endif %}
{% if get_config_item('max_core_file_"limit') == 'True' %}
OPTIONS="$OPTIONS -r"
{% endif %}
{% if get_config_item('verbose_level') == '1' %}
OPTIONS="$OPTIONS -v >> {{ get_config_item('log_file') }} 2>&1"
{% elif get_config_item('verbose_level') == '2' %}
OPTIONS="$OPTIONS -vv >> {{ get_config_item('log_file') }} 2>&1"
{% endif %}