Closed cmasopust closed 1 month ago
Why not:
- set_fact:
amq_broker_configuration_file_refresh_period: "{{ ... | int }}"
?
Anyway I'll add the type conversion around too
because " | int" here would be a no-op... the fact still would be of type str
- hosts: localhost
become: no
gather_facts: no
vars:
var1: 25
tasks:
- ansible.builtin.set_fact:
test1: "{{ var1 | int }}"
- ansible.builtin.debug:
msg: "{{ var1 }}"
- ansible.builtin.debug:
msg: "{{ var1 | type_debug }}"
- ansible.builtin.debug:
msg: "{{ test1 }}"
- ansible.builtin.debug:
msg: "{{ test1 | type_debug }}"
would result in:
PLAY [localhost] ****************************************************************************************************************************
TASK [ansible.builtin.set_fact] *************************************************************************************************************
ok: [localhost]
TASK [ansible.builtin.debug] ****************************************************************************************************************
ok: [localhost] => {
"msg": 25
}
TASK [ansible.builtin.debug] ****************************************************************************************************************
ok: [localhost] => {
"msg": "int"
}
TASK [ansible.builtin.debug] ****************************************************************************************************************
ok: [localhost] => {
"msg": "25"
}
TASK [ansible.builtin.debug] ****************************************************************************************************************
ok: [localhost] => {
"msg": "str"
}
PLAY RECAP **********************************************************************************************************************************
localhost : ok=5 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
thanks for adding the type conversion to the when !
SUMMARY
Restart handler results in error when
amq_broker_configuration_file_refresh_period
is defined via Jinja2.We are defining
amq_broker_configuration_file_refresh_period
in such way:which makes
amq_broker_configuration_file_refresh_period
being of typestr
I know, this may be special to our environment, but a simple fix/mitigation could be changing the when condition for the restart handler.
I also tried to set
jinja2_native=True
in my ansible.cfg but that lead then to lots of errors at "Set journal configuration", error were:ISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION