I’m am trying to write an ansible script that will generate thread dumps on java processes. Here is my playbook:
- name: generate thread dumps
   hosts: localhost
   user: oracle
#   serial: 100% <= this is not needed as that is the default
   vars:
     pid: 0
     serverNames:
         - AdminServer
   tasks:
     - command: "kill -3 `pgrep -f {{item}}`" # <= note that the
braces are double, not single for variable interpolation
       with_items: serverNames
       register: myoutput # <= using below to display results
- debug: var=myoutput
ah, missed the backtics, try using shell: instead of command: