'tuple' object has no attribute 'iteritems'

- 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.]+', '') }}"

is getting me

fatal: [frobnitz.edu]: FAILED! => {"msg": "Traceback (most recent call last):
  File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 2106, in <module>
    main()
  File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 158, in main
    module = CommandModule(argument_spec=dict())
  File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 607, in __init__
    self._check_for_check_mode()
  File \"/root/.ansible/tmp/ansible-tmp-1438822667.55-270531375236680/command\", line 1133, in _check_for_check_mode
    for (k,v) in self.params.iteritems():
AttributeError: 'tuple' object has no attribute 'iteritems'
", "failed": true, "changed": false, "parsed": false, "invocation": {"module_name": "command", "module_args": {"_raw_params": "syslog-ng --version"}}}

clue bat, please

randy

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

Which version of ansible?

<blush> sorry.

% ansible-playbook --version
ansible-playbook 2.0.0
  config file =
  configured module search path = None

As a standalone test case, it works for me with ansible-1.7.1.

ouch!

randy

Is that a development version? I've done a "git pull" and the latest *tagged* version is v1.9.2-1, although there is a *branch* called v2_final

But if I checkout the latest git devel branch, I get the same as you (below).

Suggest you raise it directly on github, as there's now a nice standalone test case. In fact, the test case reduces to just this:

Is that a development version? I’ve done a “git pull” and the latest tagged version is v1.9.2-1, although there is a branch called v2_final

If I checkout the latest git devel branch, I see the same as you.

I suggest you raise it directly on github. The following standalone playbook reproduces it, without any need for syslog-ng: