Hi All How can i store a version of a s/w and store only the version number in . . .

Al West:
this is the msg:

msg: "rsyslogd version {{ ver }}"

Just remove the “rsyslogd version” text - or am I missing something?

Falcon_B:
oh sorry. yes. you are right

Falcon_B:

image.png

Falcon_B:
actually checking the input as per the version :slightly_smiling_face:

Falcon_B:
what is the benefit here doing set_fact? I will be able get it in setup?

Falcon_B:
ansible setup module*

Al West:
There is a difference between gather_facts and set_fact

Al West:
gather_facts gets a number of arributes from the host - set_fact defines a fact, like a variable. In this case we have assigned the result of a regex on a string to the ver fact - you won’t get ver from gather_facts

Falcon_B:
okay. Got it here.

Falcon_B:
not possible to get it by set_fact? or setting it in a way so that in future can be retrived

Al West:
I don’t really understand what you are trying to do. Save it to a file if you want it later?

Falcon_B:
no no. just askign. If this version can be set as set fact.

I am trying to change one config. based on that

Falcon_B:

image.png

Al West:
So the fact you set is only ‘alive’ for the playbook run.

Falcon_B:
but this is failig

Falcon_B:
cant we use <= sign here?

Falcon_B:
the condition getting failed

Al West:
You are trying to compare a string and number. It won’t work, however ansible has the version function:

when: ver is version('8.5', '&gt;')

Look it up - I don’t know much about it.

Falcon_B:
let me try that.

Falcon_B:
it worked finally. thanks a lot :slightly_smiling_face:
image.png