On 23/12/2021 11:54, Akshay Jadhav wrote:
- name: show message if interface is not down fail: msg: "Interface is not down" when: {{ interface }}.operstatus == "up" will this work?
Definitely not, that is pulled from thin air if you ask me. Try that: when: vars.get('ansible_' + interface).active Note: Gather facts saves the network interface information in separate variables (e.g. ansible_eth0) instead of a dict/list, so accessing the info for a specific item is a bit awkward. Regards Racke
On Thursday, 23 December 2021 at 12:22:41 UTC+5:30 dick....@geant.org wrote: What does your playbook look like? On Thu, 23 Dec 2021 at 07:49, Akshay Jadhav <aksha...@gmail.com> wrote: Hi all, I need a help from you guys for writing a play if Switch Interface UP then playbook should end with error msg using when condition. I am kind of new to ansible. So please help me out for writing this task. Thank you in advance.-- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b481d0ff-1160-4307-9e2d-3e1433079a02n%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/b481d0ff-1160-4307-9e2d-3e1433079a02n%40googlegroups.com?utm_medium=email&utm_source=footer>.-- 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 <mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1edeb012-822f-49a9-a58a-b6084ba583f1n%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/1edeb012-822f-49a9-a58a-b6084ba583f1n%40googlegroups.com?utm_medium=email&utm_source=footer>.
-- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. -- 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/edd5eeb0-d89e-b70c-5fbb-963cb2748636%40linuxia.de.
OpenPGP_signature
Description: OpenPGP digital signature