aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Bourke <paul.bourke@oracle.com>2015-08-14 13:26:04 +0000
committerPaul Bourke <paul.bourke@oracle.com>2015-08-21 13:52:06 +0000
commitd13163ab5165a314ea956c841155616fa305ee62 (patch)
tree900d5a5f593ce4d6324e96a54b70473b9c8a73b6
parent9ddd415486689dc0646ca106d3e96aa63f415136 (diff)
downloadkolla-d13163ab5165a314ea956c841155616fa305ee62.tar.gz
kolla-d13163ab5165a314ea956c841155616fa305ee62.zip
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
-rw-r--r--ansible/group_vars/all.yml2
-rw-r--r--ansible/inventory/all-in-one3
-rw-r--r--ansible/inventory/multinode3
-rw-r--r--ansible/roles/memcached/defaults/main.yml9
-rw-r--r--ansible/roles/memcached/tasks/config.yml11
-rw-r--r--ansible/roles/memcached/tasks/main.yml4
-rw-r--r--ansible/roles/memcached/tasks/start.yml19
-rw-r--r--ansible/roles/memcached/templates/memcached.conf.j21
-rw-r--r--docker/common/memcached/config-external.sh6
-rwxr-xr-xdocker/common/memcached/start.sh4
10 files changed, 58 insertions, 4 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 1773b299e..b316aff0d 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -89,6 +89,8 @@ neutron_server_port: "9696"
cinder_api_port: "8776"
+memcached_port: "11211"
+
####################
# Openstack options
diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one
index a23958aa1..48886a9b1 100644
--- a/ansible/inventory/all-in-one
+++ b/ansible/inventory/all-in-one
@@ -38,6 +38,9 @@ network
[cinder:children]
control
+[memcached:children]
+control
+
# Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level.
diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode
index 025edcea2..cd8f2fae0 100644
--- a/ansible/inventory/multinode
+++ b/ansible/inventory/multinode
@@ -44,6 +44,9 @@ network
[cinder:children]
control
+[memcached:children]
+control
+
# Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level.
diff --git a/ansible/roles/memcached/defaults/main.yml b/ansible/roles/memcached/defaults/main.yml
new file mode 100644
index 000000000..9c219d4fb
--- /dev/null
+++ b/ansible/roles/memcached/defaults/main.yml
@@ -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 }}"
diff --git a/ansible/roles/memcached/tasks/config.yml b/ansible/roles/memcached/tasks/config.yml
new file mode 100644
index 000000000..27e2c9766
--- /dev/null
+++ b/ansible/roles/memcached/tasks/config.yml
@@ -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"
diff --git a/ansible/roles/memcached/tasks/main.yml b/ansible/roles/memcached/tasks/main.yml
new file mode 100644
index 000000000..1f16915ad
--- /dev/null
+++ b/ansible/roles/memcached/tasks/main.yml
@@ -0,0 +1,4 @@
+---
+- include: config.yml
+
+- include: start.yml
diff --git a/ansible/roles/memcached/tasks/start.yml b/ansible/roles/memcached/tasks/start.yml
new file mode 100644
index 000000000..1c9c68ddc
--- /dev/null
+++ b/ansible/roles/memcached/tasks/start.yml
@@ -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']
diff --git a/ansible/roles/memcached/templates/memcached.conf.j2 b/ansible/roles/memcached/templates/memcached.conf.j2
new file mode 100644
index 000000000..e08061f6d
--- /dev/null
+++ b/ansible/roles/memcached/templates/memcached.conf.j2
@@ -0,0 +1 @@
+OPTIONS="-l {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -p {{ memcached_port }}"
diff --git a/docker/common/memcached/config-external.sh b/docker/common/memcached/config-external.sh
index ab9593896..0f3fa8336 100644
--- a/docker/common/memcached/config-external.sh
+++ b/docker/common/memcached/config-external.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-SOURCE="/opt/kolla/memcached/memcached"
-TARGET="/etc/sysconfig/memcached"
-OWNER="swift"
+SOURCE="/opt/kolla/memcached/memcached.conf"
+TARGET="/etc/memcached.conf"
+OWNER="memcached"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
diff --git a/docker/common/memcached/start.sh b/docker/common/memcached/start.sh
index 2d69b41b7..531dd3872 100755
--- a/docker/common/memcached/start.sh
+++ b/docker/common/memcached/start.sh
@@ -11,4 +11,6 @@ source /opt/kolla/kolla-common.sh
# Execute config strategy
set_configs
-exec $CMD $ARGS
+source /etc/memcached.conf
+
+exec $CMD $ARGS $OPTIONS