2014-11-17 20:10:20 +01:00
|
|
|
{% from 'memcached/map.jinja' import memcached with context %}
|
2018-03-23 23:11:30 +01:00
|
|
|
{% from 'memcached/macros.sls' import get_config_item with context -%}
|
2014-11-17 20:10:20 +01:00
|
|
|
|
2014-05-15 00:30:37 +02:00
|
|
|
include:
|
|
|
|
- memcached
|
2018-03-23 23:11:30 +01:00
|
|
|
|
|
|
|
memcached_user:
|
|
|
|
user.present:
|
|
|
|
- name : {{ get_config_item('user') }}
|
|
|
|
- createhome: False
|
|
|
|
- shell: /sbin/nologin
|
2014-05-15 00:30:37 +02:00
|
|
|
|
2014-11-17 20:10:20 +01:00
|
|
|
{{ memcached.config_file }}:
|
2014-05-15 00:30:37 +02:00
|
|
|
file:
|
|
|
|
- managed
|
|
|
|
- template: jinja
|
|
|
|
- user: root
|
|
|
|
- group: root
|
|
|
|
- mode: 644
|
2023-02-19 15:55:39 +01:00
|
|
|
{%- if grains['os_family'] != 'Suse' %}
|
2014-11-17 20:10:20 +01:00
|
|
|
{% if grains['os_family'] == 'Debian' %}
|
2014-05-15 00:30:37 +02:00
|
|
|
- source: salt://memcached/templates/memcached.conf
|
2014-11-17 20:10:20 +01:00
|
|
|
{% elif grains['os_family'] == 'RedHat' %}
|
|
|
|
- source: salt://memcached/templates/sysconfig/memcached
|
2014-12-03 09:31:50 +01:00
|
|
|
{% elif grains['os_family'] == 'Gentoo' %}
|
|
|
|
- source: salt://memcached/templates/conf.d/memcached
|
2015-09-10 21:19:08 +02:00
|
|
|
{% elif grains['os_family'] == 'Arch' %}
|
|
|
|
- source: salt://memcached/templates/empty
|
2014-11-17 20:10:20 +01:00
|
|
|
{% endif %}
|
2023-02-19 15:55:39 +01:00
|
|
|
{%- endif %}
|
2014-05-15 00:30:37 +02:00
|
|
|
- watch_in:
|
|
|
|
- service: memcached
|
2018-03-23 23:11:30 +01:00
|
|
|
- require:
|
|
|
|
- user: memcached_user
|
|
|
|
|
2023-02-19 15:55:39 +01:00
|
|
|
{%- if grains['os_family'] == 'Suse' %}
|
|
|
|
memcached_settings_suse:
|
|
|
|
file.keyvalue:
|
|
|
|
- name: {{ memcached.config_file }}
|
|
|
|
- separator: '='
|
|
|
|
- key_values:
|
|
|
|
MEMCACHED_USER: '{{ get_config_item('user') }}'
|
|
|
|
MEMCACHED_GROUP: '{{ get_config_item('group') }}'
|
|
|
|
MEMCACHED_PARAMS: '-l {{ get_config_item('listen_address') }}'
|
|
|
|
- watch_in:
|
|
|
|
- service: memcached
|
|
|
|
{%- endif %}
|