I am using the ansible shell module to compare the chain of 2 SSL certificate with openssl (they have the same chain):
openssl x509 -issuer -noout -in Certiticate1
openssl x509 -issuer -noout -in Certiticate2
I register the output in variables chain_from_certificate1 and chain_from_certificate2 then i compares there standard output:
- name: Compare the Chain
fail:
msg: Error The chains aren't the same
when: chain_from_certificate1.stdout != chain_from_certificate2.stdout
Ansible tell me that the chains are not similar (and it's false because they are).
I think that the issue came from the comparison operator because the type of the variable are "AnsibleUnsafeText" and not string.
My question how to compare 2 AnsibleUnsafeText ? and it's necessary to convert them to string before comparison ?
Thank you in advance.
openssl x509 -issuer -noout -in Certiticate1
andopenssl x509 -issuer -noout -in Certiticate2
are the same?