Skip to content

Commit

Permalink
Address upstream Issue #211
Browse files Browse the repository at this point in the history
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
  • Loading branch information
linuxfreakus authored Nov 5, 2022
1 parent b5ab216 commit 6febee0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roles/sysctl/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6febee0

Please sign in to comment.