Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x
- Puppet >= 7.0.0 < 9.0.0
- Windows, FreeBSD, , , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'saz-memcached', '9.0.0'
Learn more about managing modules with a PuppetfileDocumentation
memached module for Puppet
Manage memcached via Puppet
How to use
Starting with version 3.0.0, memcached will be listening on 127.0.0.1 only.
This should make setups more secure (e.g. if there are no firewall rules in place).
For the old behaviour, you need to set listen to '0.0.0.0'.
Use roughly 90% of memory
class { 'memcached': }
Set a fixed memory limit in MB
class { 'memcached':
max_memory => 2048
}
Use 12% of available memory
class { 'memcached':
max_memory => '12%'
}
Install multiple memcached instances
the multiinstance support uses a systemd instance unit file. This will be placed
at /etc/systemd/system/memcached@.service
. It allows us to manage multiple
instances via the same unit file. To start a simple instance, you only need to
know the desired TCP port:
memcached::instance{'11222':}
that's it! It will bind to localhost and listen to TCP port 11222. You might want to tune the systemd limits, for example the number of file descriptors (LimitNOFILE) or the number of processes (LimitNPROC):
memcached::instance{'11222':
limits => {
'LimitNOFILE' => 8192,
'LimitNPROC' => 16384,
}
}
All systemd limits are documented in the systemd documentation.
Another usecase. Let's assume your name is Eric and you want to change the actual memcached parameters, for example to bind it to every interface:
memcached::instance{'11222':
override_content => "[Service]\nEnvironment='LISTEN=-l 0.0.0.0'",
}
Maybe Eric also wants to override the cache size (the unit is MB):
memcached::instance{'11222':
override_content => "[Service]\nEnvironment=CACHESIZE=4096\n",
}
last but not least, Eric might also want to override the maximum amount of connections (the default is 1024):
memcached::instance{'11222':
override_content => "[Service]\nEnvironment=MAXCONN=4096\n",
}
Now Eric wants to use all those three settings at the same time:
memcached::instance{'11222':
override_content => "[Service]\nEnvironment=MAXCONN=4096\nEnvironment=CACHESIZE=4096\nEnvironment='LISTEN=-l 0.0.0.0'\n",
}
Instead of passing a long string with multiple \n
, Eric can also put the
content in a file and provide that:
memcached::instance{'11222':
override_source => "${module_name}/memcached_11222_override.conf\n",
}
Other class parameters
- $package_ensure = 'present'
- $logfile = '/var/log/memcached.log'
- $logstdout = false (Set this to true to disable logging to a file/syslog entirely, useful when memcached runs in containers)
- $pidfile = '/var/run/memcached.pid' (Debian family only, set to false to disable pidfile)
- $max_memory = false
- $max_item_size = false
- $min_item_size = false
- $factor = false
- $lock_memory = false (WARNING: good if used intelligently, google for -k key)
- $listen = '127.0.0.1' (if TLS/SSL is enabled, 'notls' prefix can be used to disable for specific listeners "notls::")
- $listen_ip = '127.0.0.1' (deprecated, listen will take precedence over this)
- $tcp_port = 11211
- $udp_port = 0
- $manage_firewall = false
- $user = '' (OS specific setting, see params.pp)
- $max_connections = 8192
- $verbosity = undef
- $unix_socket = undef
- $install_dev = false (TRUE if 'libmemcached-dev' package should be installed)
- $processorcount = $::processorcount
- $service_restart = true (restart service after configuration changes, false to prevent restarts)
- $service_flags = '-l 127.0.0.1 -u _memcached -P /var/run/memcached.pid' (only relevant for OpenBSD, to configure the service)
- $use_sasl = false (start memcached with SASL support)
- $use_tls = false (start memcached with TLS support)
- $tls_cert_chain = undef
- $tls_key = undef
- $tls_ca_cert = undef
- $tls_verify_mode = 1 (0: None, 1: Request, 2: Require, 3: Once)
- $large_mem_pages = false (try to use large memory pages)
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[9.0.0]
Added
- Add support for OpenBSD (#162, #166)
Changed
- BREAKING CHANGE: Fix Ubuntu pidfile and default user (#160)
- replace systemd::service_limits with systemd::manage_dropin (#169)
- make module firewall < 9.0.0 compatible (#168)
- allow puppet/systemd < 8, add Debian 12 as supported OS (#164)
Removed
- BREAKING CHANGE: drop EOL Ubuntu 18.04 (#170)
- BREAKING CHANGE: drop puppet6 support (#165)
[8.3.0]
Added
- Add max_reqs_per_event option for the memcached config (#136)
- Add support for Puppet < 9, stdlib < 10, firewall < 9, systemd < 7, selinux < 5 (#157)
Fixed
- Allow disabling PID file (#156)
- README: use new parameter for address binding (#152)
- Bugfix: replace legacy fact in sysconfig-template (#151)
- set file ensure based on $package_ensure (#150)
- fix: wrong camelcase in Stdlib::IP::Address type (#148)
[8.2.0]
Added
- Support puppet/systemd < 5.0.0 (#143)
- Support puppetlabs/firewall < 6.0.0
Changed
- Stop using deprecated Stdlib::Compat::Ip_address (#145)
Removed
- remove Debian 9 as supported OS
[8.1.0]
Added
- Support for RedHat 9 and CentOS 9
[8.0.0]
Changed
- BREAKING CHANGE: switch from camptocamp/systemd to puppet/systemd
- Improved tests
- Load modern facts first (#138)
- Make sure memcached logfile exists (#140)
- Allow stdlib < 9.0.0
Fixed
- Fix duplicate systemd daemon-reload execs (#137)
Added
- Added support for Debian 11 and Ubuntu 22.04
[7.0.0]
Changed
- BREAKING CHANGE: Testing for Puppet 5 has been dropped
- Switched from Travis to Github Actions
- Dependencies updated to support the newest releases
[6.0.0]
Added
- Add listen parameter as successor for listen_ip (#127)
Deprecated
- listen_ip parameter is deprecated in favor of new listen parameter (#127)
Changed
- Use camptocamp/systemd v2.12.0 for tests, as newer versions might drop support for puppet 5
Removed
- Dropped notls_listener_addr and notls_listener_port parameter in favor of listen_ip (#128)
[5.0.0]
Added
- Add sasl support on RHEL derivatives (#122)
- Add notls_listener_addr and notls_listener_port parameters (#124)
Changed
- BREAKING CHANGE: Disable UDP by default (#125)
If you need UDP enabled, set
memcached::udp_port
to a non-zero value, e.g. 11211
[4.0.0]
Added
- Support management of multiple memcached instances (systemd required!) #120
- Add FreeBSD to list of supported operatingsystems
Removed
- Drop support for Puppet 4 (EOL) #116
[3.7.0]
Added
- Add support to set TLS parameters in /etc/sysconfig/memcached (#113)
Fixed
- Make ssl_ca_cert optional (#112)
[3.6.0]
Added
- Add TLS support (#109)
[3.5.0]
Fixed
- allow FreeBSD to set max memory (#104)
Changed
- Dependencies updated (#107)
- Better FreeBSD tests
[3.4.0]
Fixed
- factor should be a string or number, not boolean
Added
- Add Puppet 6 to travis checks
Changed
- Update Puppet version requirement to include version 6 (< 7.0.0)
- Unpin firewall module in fixtures
- Require puppetlabs_spec_helper >= 2.11.0
Removed
- Drop Ruby 2.1 from travis checks
Dependencies
- puppetlabs/stdlib (>= 4.13.1 < 10.0.0)
- puppetlabs/firewall (>= 0.1.0 < 9.0.0)
- puppet/systemd (>= 6.0.0 < 8.0.0)
- puppet/selinux (>= 3.2.0 < 5.0.0)
Copyright 2011-2016 Steffen Zieger Copyright 2014-2016 Garrett Honeycutt <code@garretthoneycutt.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.