Re: [ansible-project] when ansible Conditionals

2021-02-22 Thread Stefan Hornburg (Racke)
On 2/21/21 10:36 PM, Kiran Kumar wrote:
> This playbook check OS & then run diff cmd per OS & works fine
> 
> But the Debug output is not compact .. it is verbose mode kind.. if the OS is 
> not say CentOS it gives 4 to 5 lines
> stating the same .. the out is not compact .. somehow is it possible to 
> ignore that .. so mat be debug is not the way to
> go .. hence asking to folks for suggestions .. thanks
> 

So which output do you expect?

BTW: you can improve the readability of the output with setting 
"stdout_callback = yaml" in your ansible.cfg.

Regards
 Racke

> On Sun, Feb 21, 2021 at 11:12 AM Dick Visser  > wrote:
> 
> On Sun, 21 Feb 2021 at 10:06, esxi...@gmail.com 
>   > wrote:
> >
> > Hello
> >
> > In below how can i skip the output when is not relevant or how to do 
> this better way ?
> 
> 
> It is not clear from your tasks or their name what you are trying to 
> achieve.
> "check OS version" - what does that mean?
> More generally speaking, without knowing what you want to do, it's
> also not possible to tell how to do it better.
> 
> Also, what does "relevant" mean in this context? That seems a highly
> subjective term...
> 
> 
> 
> 
> > Thanks
> >
> > ---
> > -
> >   hosts: temp
> >   become: true
> >   remote_user: ansible
> >   tasks:
> >     - name : check OS version for Ubuntu
> >       raw : lsb_release -a
> >       when: ansible_distribution == 'Debian' or ansible_distribution == 
> 'Ubuntu'
> >       register: result
> >     - debug:
> >         var: result
> >
> >
> >     - name : check OS version for CentOS
> >       raw :  cat /etc/redhat-release
> >       when: ansible_distribution == 'CentOS' or ansible_distribution == 
> 'Red Hat enterprise Linux'
> >       register: result
> >
> >     - debug:
> >         var: result
> >
> >
> > --
> > 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-project+unsubscr...@googlegroups.com 
> .
> > To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/c12a8da7-1a2c-4b1b-963e-a9b154601bd4n%40googlegroups.com
> 
> .
> 
> 
> 
> -- 
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
> 
> -- 
> 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-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwP-6C-GyPmn4kN9qvg_DuK8g7Hzqz6A3%2BvXK3WL5Vc28w%40mail.gmail.com
> 
> .
> 
> -- 
> 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-project+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAGhW9Jto2CexOb7twAE60MyVxgj9v3wWVZxBVZz2nsENHhy9cQ%40mail.gmail.com
> .


-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6b4bea40-bb53-c009-962f-b2c8abd38db8%40linuxia.de.


OpenPGP_signature
Description: OpenPGP digital signature


Re: [ansible-project] when ansible Conditionals

2021-02-21 Thread Kiran Kumar
This playbook check OS & then run diff cmd per OS & works fine

But the Debug output is not compact .. it is verbose mode kind.. if the OS
is not say CentOS it gives 4 to 5 lines stating the same .. the out is not
compact .. somehow is it possible to ignore that .. so mat be debug is not
the way to go .. hence asking to folks for suggestions .. thanks

On Sun, Feb 21, 2021 at 11:12 AM Dick Visser  wrote:

> On Sun, 21 Feb 2021 at 10:06, esxi...@gmail.com 
> wrote:
> >
> > Hello
> >
> > In below how can i skip the output when is not relevant or how to do
> this better way ?
>
>
> It is not clear from your tasks or their name what you are trying to
> achieve.
> "check OS version" - what does that mean?
> More generally speaking, without knowing what you want to do, it's
> also not possible to tell how to do it better.
>
> Also, what does "relevant" mean in this context? That seems a highly
> subjective term...
>
>
>
>
> > Thanks
> >
> > ---
> > -
> >   hosts: temp
> >   become: true
> >   remote_user: ansible
> >   tasks:
> > - name : check OS version for Ubuntu
> >   raw : lsb_release -a
> >   when: ansible_distribution == 'Debian' or ansible_distribution ==
> 'Ubuntu'
> >   register: result
> > - debug:
> > var: result
> >
> >
> > - name : check OS version for CentOS
> >   raw :  cat /etc/redhat-release
> >   when: ansible_distribution == 'CentOS' or ansible_distribution ==
> 'Red Hat enterprise Linux'
> >   register: result
> >
> > - debug:
> > var: result
> >
> >
> > --
> > 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-project+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c12a8da7-1a2c-4b1b-963e-a9b154601bd4n%40googlegroups.com
> .
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwP-6C-GyPmn4kN9qvg_DuK8g7Hzqz6A3%2BvXK3WL5Vc28w%40mail.gmail.com
> .
>

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGhW9Jto2CexOb7twAE60MyVxgj9v3wWVZxBVZz2nsENHhy9cQ%40mail.gmail.com.


Re: [ansible-project] when ansible Conditionals

2021-02-21 Thread Dick Visser
On Sun, 21 Feb 2021 at 10:06, esxi...@gmail.com  wrote:
>
> Hello
>
> In below how can i skip the output when is not relevant or how to do this 
> better way ?


It is not clear from your tasks or their name what you are trying to achieve.
"check OS version" - what does that mean?
More generally speaking, without knowing what you want to do, it's
also not possible to tell how to do it better.

Also, what does "relevant" mean in this context? That seems a highly
subjective term...




> Thanks
>
> ---
> -
>   hosts: temp
>   become: true
>   remote_user: ansible
>   tasks:
> - name : check OS version for Ubuntu
>   raw : lsb_release -a
>   when: ansible_distribution == 'Debian' or ansible_distribution == 
> 'Ubuntu'
>   register: result
> - debug:
> var: result
>
>
> - name : check OS version for CentOS
>   raw :  cat /etc/redhat-release
>   when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red 
> Hat enterprise Linux'
>   register: result
>
> - debug:
> var: result
>
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/c12a8da7-1a2c-4b1b-963e-a9b154601bd4n%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwP-6C-GyPmn4kN9qvg_DuK8g7Hzqz6A3%2BvXK3WL5Vc28w%40mail.gmail.com.


Re: [ansible-project] when ansible Conditionals

2021-02-21 Thread Dick Visser
This information is already gathered and available to you by default, no
need for wheel reinventing

On Sun, 21 Feb 2021 at 10:06, esxi...@gmail.com  wrote:

> Hello
>
> In below how can i skip the output when is not relevant or how to do this
> better way ?
>
> Thanks
>
> ---
> -
>   hosts: temp
>   become: true
>   remote_user: ansible
>   tasks:
> - name : check OS version for Ubuntu
>   raw : lsb_release -a
>   when: ansible_distribution == 'Debian' or ansible_distribution ==
> 'Ubuntu'
>   register: result
> - debug:
> var: result
>
>
> - name : check OS version for CentOS
>   raw :  cat /etc/redhat-release
>   when: ansible_distribution == 'CentOS' or ansible_distribution ==
> 'Red Hat enterprise Linux'
>   register: result
>
> - debug:
> var: result
>
>
>
> --
> 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-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c12a8da7-1a2c-4b1b-963e-a9b154601bd4n%40googlegroups.com
> 
> .
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwPKgOcgu7CCggoSX53xOuxAoaAq_UGkizOUDddK_Z_BUQ%40mail.gmail.com.


[ansible-project] when ansible Conditionals

2021-02-21 Thread esxi...@gmail.com
Hello

In below how can i skip the output when is not relevant or how to do this 
better way ?

Thanks 

---
-
  hosts: temp
  become: true
  remote_user: ansible
  tasks:
- name : check OS version for Ubuntu
  raw : lsb_release -a
  when: ansible_distribution == 'Debian' or ansible_distribution == 
'Ubuntu'
  register: result
- debug:
var: result


- name : check OS version for CentOS
  raw :  cat /etc/redhat-release
  when: ansible_distribution == 'CentOS' or ansible_distribution == 
'Red Hat enterprise Linux'
  register: result

- debug:
var: result


-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c12a8da7-1a2c-4b1b-963e-a9b154601bd4n%40googlegroups.com.