Network automation in practice lab 6 of 11

Ansible roles across IOS EOS Junos and FortiGate

Turn Fenwick Rail's base services into one Ansible role that drives four vendors from the same data: platform task files, resource modules that remove what isn't in the data, a FortiGate driven through its REST API, a firewall-objects role, tags, check mode with diffs and an idempotence gate.

Run this lab

It needs Standard: its 5 nodes are set to 6 vCPU and 10,240 MB in total. It is ready about 15 minutes after you start it. It starts already set up, with nothing to paste before the first task.

In your workspace: Shared, then Network Automation in Practice - multi-vendor professional guided labs, then 06 - Ansible roles across IOS EOS Junos and FortiGate

Run it on Standard from £5 a day

  • About 15 min to be ready
  • About 80 min of tasks

The free demo isn’t offered for this lab: it is Lite size, with 6 vCPU and 8 GB, and this lab’s nodes need 6 vCPU and 10,240 MB together. Every lab plan includes every guided lab.

Level
Advanced
How you work
CLI-led
Nodes need
6 vCPU, 10,240 MB
Smallest plan
Standard

The scenario

Fenwick Rail's base services (NTP and syslog) are still set by hand, and it shows: every device still points at 192.0.2.123, an NTP server that was switched off last year. A colleague started an Ansible role, base_services, that does IOS and Junos. Your job is to finish it for Arista and the FortiGate, add a role for the firewall's monitoring objects, and prove the whole playbook is safe to run on a schedule: the second run must change nothing.

Start-up and waits. Click Start all. fgt1 is ready in about a minute, eos1 in about 3, r1 in about 4 and srx1 in about 5. Each device starts with its management address, the netops login and its API on, plus the stale NTP server. Read the role (Task 1) while they boot. The repository is in /root/lab/ansible. Measured on our servers: the whole lab was ready for its first task about 15 minutes after Start all, with every device booted.

What you’ll practise

  • Organise a playbook as roles with defaults, platform task files and handlers
  • Connect Ansible to a FortiGate over its REST API (httpapi)
  • Use state: overridden to remove configuration that isn't in the data
  • Preview with --check --diff, and limit a run with tags
  • Prove idempotence with a gate that fails when a second run changes anything

The tasks

  1. Read the layout
  2. Connect to the FortiGate
  3. Finish the role for EOS and FortiOS
  4. Preview, then apply
  5. The firewall objects role
  6. The idempotence gate

The Lab Tasks pane has the scenario, these tasks, the checks to run, hints and the full solution.

Topology and devices

The network as it opens in EVE-NG, drawn from the lab’s own canvas, and the image each node runs.

Topology of Ansible roles across IOS EOS Junos and FortiGate5 nodes and 1 network, 5 links. Every link is listed as text below the diagram.devboxr1eos1srx1fgt1Mgmteth0Gi0/0port1Management1fxp0
5 nodes and 1 network, with the interface names each link uses. On a narrow screen, scroll the diagram sideways.
Nodes in Ansible roles across IOS EOS Junos and FortiGate, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
devboxCloudLabBox code workstation (Docker)CloudLabBox’s own workstation image, with a browser code editor1 vCPU, 2,048 MB
r1Cisco IOSvvios-adventerprisek9-m.spa.159-3.m91 vCPU, 512 MB
eos1Arista vEOSveos-4.33.1.1F1 vCPU, 2,048 MB
srx1Juniper vSRX NextGen templatevsrxng-24.4R1.92 vCPU, 3,584 MB
fgt1Fortinet FortiGatefortinet-FGT-v7.0.17.M-build06821 vCPU, 2,048 MB

How to open this lab

  1. Sign in to your workspace at lab.cloudlabbox.com.

  2. In File Manager, open Shared, then the folder Network Automation in Practice - multi-vendor professional guided labs.

  3. Open 06 - Ansible roles across IOS EOS Junos and FortiGate and start its nodes, then open Lab Tasks for the scenario and the steps.

The lab is read-only. You can start the nodes and configure the devices, but changes to the topology can’t be saved. To change it, rebuild it in your own folder.

More Network automation in practice labs

All Network automation in practice labs

Related labs in other courses

CloudLabBox is independent of Arista Networks, Cisco, Fortinet, Juniper Networks and Palo Alto Networks. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.