Skip to Content
Practical Ansible 2
book

Practical Ansible 2

by Daniel Oh, James Freeman, Fabio Alessandro Locati
June 2020
Intermediate to advanced content levelIntermediate to advanced
410 pages
9h 52m
English
Packt Publishing
Content preview from Practical Ansible 2

Conditional statements for networking devices

Although there are no networking-specific Ansible conditionals, conditionals are fairly common in networking-related Ansible usage.

In networking, it's common to enable and disable ports. To have data pass through the cable, both ports at the ends of the cable should be enabled and result in a "connected" state (some vendors will use different names for this, but the idea is the same).

Let's suppose we have two Arista Networks EOS devices and we issued the ON status on the ports and need to wait for the connection to be up before proceeding.

To wait for the Ethernet4 interface to be enabled, we will need to add the following task in our playbook:

- name: Wait for interface to be enabled
  eos_command ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Ansible - Third Edition

Mastering Ansible - Third Edition

James Freeman, Jesse Keating
Security Automation with Ansible 2

Security Automation with Ansible 2

Akash Mahajan, MADHU AKULA

Publisher Resources

ISBN: 9781789807462Supplemental Content