find out the ansible version within ansible without shell/cmd?

Hi,

is there a better way for this than to use shell+register?

  - name: get ansible version
    shell: ansible --version|head -1|cut -d" " -f2
    delegate_to: 127.0.0.1
    register: ansibleversion

thanks,
nusenu

use the built in:

  • debug: var=ansible_version