Question on Numerical or Int-Based Conditionals [ANSWERED]
So, I'm trying to make a playbook-block only execute if a given RPM is less than a specific major version. Capture my RPM information to a JSON struct by registering the output to a variable, like:
- name: Check installed CUDA version yum: list=cuda register: cuda_pkginfo
I then set a
when
when: cuda_pkginfo.results[0].version.split('.')[0] 11
Which, when the RPM version is 10.x returns the string-value of "10", while:
when: cuda_pkginfo.results[0].version.split('.')[0]|int 11
Even though I attempt to cast-to-int (via the
|int
In either case it causes the
Anyone know how to ensure that my LHS is a numerical value so that it can correctly be evaluated against an numberical RHS value?
Responses