# examples of $last\_result?

**URL:** <https://forum.ansible.com/t/examples-of-last-result/11954>\
**Category:** Ansible Project\
**Created:** [October 4, 2012, 9:53pm UTC](https://forum.ansible.com/t/examples-of-last-result/11954 "2012-10-04T21:53:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James8](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@James8](https://forum.ansible.com/u/James8)\
**Post date:** [October 4, 2012, 9:53pm UTC](https://forum.ansible.com/t/examples-of-last-result/11954/1 "2012-10-04T21:53:10Z")

</div>

Hi,  
I have this playbook:

&nbsp;&nbsp;tasks:

&nbsp;&nbsp;- name: Copy new lhttpd  
&nbsp;&nbsp;&nbsp;&nbsp;action: copy  
src=/Users/jmarcus/ServerConfig/svn/eXelators/WS200/files/lighttpd.conf.2012-10-04  
dest=/etc/lighttpd/lighttpd.conf owner=root group=root mode=0644  
creates=/etc/lighttpd/lighttpd.conf

&nbsp;&nbsp;- name: Stop lhttpd  
&nbsp;&nbsp;&nbsp;&nbsp;action: service name=lhttpd pattern=/usr/local/sbin/lighttpd state=stopped

&nbsp;&nbsp;- name: Try to Pause for 10 seconds to let everything calm down  
&nbsp;&nbsp;&nbsp;&nbsp;action: pause seconds=10

&nbsp;&nbsp;- name: Kill left over php-cgi procs  
&nbsp;&nbsp;&nbsp;&nbsp;action: shell killall -9 php-cgi

&nbsp;&nbsp;- name: Start lhttpd  
&nbsp;&nbsp;&nbsp;&nbsp;action: service name=lhttpd pattern=/usr/local/sbin/lighttpd state=started

Its rare that PHP dies gracefully, of course today it is. I'm unclear  
on what I need to set in order to ignore the exit status of the shell  
killall action. Are there examples of this?

bash-3.2$ ansible --version  
ansible 0.8

> [B] The result of the last command, as a dictionary, will be available in some variable like $last\_result. Use  
> this with the shell/command module to quickly add control logic with "only\_if", without having to write custom facts

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [October 4, 2012, 9:57pm UTC](https://forum.ansible.com/t/examples-of-last-result/11954/2 "2012-10-04T21:57:39Z")

</div>

ignore\_errors: True

only\_if: $last\_result.rc == 42
