I want to add a simple check on the version of nginx.
But version with conditionals won’t work
- name: check for install nginx
shell: nginx -v 2>&1 | awk ‘{print $3}’ | sed -e ‘s/nginx///g’
register: nginx
-
debug: msg=“{{ nginx.stdout }}”
-
name: download nginx latest version
shell: wget -N http://nginx.org/download/nginx-{{ nginx_version }}.tar.gz -P /usr/src
when: “{{ nginx_version }} != {{ nginx.stdout }}”
Result:
error while evaluating conditional: 1.6.1 != 1.6.1