This repository has been archived by the owner on Jan 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 78ddf27
Showing
12 changed files
with
196 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Ansible Role: Memcached | ||
|
||
Installs Memcached (latest) | ||
|
||
## Supported platforms | ||
|
||
``` | ||
CentOS 6 & 7 | ||
Ubuntu 14.04 | ||
``` | ||
|
||
## Requirements | ||
|
||
None | ||
|
||
## Role Variables | ||
|
||
Start: | ||
|
||
``` | ||
memcached_start: true | ||
``` | ||
|
||
Start on boot: | ||
|
||
``` | ||
memcached_start_on_boot: true | ||
``` | ||
|
||
Listen address: | ||
|
||
``` | ||
memcached_address: 127.0.0.1 | ||
``` | ||
|
||
Listen port: | ||
|
||
``` | ||
memcached_port: 11211 | ||
``` | ||
|
||
Memory: | ||
|
||
``` | ||
memcached_memory: 64 | ||
``` | ||
|
||
Max connections: | ||
|
||
``` | ||
memcached_connections: 1024 | ||
``` | ||
|
||
## Dependencies | ||
|
||
``` | ||
pcextreme.repo-epel | ||
pcextreme.repo-pcextreme | ||
``` | ||
|
||
## Example Playbook | ||
|
||
``` | ||
- hosts: servers | ||
roles: | ||
- { role: pcextreme.memcached } | ||
``` | ||
|
||
## License | ||
|
||
MIT | ||
|
||
## Author Information | ||
|
||
Created by [Attila van der Velde](https://github.com/vdvm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
memcached_start: true | ||
memcached_start_on_boot: true | ||
|
||
memcached_address: 127.0.0.1 | ||
memcached_port: 11211 | ||
memcached_memory: 64 | ||
memcached_connections: 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: restart memcached | ||
service: name=memcached state=restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
galaxy_info: | ||
author: "Attila van der Velde" | ||
description: "Installs Memcached (latest)" | ||
company: "PCextreme B.V." | ||
license: "license (MIT)" | ||
min_ansible_version: 1.8 | ||
platforms: | ||
- name: EL | ||
versions: | ||
- 6 | ||
- 7 | ||
- name: Ubuntu | ||
versions: | ||
- trusty | ||
categories: | ||
- system | ||
- web | ||
|
||
dependencies: | ||
- { role: pcextreme.repo-epel } | ||
- { role: pcextreme.repo-pcextreme } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
- name: Install service | ||
yum: name=memcached enablerepo=epel state=present | ||
|
||
- name: Update config | ||
template: src=centos_memcached.j2 dest=/etc/sysconfig/memcached owner=root group=root mode=0644 | ||
notify: restart memcached | ||
|
||
- name: Start and enable service | ||
service: name=memcached state={{ 'started' if memcached_start else 'stopped' }} enabled={{ 'yes' if memcached_start_on_boot else 'no' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- include: centos.yml | ||
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version|int >= 6 | ||
|
||
- include: ubuntu.yml | ||
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
- name: Update apt cache | ||
apt: update_cache=yes cache_valid_time=900 | ||
|
||
- name: Install service | ||
apt: pkg=memcached state=present | ||
|
||
- name: Update config | ||
template: src=ubuntu_memcached.j2 dest=/etc/default/memcached owner=root group=root mode=0644 | ||
notify: restart memcached | ||
|
||
- name: Update config | ||
template: src=ubuntu_memcached.conf.j2 dest=/etc/memcached.conf owner=root group=root mode=0644 | ||
notify: restart memcached | ||
|
||
- name: Start and enable service | ||
service: name=memcached state={{ 'started' if memcached_start else 'stopped' }} enabled={{ 'yes' if memcached_start_on_boot else 'no' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PORT="{{ memcached_port }}" | ||
USER="memcached" | ||
MAXCONN="{{ memcached_connections }}" | ||
CACHESIZE="{{ memcached_memory }}" | ||
OPTIONS="-l {{ memcached_address }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# memcached default config file | ||
# 2003 - Jay Bonci <jaybonci@debian.org> | ||
# This configuration file is read by the start-memcached script provided as | ||
# part of the Debian GNU/Linux distribution. | ||
|
||
# Run memcached as a daemon. This command is implied, and is not needed for the | ||
# daemon to run. See the README.Debian that comes with this package for more | ||
# information. | ||
-d | ||
|
||
# Log memcached's output to /var/log/memcached | ||
logfile /var/log/memcached.log | ||
|
||
# Be verbose | ||
# -v | ||
|
||
# Be even more verbose (print client commands as well) | ||
# -vv | ||
|
||
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default | ||
# Note that the daemon will grow to this size, but does not start out holding this much | ||
# memory | ||
-m {{ memcached_memory }} | ||
|
||
# Default connection port is 11211 | ||
-p {{ memcached_port }} | ||
|
||
# Run the daemon as root. The start-memcached will default to running as root if no | ||
# -u command is present in this config file | ||
-u memcache | ||
|
||
# Specify which IP address to listen on. The default is to listen on all IP addresses | ||
# This parameter is one of the only security measures that memcached has, so make sure | ||
# it's listening on a firewalled interface. | ||
-l {{ memcached_address }} | ||
|
||
# Limit the number of simultaneous incoming connections. The daemon default is 1024 | ||
-c {{ memcached_connections }} | ||
|
||
# Lock down all paged memory. Consult with the README and homepage before you do this | ||
# -k | ||
|
||
# Return error when memory is exhausted (rather than removing items) | ||
# -M | ||
|
||
# Maximize core file limit | ||
# -r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ENABLE_MEMCACHED={{ 'yes' if memcached_start else 'no' }} |