Expected output is the version of nginx, but it outputs a blank string instead:
- hosts: localhost
tasks:
- name: check if nginx exists
stat:
path: /usr/sbin/nginx
register: result
- name: check nginx version
command: nginx -v
register: version
- debug: msg="{{version.stdout}}"
I am getting the below output instead:
TASK [debug] *********************************************************************************************************************
ok: [localhost] => {
"msg": ""
}