Fix array building bug
This commit is contained in:
parent
f3f3bc34a2
commit
e894091f49
1 changed files with 14 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
|||
- name: Formatting jail.conf options for {{ vars['jail_' + jail_name + '_newest_id'] }}
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
_iter_config_opts: >-
|
||||
{{
|
||||
jail_default_config_opts | combine(
|
||||
|
@ -9,7 +9,7 @@
|
|||
_iter_config_lines: []
|
||||
|
||||
- name: Setting hostname for jail
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
_iter_config_opts: >-
|
||||
{{
|
||||
_iter_config_opts| combine(
|
||||
|
@ -17,20 +17,22 @@
|
|||
)
|
||||
}}
|
||||
|
||||
- name: Converting config dict into config lines
|
||||
set_fact:
|
||||
- name: extending _iter_config_lines
|
||||
ansible.builtin.set_fact:
|
||||
_iter_config_lines: >-
|
||||
{{ _iter_config_lines }} + {{
|
||||
['%s = %s;'|format(
|
||||
item.key,
|
||||
'"%s"'|format(item.value) if item.value is string else
|
||||
item.value|ternary('"true"', '"false"') if item.value.__class__.__name__ == 'bool' else item.value
|
||||
)]
|
||||
{{ _iter_config_lines | union(
|
||||
['{key} = {value};'.format(
|
||||
key=item.key,
|
||||
value='"{}"'.format(item.value) if item.value is string else
|
||||
item.value|ternary('"true"', '"false"') if item.value is boolean
|
||||
else item.value
|
||||
)
|
||||
])
|
||||
}}
|
||||
with_dict: '{{ _iter_config_opts }}'
|
||||
|
||||
- name: Flattening config into one variable
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
_iter_flattened_config: "{{ _iter_config_lines|sort|join('\n ') }}"
|
||||
|
||||
- name: Writing config block for {{ vars['jail_' + jail_name + '_newest_id'] }} into /etc/jail.conf (IPv4)
|
||||
|
@ -72,4 +74,4 @@
|
|||
}}
|
||||
when: not jail_THIS_with_ip6
|
||||
|
||||
# vim: sw=2
|
||||
# vim: sw=2:smarttab
|
||||
|
|
Loading…
Reference in a new issue