'Occ config:system:set redis host --value=“localhost”' -> config problem when ran twice

Hi there,
since a big upgrade on my server this morning, I’ve broken my two nextcloud instances :

Nextcloud version (eg, 12.0.2): upgrade from 12.0.5 or 13.0.1 to 13.0.5
Operating system and version (eg, Ubuntu 17.04): ubuntu 16.04 fresh upgrade
Apache or nginx version (eg, Apache 2.4.25): Nginx 1.10.3-0ubuntu0.16.04.2
PHP version (eg, 7.1): 7.0.30 FPM
Redis version: 2:3.0.6-1

Installation and upgrade is made with ansible scripts there (and there) that worked well until today, with OP CACHE and redis configuration as explained in nextcloud pages

extract from Nginx error log :

2018/07/28 10:34:22 [error] 1301#1301: *1 FastCGI sent in stderr: "PHP message: PHP Warning: Redis::connect() expects parameter 1 to be string, array given in /mnt/vdb/www/nc_paq_formation/lib/private/RedisFactory.php on line 84
PHP message: PHP Fatal error: Uncaught RedisException: Redis server went away in /mnt/vdb/www/nc_paq_formation/lib/private/Memcache/Redis.php:54
Stack trace:
#0 /mnt/vdb/www/nc_paq_formation/lib/private/Memcache/Redis.php(54): Redis->get(‘dead5f3e6a57754…’)
#1 /mnt/vdb/www/nc_paq_formation/lib/autoloader.php(146): OC\Memcache\Redis->get(‘OC_User’)
#2 [internal function]: OC\Autoloader->load(‘OC_User’)
#3 /mnt/vdb/www/nc_paq_formation/lib/private/Log/File.php(104): spl_autoload_call(‘OC_User’)
#4 [internal function]: OC\Log\File::write(‘PHP’, ‘RedisException:…’, 3)
#5 /mnt/vdb/www/nc_paq_formation/lib/private/Log.php(330): call_user_func(Array, ‘PHP’, ‘RedisException:…’, 3)
#6 /mnt/vdb/www/nc_paq_formation/lib/private/Log.php(180): OC\Log->log(3, ‘RedisException:…’, Array)
#7 /mnt/vdb/www/nc_paq_formation/lib/private/Log/ErrorHandler.php(81): OC\Log->critical(‘RedisException:…’, Array)
#8 [internal function]: OC\Log\ErrorHandler::onException(Object(RedisException))
#9 {main}
thrown in /mnt/vdb…
PHP message: PHP Fatal error: Uncaught RedisException: Redis server went away in /mnt/vdb/www/nc_paq_formation/lib/private/Memcache/Redis.php:54
Stack trace:
#0 /mnt/vdb/www/nc_paq_formation/lib/private/Memcache/Redis.php(54): Redis->get(‘dead5f3e6a57754…’)
#1 /mnt/vdb/www/nc_paq_formation/lib/autoloader.php(146): OC\Memcache\Redis->get(‘OC_User’)
#2 [internal function]: OC\Autoloader->load(‘OC_User’)
#3 /mnt/vdb/www/nc_paq_formation/lib/private/Log/File.php(104): spl_autoload_call(‘OC_User’)
#4 [internal function]: OC\Log\File::write(‘PHP’, ‘Uncaught RedisE…’, 3)
#5 /mnt/vdb/www/nc_paq_formation/lib/private/Log.php(330): call_user_func(Array, ‘PHP’, ‘Uncaught RedisE…’, 3)
#6 /mnt/vdb/www/nc_paq_formation/lib/private/Log.php(180): OC\Log->log(3, ‘Uncaught RedisE…’, Array)

Thanks for help !!!

The problem come from this part of my script launched for install.
As I’m using ansible, I used to run this a second time, to be authentic, in this case I should not have done that.

sudo -u www-data php occ config:system:set redis host port

sudo -u www-data php occ config:system:set redis host --value=“localhost”
sudo -u www-data php occ config:system:set redis port --value=“6379” --type=integer

Anyway, if this command is used more than once, it makes the config.php look like this, which is a problem :

‘redis’ =>
array (
‘host’ =>
array (
‘port’ => ‘’,
),
‘port’ => 6379,
),

So I change the title of the post, i think it can be usefull.