Launching the network device

To do this, we are going to use a VyOS Vagrant box. If you are following along, we first need to create a folder called vyos. This will hold our playbook and Vagrantfile. To create the folder structure and blank files needed for the playbook, run the following commands:

$ mkdir vyos vyos/group_vars vyos/roles$ ansible-galaxy init vyos/roles/vyos-firewall$ touch vyos/Vagrantfile$ touch vyos/production$ touch vyos/site.yml$ touch vyos/group_vars/common.yml$ touch vyos/roles/vyos-firewall/templates/firewall.j2 

Copy the following code into the empty Vagrantfile we created:

# -*- mode: ruby -*-# vi: set ft=ruby :API_VERSION = "2"BOX_NAME    = "russmckendrick/vyos"BOX_IP      = "192.168.50.10"DOMAIN      = "nip.io"PRIVATE_KEY = ...

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.