Need help

33 views
Skip to first unread message

Rahul Kumar

unread,
Jul 28, 2020, 3:02:10 AM7/28/20
to ansible...@googlegroups.com
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 

Stefan Hornburg (Racke)

unread,
Jul 28, 2020, 3:14:25 AM7/28/20
to ansible...@googlegroups.com
So why do you want to ignore errors? That seems like a bad approach to me.

Regards
Racke

>
> Rahul 
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Rahul Kumar

unread,
Jul 28, 2020, 3:20:28 AM7/28/20
to ansible...@googlegroups.com
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 ?

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ed7a2785-4d5a-8561-2a66-0401c499e48e%40linuxia.de.

Stefan Hornburg (Racke)

unread,
Jul 28, 2020, 3:26:22 AM7/28/20
to ansible...@googlegroups.com
On 7/28/20 9:20 AM, Rahul Kumar wrote:
> 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

> So i need to , can we do that ?
>
> On Tue, 28 Jul 2020 at 12:44, Stefan Hornburg (Racke) <ra...@linuxia.de <mailto:ra...@linuxia.de>> wrote:
>
> On 7/28/20 9:01 AM, Rahul Kumar wrote:
> > 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
>
> >
> > Rahul 
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> > ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>
> <mailto:ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com
> >
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ed7a2785-4d5a-8561-2a66-0401c499e48e%40linuxia.de.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEyExCyo_vZaEMm%2B9y9fjSqHOwehbigDELQLKXAqXi3Gaw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyExCyo_vZaEMm%2B9y9fjSqHOwehbigDELQLKXAqXi3Gaw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
signature.asc

Rahul Kumar

unread,
Jul 28, 2020, 3:57:23 AM7/28/20
to ansible...@googlegroups.com
Logic is like if an application could not be deployed , forcefully shutdown the application server  rather than stopping before only!

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c5c702f8-960c-818a-48af-4b5424b10efd%40linuxia.de.

Stefan Hornburg (Racke)

unread,
Jul 28, 2020, 4:03:21 AM7/28/20
to ansible...@googlegroups.com
On 7/28/20 9:56 AM, Rahul Kumar wrote:
> 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
> <mailto:ansible-project%2Bunsu...@googlegroups.com <mailto:ansible-project%252Buns...@googlegroups.com>>
> >     <mailto:ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>
> <mailto:ansible-project%2Bunsu...@googlegroups.com <mailto:ansible-project%252Buns...@googlegroups.com>>>.
> >     > To view this discussion on the web visit
> >     >
> >   
>  https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com
> >     >
> >   
>  <https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> >
> >
> >     --
> >     Ecommerce and Linux consulting + Perl and web application programming.
> >     Debian and Sympa administration. Provisioning with Ansible.
> >
> >     --
> >     You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> >     To unsubscribe from this group and stop receiving emails from it, send an email to
> >     ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>
> <mailto:ansible-project%2Bunsu...@googlegroups.com <mailto:ansible-project%252Buns...@googlegroups.com>>.
> >     To view this discussion on the web visit
> >     https://groups.google.com/d/msgid/ansible-project/ed7a2785-4d5a-8561-2a66-0401c499e48e%40linuxia.de.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEyExCyo_vZaEMm%2B9y9fjSqHOwehbigDELQLKXAqXi3Gaw%40mail.gmail.com
> >
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyExCyo_vZaEMm%2B9y9fjSqHOwehbigDELQLKXAqXi3Gaw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c5c702f8-960c-818a-48af-4b5424b10efd%40linuxia.de.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEyM8cB-1oVUpqkHouGN4_-r0ZPrV4UAzyq0ZrHgeGjW0A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyM8cB-1oVUpqkHouGN4_-r0ZPrV4UAzyq0ZrHgeGjW0A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
signature.asc

Rahul Kumar

unread,
Jul 28, 2020, 7:48:23 AM7/28/20
to ansible...@googlegroups.com
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  ?


To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d36e519a-1470-fc71-7bbb-d43f7b0dafd6%40linuxia.de.

Stefan Hornburg (Racke)

unread,
Jul 28, 2020, 9:20:14 AM7/28/20
to ansible...@googlegroups.com
On 7/28/20 1:47 PM, Rahul Kumar wrote:
> 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

>
> On Tue, 28 Jul 2020 at 13:33, Stefan Hornburg (Racke) <ra...@linuxia.de <mailto:ra...@linuxia.de>> wrote:
>
> On 7/28/20 9:56 AM, Rahul Kumar wrote:
> > 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
>
> >
> > On Tue, 28 Jul 2020 at 12:56, Stefan Hornburg (Racke) <ra...@linuxia.de <mailto:ra...@linuxia.de>
> <mailto:ra...@linuxia.de <mailto:ra...@linuxia.de>>> wrote:
> >
> >     On 7/28/20 9:20 AM, Rahul Kumar wrote:
> >     > 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
> >
> >     > So i need to , can we do that ?
> >     >
> >     > On Tue, 28 Jul 2020 at 12:44, Stefan Hornburg (Racke) <ra...@linuxia.de <mailto:ra...@linuxia.de>
> <mailto:ra...@linuxia.de <mailto:ra...@linuxia.de>>
> >     <mailto:ansible-project%2Bunsu...@googlegroups.com
> <mailto:ansible-project%252Buns...@googlegroups.com> <mailto:ansible-project%252Buns...@googlegroups.com
> <mailto:ansible-project%25252Bun...@googlegroups.com>>>
> <mailto:ansible-project%252Buns...@googlegroups.com> <mailto:ansible-project%252Buns...@googlegroups.com
> <mailto:ansible-project%25252Bun...@googlegroups.com>>>>.
> >     >     > To view this discussion on the web visit
> >     >     >
> >     >   
> >   
>   https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com
> >     >     >
> >     >   
> >   
>   <https://groups.google.com/d/msgid/ansible-project/CAGH8rEw6Qz9J-%2BswD9qL1qUjXQLwXgSCJU6vPwxBaYTXydFPnA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> >     >
> >     >
> >     >     --
> >     >     Ecommerce and Linux consulting + Perl and web application programming.
> >     >     Debian and Sympa administration. Provisioning with Ansible.
> >     >
> >     >     --
> >     >     You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> >     >     To unsubscribe from this group and stop receiving emails from it, send an email to
> >     >     ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>
> <mailto:ansible-project%2Bunsu...@googlegroups.com <mailto:ansible-project%252Buns...@googlegroups.com>>
> >     <mailto:ansible-project%2Bunsu...@googlegroups.com
> <mailto:ansible-project%252Buns...@googlegroups.com> <mailto:ansible-project%252Buns...@googlegroups.com
> <mailto:ansible-project%25252Bun...@googlegroups.com>>>.
> >     >     To view this discussion on the web visit
> >     >     https://groups.google.com/d/msgid/ansible-project/ed7a2785-4d5a-8561-2a66-0401c499e48e%40linuxia.de.
> >     >
> >     > --
> >     > You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> >     > To unsubscribe from this group and stop receiving emails from it, send an email to
> >     > ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>
>  https://groups.google.com/d/msgid/ansible-project/CAGH8rEyExCyo_vZaEMm%2B9y9fjSqHOwehbigDELQLKXAqXi3Gaw%40mail.gmail.com
> >     >
> >   
>  <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyExCyo_vZaEMm%2B9y9fjSqHOwehbigDELQLKXAqXi3Gaw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> >
> >
> >     --
> >     Ecommerce and Linux consulting + Perl and web application programming.
> >     Debian and Sympa administration. Provisioning with Ansible.
> >
> >     --
> >     You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> >     To unsubscribe from this group and stop receiving emails from it, send an email to
> >     ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>
> <mailto:ansible-project%2Bunsu...@googlegroups.com <mailto:ansible-project%252Buns...@googlegroups.com>>.
> >     To view this discussion on the web visit
> >     https://groups.google.com/d/msgid/ansible-project/c5c702f8-960c-818a-48af-4b5424b10efd%40linuxia.de.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to
> > https://groups.google.com/d/msgid/ansible-project/CAGH8rEyM8cB-1oVUpqkHouGN4_-r0ZPrV4UAzyq0ZrHgeGjW0A%40mail.gmail.com
> >
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyM8cB-1oVUpqkHouGN4_-r0ZPrV4UAzyq0ZrHgeGjW0A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d36e519a-1470-fc71-7bbb-d43f7b0dafd6%40linuxia.de.
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEzK%2BpJvT7%2BvnS8jo_BurPg4WX52rdzmVqV3kcGDzbdBRQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEzK%2BpJvT7%2BvnS8jo_BurPg4WX52rdzmVqV3kcGDzbdBRQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
signature.asc
Reply all
Reply to author
Forward
0 new messages