unixansible

Ansible command to check the java version in different servers


I am writing a Test case using ansible.There are totally 9 servers in which I need to check whether the installed java version is 1.7.0 or not?

If it is less than 1.7.0 then test case should fail.

Can anyone help me to write this Test case as I am very new to ansible.

Thanks in advance


Solution

  • Altough in your question you havn't specified what have you tried, but still

    You can run a commands like this

    ansible your_host -m command -a 'java -version'

    If you need to parse the output of java -version there is a very good script from Glenn Jackman here adapt it to your needs and use it.

    If you are still looking for help, be more specific and show what you tried to do.