From 02018faf9569c28bb7036a614c281a63f0454956 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 24 Feb 2021 17:57:49 +0100 Subject: [PATCH] Install memcached, conditionally. --- defaults/main.yml | 6 ++++-- meta/main.yml | 10 +++++++++- templates/pgpool.conf.j2 | 14 +++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 62daa6d..f5b1e68 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -191,8 +191,10 @@ pgpool_black_function_list: 'nextval,setval' pgpool_allow_sql_comments: 'on' pgpool_fail_over_on_backend_error: 'on' pgpool_relcache_expire: 3600 -pgpool_memory_cache_enabled: 'off' -pgpool_memqcache_method: memcached +# +pgpool_memory_cache_enabled: False +# memcached, shmem +pgpool_memqcache_method: shmem pgpool_memqcache_memcached_host: localhost pgpool_memqcache_memcached_port: 11211 pgpool_memqcache_expire: 0 diff --git a/meta/main.yml b/meta/main.yml index 096f185..a770738 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -20,4 +20,12 @@ galaxy_info: galaxy_tags: - postgresql -dependencies: [] +dependencies: + - src: git+https://gitea-s2i2s.isti.cnr.it/ISTI-ansible-roles/ansible-role-memcached.git + version: master + name: memcached + state: latest + when: + - pgpool_memory_cache_enabled + - pgpool_memqcache_method == "memcached" + - pgpool_memqcache_memcached_host == "localhost" diff --git a/templates/pgpool.conf.j2 b/templates/pgpool.conf.j2 index 35f949c..f44c72b 100644 --- a/templates/pgpool.conf.j2 +++ b/templates/pgpool.conf.j2 @@ -623,10 +623,11 @@ check_unlogged_table = on # and you want to save access to primary/master, you could turn this off. # Default is on. +{% if pgpool_memory_cache_enabled %} #------------------------------------------------------------------------------ # IN MEMORY QUERY MEMORY CACHE #------------------------------------------------------------------------------ -memory_cache_enabled = {{ pgpool_memory_cache_enabled }} +memory_cache_enabled = on # If on, use the memory cache functionality, off by default memqcache_method = '{{ pgpool_memqcache_method }}' # Cache storage method. either 'shmem'(shared memory) or @@ -679,3 +680,14 @@ black_memqcache_table_list = '' # Comma separated list of table names not to memcache # that don't write to database # Regexp are accepted +{% else %} +#------------------------------------------------------------------------------ +# IN MEMORY QUERY MEMORY CACHE +#------------------------------------------------------------------------------ +memory_cache_enabled = ff + # If on, use the memory cache functionality, off by default +memqcache_method = 'shmem' + # Cache storage method. either 'shmem'(shared memory) or + # 'memcached'. 'shmem' by default + # (change requires restart) +{% endif %}