Hi Jon, Thanks for your advice. I tried shell earlier and got the same error.
Please further advise if any. Cheers, Andrew On Saturday, April 8, 2017 at 4:53:35 AM UTC+10, J Hawkesworth wrote: > Try using 'shell' instead of 'command' - since you are using | I think you > are likely going to need shell, since | is a shell feature. > > Hope this helps, > > Jon > > On Friday, April 7, 2017 at 2:22:27 PM UTC+1, [email protected] wrote: >> >> Hi, >> >> I am new to ansible and trying to test a playbook to check availability >> of a port number. If one found then use it, if not then go to the next one. >> Following is my playbook code, >> >> tasks: >> - name: check port number >> become: yes >> become_user: root >> command: /bin/netstat -anp | grep "{{ item }}" >> register: result >> until: result.stdout.split()|length > 0 >> with_sequence: start=5432 end=5500 >> >> Unfortunately it did not work and get me the following error. >> >> TASK [check port number] >> ******************************************************* >> An exception occurred during task execution. To see the full traceback, >> use -vvv. The error was: TypeError: unsupported operand type(s) for +: >> 'NoneType' and 'int' >> fatal: [pmr71dev402.auiag.corp]: FAILED! => {"failed": true, "msg": >> "Unexpected failure during module execution.", "stdout": ""} >> >> Could someone please help and advise? >> >> Also, if there is a better way to do this please feel free to advise me >> too. >> >> Regards, >> Andrew >> > -- 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/6641212a-412f-4079-bb0f-3f966fa95cd6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
