That kind of info can be obtained with "gather facts" step, which is the first step when running a playbook.
You just have to comparte returned info in ansible variables like "ansible_distribution" and "ansible_distribution_version" with the expected value. You can store expected value in a local dictionary that uses hostname as the key value. El martes, 21 de diciembre de 2021 a la(s) 08:15:15 UTC-3, [email protected] escribió: > Thanks for your reply. > > I want to automate tasks such as verifying the OS version of remote nodes. > > The customer has given me the expected value i.e. Centos version 8.2 > > Through automation I wish to get the OS version of the remotes nodes and > then compare that value with the value that I have received from the > customer through ansible playbooks. > On Tuesday, December 21, 2021 at 4:06:57 PM UTC+5:30 [email protected] > wrote: > >> You need to elaborate some more, I can't make anything of your story. >> Give some real world examples of the tasks that you're trying to >> automate. >> >> On Tue, 21 Dec 2021 at 07:22, Marian Saldhana <[email protected]> >> wrote: >> >>> Hi All, >>> >>> As I am new to ansible i need to write a role which compares input >>> /output value. >>> >>> Let me elaborate. >>> >>> I need to write a role where I already have expected value, for eg >>> hostname of ansible remote node - abc. >>> >>> Now I need to write a role which first will fetch the value from the >>> remote node and then compare the fetched value with the expected value ( >>> abc ) I have with me. >>> >>> Thanks. >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Ansible Project" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/b708d4e2-ded7-44f0-b68a-866e93ec860bn%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/ansible-project/b708d4e2-ded7-44f0-b68a-866e93ec860bn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> Sent from a mobile device - please excuse the brevity, spelling and >> punctuation. >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/372dfb36-53a2-437a-9658-6724e014f33fn%40googlegroups.com.
