# Need help

**URL:** <https://forum.ansible.com/t/need-help/33507>\
**Category:** Ansible Project\
**Created:** [July 28, 2020, 7:01am UTC](https://forum.ansible.com/t/need-help/33507 "2020-07-28T07:01:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 28, 2020, 7:01am UTC](https://forum.ansible.com/t/need-help/33507/1 "2020-07-28T07:01:35Z")

</div>

Hi Ansible Gurus,

I have a playbook like below:

- name: Get Active Rest server  
include\_role:  
name: web-server  
tasks\_from: active-rest-server

Now I have a playbook under the web-server role named active-rest-server.yml !  
So in case active-rest-server fails , can i use ignor\_errors in above snippet as well or i have to use it in that task only ?

- name: Get Active Rest server  
include\_role:  
name: web-server  
tasks\_from: active-rest-server  
ignore\_errors: True

is that ok to do in case i want to ignore errors?

Rahul

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [July 28, 2020, 7:13am UTC](https://forum.ansible.com/t/need-help/33507/2 "2020-07-28T07:13:42Z")

</div>

> Hi Ansible Gurus,  
> I have a playbook like below:  
> - name: Get Active Rest server  
> include\_role:  
> name: web-server  
> tasks\_from: active-rest-server
> 
> Now I have a playbook under the web-server role named active-rest-server.yml !  
> So in case active-rest-server fails , can i use ignor\_errors in above snippet as well or i have to use it in that task  
> only ?  
> - name: Get Active Rest server  
> include\_role:  
> name: web-server  
> tasks\_from: active-rest-server  
> ignore\_errors: True
> 
> is that ok to do in case i want to ignore errors?

So why do you want to ignore errors? That seems like a bad approach to me.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 28, 2020, 7:20am UTC](https://forum.ansible.com/t/need-help/33507/3 "2020-07-28T07:20:02Z")

</div>

Ya stephan , it is bad approach I know ( Infact we should avoid ignore\_errors as much as possible) ! But all tasks post this task… can be executed irrespective of its failure !

So i need to , can we do that ?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [July 28, 2020, 7:25am UTC](https://forum.ansible.com/t/need-help/33507/4 "2020-07-28T07:25:47Z")

</div>

> Ya stephan , it is bad approach I know ( Infact we should avoid ignore\_errors as much as possible) ! But all tasks post  
> this task.. can be executed irrespective of its failure !

Ok but what is the point to call that task, if nothing depends on it?

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 28, 2020, 7:56am UTC](https://forum.ansible.com/t/need-help/33507/5 "2020-07-28T07:56:54Z")

</div>

Logic is like if an application could not be deployed , forcefully shutdown the application server rather than stopping before only!

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [July 28, 2020, 8:02am UTC](https://forum.ansible.com/t/need-help/33507/6 "2020-07-28T08:02:45Z")

</div>

> Logic is like if an application could not be deployed , forcefully shutdown the application server rather than stopping  
> before only!

Sounds like bandaid logic to me. I would rather fix the deployment problem.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 28, 2020, 11:47am UTC](https://forum.ansible.com/t/need-help/33507/7 "2020-07-28T11:47:56Z")

</div>

Hello Stefan ,  
Are registered variable information are available from tasks came as part of include\_role?

- name: Get Active Rest server  
include\_role:  
name: web-server  
tasks\_from: active-rest-server

I registered some variable in this task active-rest-server.yml , can i use same here in above snippet as a condition in when ?

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [July 28, 2020, 1:19pm UTC](https://forum.ansible.com/t/need-help/33507/8 "2020-07-28T13:19:38Z")

</div>

> Hello Stefan ,  
> Are registered variable information are available from tasks came as part of include\_role?
> 
> - name: Get Active Rest server  
> include\_role:  
> name: web-server  
> tasks\_from: active-rest-server
> 
> I registered some variable in this task active-rest-server.yml , can i use same here in above snippet as a condition in  
> when ?

The variables registered during processing the tasks from active-rest-server.yml are not available to a regular when:,  
as they are checked before the task file is loaded.

However, you probably can use them in a failed\_when: condition.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
