diff --git a/ansible/roles/memcached/tasks/config.yml b/ansible/roles/memcached/tasks/config.yml index 27e2c97668..4f97e364d4 100644 --- a/ansible/roles/memcached/tasks/config.yml +++ b/ansible/roles/memcached/tasks/config.yml @@ -5,7 +5,7 @@ state: "directory" recurse: "yes" -- name: Copying over config(s) +- name: Copying over memcached JSON configuration file template: - src: "memcached.conf.j2" - dest: "{{ node_config_directory }}/memcached/memcached.conf" + src: "memcached.json.j2" + dest: "{{ node_config_directory }}/memcached/config.json" diff --git a/ansible/roles/memcached/tasks/start.yml b/ansible/roles/memcached/tasks/start.yml index 1c9c68ddcf..21d72f8a11 100644 --- a/ansible/roles/memcached/tasks/start.yml +++ b/ansible/roles/memcached/tasks/start.yml @@ -13,7 +13,7 @@ insecure_registry: "{{ docker_insecure_registry }}" name: memcached image: "{{ memcached_image_full }}" - volumes: "{{ node_config_directory }}/memcached/:/opt/kolla/memcached/:ro" + volumes: "{{ node_config_directory }}/memcached/:/opt/kolla/config_files/: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 deleted file mode 100644 index e08061f6dd..0000000000 --- a/ansible/roles/memcached/templates/memcached.conf.j2 +++ /dev/null @@ -1 +0,0 @@ -OPTIONS="-l {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -p {{ memcached_port }}" diff --git a/ansible/roles/memcached/templates/memcached.json.j2 b/ansible/roles/memcached/templates/memcached.json.j2 new file mode 100644 index 0000000000..a32e899e29 --- /dev/null +++ b/ansible/roles/memcached/templates/memcached.json.j2 @@ -0,0 +1,5 @@ +{% set memcache_user = 'memcache' if kolla_base_distro in ['ubuntu', 'debian'] else 'memcached' %} +{ + "command": "/usr/bin/memcached -u {{ memcache_user }} -vv -l {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -p {{ memcached_port }}", + "config_files": [] +} diff --git a/docker/memcached/start.sh b/docker/memcached/start.sh index b8628b9148..bfa6c7878c 100755 --- a/docker/memcached/start.sh +++ b/docker/memcached/start.sh @@ -2,21 +2,11 @@ set -o errexit -if [[ "${KOLLA_BASE_DISTRO}" == "ubuntu" || \ - "${KOLLA_BASE_DISTRO}" == "debian" ]]; then - CMD="/usr/bin/memcached" - ARGS="-u memcache -vv" -else - CMD="/usr/bin/memcached" - ARGS="-u memcached -vv" -fi - # Loading common functions. source /opt/kolla/kolla-common.sh -# Execute config strategy -set_configs +# Generate run command +python /opt/kolla/set_configs.py +CMD=$(cat /run_command) -source /etc/memcached.conf - -exec $CMD $ARGS $OPTIONS +exec $CMD