Add Ansible role for memcached

Note, this is not in the inventories/site.yml as it will be a
transparent dependency of Swift.

Change-Id: Ic8c80072596594e646ece74ac0ce74c7000398ff
Partitially-Implements: blueprint ansible-swift
This commit is contained in:
Paul Bourke 2015-08-14 13:26:04 +00:00
parent 9ddd415486
commit d13163ab51
10 changed files with 58 additions and 4 deletions

View File

@ -89,6 +89,8 @@ neutron_server_port: "9696"
cinder_api_port: "8776" cinder_api_port: "8776"
memcached_port: "11211"
#################### ####################
# Openstack options # Openstack options

View File

@ -38,6 +38,9 @@ network
[cinder:children] [cinder:children]
control control
[memcached:children]
control
# Additional control implemented here. These groups allow you to control which # Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level. # services run on which hosts at a per-service level.

View File

@ -44,6 +44,9 @@ network
[cinder:children] [cinder:children]
control control
[memcached:children]
control
# Additional control implemented here. These groups allow you to control which # Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level. # services run on which hosts at a per-service level.

View File

@ -0,0 +1,9 @@
---
project_name: "memcached"
####################
# Docker
####################
memcached_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-memcached"
memcached_tag: "{{ openstack_release }}"
memcached_image_full: "{{ memcached_image }}:{{ memcached_tag }}"

View File

@ -0,0 +1,11 @@
---
- name: Ensuring config directory exists
file:
path: "{{ node_config_directory }}/memcached/"
state: "directory"
recurse: "yes"
- name: Copying over config(s)
template:
src: "memcached.conf.j2"
dest: "{{ node_config_directory }}/memcached/memcached.conf"

View File

@ -0,0 +1,4 @@
---
- include: config.yml
- include: start.yml

View File

@ -0,0 +1,19 @@
---
- name: Starting memcached container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: memcached
image: "{{ memcached_image_full }}"
volumes: "{{ node_config_directory }}/memcached/:/opt/kolla/memcached/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['memcached']

View File

@ -0,0 +1 @@
OPTIONS="-l {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -p {{ memcached_port }}"

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
SOURCE="/opt/kolla/memcached/memcached" SOURCE="/opt/kolla/memcached/memcached.conf"
TARGET="/etc/sysconfig/memcached" TARGET="/etc/memcached.conf"
OWNER="swift" OWNER="memcached"
if [[ -f "$SOURCE" ]]; then if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET cp $SOURCE $TARGET

View File

@ -11,4 +11,6 @@ source /opt/kolla/kolla-common.sh
# Execute config strategy # Execute config strategy
set_configs set_configs
exec $CMD $ARGS source /etc/memcached.conf
exec $CMD $ARGS $OPTIONS