Which version of ansible?
As a standalone test case, it works for me with ansible-1.7.1.
brian@wrn-mon1:~$ cat test.yml
- hosts: localhost
tasks:
- name: run syslog-ng version
command: syslog-ng --version
register: ver_out
changed_when: false
- name: set ver
set_fact: ver="{{
ver_out.stdout.splitlines()[0]|regex_replace('[^\d.]+', '') }}"
- debug: msg="answer={{ ver }}"
brian@wrn-mon1:~$ ansible-playbook test.yml
PLAY [localhost]
**************************************************************
GATHERING FACTS
***************************************************************
ok: [localhost]
TASK: [run syslog-ng version]
*************************************************
ok: [localhost]
TASK: [set ver]
***************************************************************
ok: [localhost]
TASK: [debug msg="answer={{ ver }}"]
******************************************
ok: [localhost] => {
"msg": "answer=3.3.4"
}
PLAY RECAP
********************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0
brian@wrn-mon1:~$ ansible-playbook --version
ansible-playbook 1.7.1
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2e3ec4b7-dc24-4d76-a284-5ead285e516d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.