Merge "Add Ansible role for memcached"
This commit is contained in:
commit
f70e8d4598
@ -89,6 +89,8 @@ neutron_server_port: "9696"
|
||||
|
||||
cinder_api_port: "8776"
|
||||
|
||||
memcached_port: "11211"
|
||||
|
||||
|
||||
####################
|
||||
# Openstack options
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
9
ansible/roles/memcached/defaults/main.yml
Normal file
9
ansible/roles/memcached/defaults/main.yml
Normal 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 }}"
|
11
ansible/roles/memcached/tasks/config.yml
Normal file
11
ansible/roles/memcached/tasks/config.yml
Normal 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"
|
4
ansible/roles/memcached/tasks/main.yml
Normal file
4
ansible/roles/memcached/tasks/main.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
- include: config.yml
|
||||
|
||||
- include: start.yml
|
19
ansible/roles/memcached/tasks/start.yml
Normal file
19
ansible/roles/memcached/tasks/start.yml
Normal 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']
|
1
ansible/roles/memcached/templates/memcached.conf.j2
Normal file
1
ansible/roles/memcached/templates/memcached.conf.j2
Normal file
@ -0,0 +1 @@
|
||||
OPTIONS="-l {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -p {{ memcached_port }}"
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user