Need help

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

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
        Racke

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 ?

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
       Racke

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

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
        Racke

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 ?

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
        Racke