From 6febee01029b23d3022c80013a89e1190882b7a5 Mon Sep 17 00:00:00 2001 From: Eric Nichols Date: Sat, 5 Nov 2022 11:12:10 -0700 Subject: [PATCH] Address upstream Issue #211 Investigated the issue because it happened to me also on newer ansible version. I printed debug output and found it was treating the concatenated lists as a string and then forcing it to a list was flattening it to a list of characters but you can build the list this way instead and then you don't need to force it to a list in the second step either... left the `unique` there because that is still desired --- roles/sysctl/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sysctl/tasks/main.yml b/roles/sysctl/tasks/main.yml index 10e3fe41f..ca30842d7 100644 --- a/roles/sysctl/tasks/main.yml +++ b/roles/sysctl/tasks/main.yml @@ -6,7 +6,7 @@ - block: - name: Build a sysctl_conf dynamic variable set_fact: - sysctl_conf_dynamic_var: "{{ sysctl_conf_dynamic_var |default([]) }} + {{ sysctl_conf[item] | flatten(1) }}" # yamllint disable rule:line-length + sysctl_conf_dynamic_var: "{{ sysctl_conf_dynamic_var | default([]) + (sysctl_conf[item] | flatten(1)) }}" # yamllint disable rule:line-length loop: "{{ hostvars[inventory_hostname].group_names }}" - name: Setting kernel parameters @@ -16,7 +16,7 @@ sysctl_set: true state: present reload: true - loop: "{{ sysctl_conf_dynamic_var|list | unique }}" + loop: "{{ sysctl_conf_dynamic_var | unique }}" when: sysctl_conf_dynamic_var | length > 0 ignore_errors: true when: sysctl_set|bool