git-subtree-dir: lemp-rhel7/roles/ansible-role-memcached git-subtree-split: 15a0808b0c8aff4c339775c149824306345c8fc7pull/63/head
commit
efea149d02
@ -0,0 +1 @@ |
|||||||
|
.DS_Store |
@ -0,0 +1,38 @@ |
|||||||
|
--- |
||||||
|
sudo: required |
||||||
|
language: python |
||||||
|
python: "2.7" |
||||||
|
|
||||||
|
env: |
||||||
|
- SITE=test.yml |
||||||
|
|
||||||
|
before_install: |
||||||
|
- sudo apt-get update -qq |
||||||
|
- sudo apt-get install -y curl |
||||||
|
|
||||||
|
install: |
||||||
|
# Install Ansible. |
||||||
|
- pip install ansible |
||||||
|
|
||||||
|
# Add ansible.cfg to pick up roles path. |
||||||
|
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg" |
||||||
|
|
||||||
|
script: |
||||||
|
# Check the role/playbook's syntax. |
||||||
|
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check" |
||||||
|
|
||||||
|
# Run the role/playbook with ansible-playbook. |
||||||
|
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo" |
||||||
|
|
||||||
|
# Run the role/playbook again, checking to make sure it's idempotent. |
||||||
|
- > |
||||||
|
ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo |
||||||
|
| grep -q 'changed=0.*failed=0' |
||||||
|
&& (echo 'Idempotence test: pass' && exit 0) |
||||||
|
|| (echo 'Idempotence test: fail' && exit 1) |
||||||
|
|
||||||
|
# Check the version of Memcached (if this output fails, it's not running). |
||||||
|
- memcached -h | head -1 |
||||||
|
|
||||||
|
notifications: |
||||||
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/ |
@ -0,0 +1,53 @@ |
|||||||
|
# Ansible Role: Memcached |
||||||
|
|
||||||
|
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-memcached.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-memcached) |
||||||
|
|
||||||
|
An Ansible Role that installs Memcached on RedHat/CentOS or Debian/Ubuntu Linux. |
||||||
|
|
||||||
|
## Requirements |
||||||
|
|
||||||
|
None. |
||||||
|
|
||||||
|
## Role Variables |
||||||
|
|
||||||
|
Available variables are listed below, along with default values (see `defaults/main.yml`): |
||||||
|
|
||||||
|
memcached_user: memcache |
||||||
|
|
||||||
|
The user under which the Memcached daemon will run. |
||||||
|
|
||||||
|
memcached_port: 11211 |
||||||
|
memcached_listen_ip: 127.0.0.1 |
||||||
|
|
||||||
|
The port and IP address (127.0.0.1 for localhost) on which Memcached will listen for requests. |
||||||
|
|
||||||
|
memcached_memory_limit: 64 |
||||||
|
memcached_connections: 1024 |
||||||
|
|
||||||
|
Memcached limits. The maximum amount of RAM `memcached` will consume (64MB is the default), and the maximum number of simultaneous connections memcached will handle. |
||||||
|
|
||||||
|
memcached_log_file: /var/log/memcached.log |
||||||
|
|
||||||
|
The location of the memcached log file. |
||||||
|
|
||||||
|
memcached_log_verbosity: "" |
||||||
|
|
||||||
|
Normally memcached does not log anything. Change to "-v" to enable logging or to "-vv" for debug logging. |
||||||
|
|
||||||
|
## Dependencies |
||||||
|
|
||||||
|
None. |
||||||
|
|
||||||
|
## Example Playbook |
||||||
|
|
||||||
|
- hosts: cache |
||||||
|
roles: |
||||||
|
- { role: geerlingguy.memcached } |
||||||
|
|
||||||
|
## License |
||||||
|
|
||||||
|
MIT / BSD |
||||||
|
|
||||||
|
## Author Information |
||||||
|
|
||||||
|
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/). |
@ -0,0 +1,9 @@ |
|||||||
|
--- |
||||||
|
memcached_port: 11211 |
||||||
|
memcached_listen_ip: 127.0.0.1 |
||||||
|
|
||||||
|
memcached_memory_limit: 64 |
||||||
|
memcached_connections: 1024 |
||||||
|
|
||||||
|
memcached_log_file: /var/log/memcached.log |
||||||
|
memcached_log_verbosity: "" |
@ -0,0 +1,3 @@ |
|||||||
|
--- |
||||||
|
- name: restart memcached |
||||||
|
service: name=memcached state=restarted |
@ -0,0 +1,24 @@ |
|||||||
|
--- |
||||||
|
dependencies: [] |
||||||
|
|
||||||
|
galaxy_info: |
||||||
|
author: geerlingguy |
||||||
|
description: Memcached for Linux |
||||||
|
company: "Midwestern Mac, LLC" |
||||||
|
license: "license (BSD, MIT)" |
||||||
|
min_ansible_version: 1.8 |
||||||
|
platforms: |
||||||
|
- name: EL |
||||||
|
versions: |
||||||
|
- 6 |
||||||
|
- 7 |
||||||
|
- name: Ubuntu |
||||||
|
versions: |
||||||
|
- precise |
||||||
|
- trusty |
||||||
|
- name: Debian |
||||||
|
versions: |
||||||
|
- all |
||||||
|
galaxy_tags: |
||||||
|
- web |
||||||
|
- database |
@ -0,0 +1,29 @@ |
|||||||
|
--- |
||||||
|
# Include variables and define needed variables. |
||||||
|
- name: Include OS-specific variables. |
||||||
|
include_vars: "{{ ansible_os_family }}.yml" |
||||||
|
|
||||||
|
- name: Define memcached_user. |
||||||
|
set_fact: |
||||||
|
memcached_user: "{{ __memcached_user }}" |
||||||
|
when: memcached_user is not defined |
||||||
|
|
||||||
|
# Setup/install tasks. |
||||||
|
- include: setup-RedHat.yml |
||||||
|
when: ansible_os_family == 'RedHat' |
||||||
|
|
||||||
|
- include: setup-Debian.yml |
||||||
|
when: ansible_os_family == 'Debian' |
||||||
|
|
||||||
|
# Configure Memcached. |
||||||
|
- name: Copy Memcached configuration. |
||||||
|
template: |
||||||
|
src: memcached-{{ ansible_os_family }}.conf.j2 |
||||||
|
dest: "{{ memcached_config_file }}" |
||||||
|
owner: root |
||||||
|
group: root |
||||||
|
mode: 0644 |
||||||
|
notify: restart memcached |
||||||
|
|
||||||
|
- name: Ensure Memcached is started and set to run on startup. |
||||||
|
service: name=memcached state=started enabled=yes |
@ -0,0 +1,6 @@ |
|||||||
|
--- |
||||||
|
- name: Update apt cache. |
||||||
|
apt: update_cache=yes cache_valid_time=86400 |
||||||
|
|
||||||
|
- name: Install Memcached. |
||||||
|
apt: name=memcached state=installed |
@ -0,0 +1,3 @@ |
|||||||
|
--- |
||||||
|
- name: Install Memcached. |
||||||
|
yum: name=memcached state=installed |
@ -0,0 +1,28 @@ |
|||||||
|
# {{ ansible_managed }} |
||||||
|
# Run memcached as a daemon. This command is implied, and is not needed for the |
||||||
|
# daemon to run. |
||||||
|
-d |
||||||
|
|
||||||
|
# Log memcached's output to /var/log/memcached |
||||||
|
logfile {{ memcached_log_file }} |
||||||
|
{{ memcached_log_verbosity }} |
||||||
|
|
||||||
|
# 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_limit }} |
||||||
|
|
||||||
|
# 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 {{ memcached_user }} |
||||||
|
|
||||||
|
# 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_listen_ip }} |
||||||
|
|
||||||
|
# Limit the number of simultaneous incoming connections. The daemon default is 1024 |
||||||
|
-c {{ memcached_connections }} |
@ -0,0 +1,20 @@ |
|||||||
|
# {{ ansible_managed }} |
||||||
|
# Default connection port is 11211 |
||||||
|
PORT="{{ memcached_port }}" |
||||||
|
|
||||||
|
# The user to run memcached as. |
||||||
|
USER="{{ memcached_user }}" |
||||||
|
|
||||||
|
# Limit the number of simultaneous incoming connections. The daemon default is 1024. |
||||||
|
MAXCONN="{{ memcached_connections }}" |
||||||
|
|
||||||
|
# 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 |
||||||
|
CACHESIZE="{{ memcached_memory_limit }}" |
||||||
|
|
||||||
|
# Extra options: |
||||||
|
# -l 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. |
||||||
|
OPTIONS="-l {{ memcached_listen_ip }} {{ memcached_log_verbosity }} >> {{ memcached_log_file }} 2>&1" |
@ -0,0 +1 @@ |
|||||||
|
localhost |
@ -0,0 +1,5 @@ |
|||||||
|
--- |
||||||
|
- hosts: localhost |
||||||
|
remote_user: root |
||||||
|
roles: |
||||||
|
- ansible-role-memcached |
@ -0,0 +1,3 @@ |
|||||||
|
--- |
||||||
|
__memcached_user: memcache |
||||||
|
memcached_config_file: /etc/memcached.conf |
@ -0,0 +1,3 @@ |
|||||||
|
--- |
||||||
|
__memcached_user: memcached |
||||||
|
memcached_config_file: /etc/sysconfig/memcached |
Reference in new issue