# Ansible newby trying to do something very simple (unsuccessfully)

**URL:** <https://forum.ansible.com/t/ansible-newby-trying-to-do-something-very-simple-unsuccessfully/18722>\
**Category:** Ansible Project\
**Created:** [July 9, 2015, 10:15pm UTC](https://forum.ansible.com/t/ansible-newby-trying-to-do-something-very-simple-unsuccessfully/18722 "2015-07-09T22:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jane\_Mortimore](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@Jane\_Mortimore](https://forum.ansible.com/u/Jane_Mortimore)\
**Post date:** [July 9, 2015, 10:15pm UTC](https://forum.ansible.com/t/ansible-newby-trying-to-do-something-very-simple-unsuccessfully/18722/1 "2015-07-09T22:15:31Z")

</div>

I’m am trying to write an ansible script that will generate thread dumps on java processes. Here is my playbook:

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 11, 2015, 12:36am UTC](https://forum.ansible.com/t/ansible-newby-trying-to-do-something-very-simple-unsuccessfully/18722/2 "2015-07-11T00:36:10Z")

</div>

- name: generate thread dumps  
&nbsp;&nbsp;&nbsp;hosts: localhost  
&nbsp;&nbsp;&nbsp;user: oracle  
# serial: 100% \<= this is not needed as that is the default  
&nbsp;&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pid: 0  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;serverNames:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- AdminServer

&nbsp;&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- command: "kill -3 `pgrep -f {{item}}`" # \<= note that the  
braces are double, not single for variable interpolation  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with\_items: serverNames  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register: myoutput # \<= using below to display results

&nbsp;&nbsp;&nbsp;- debug: var=myoutput

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 11, 2015, 1:51am UTC](https://forum.ansible.com/t/ansible-newby-trying-to-do-something-very-simple-unsuccessfully/18722/3 "2015-07-11T01:51:06Z")

</div>

ah, missed the backtics, try using shell: instead of command:
