Skip to content
Snippets Groups Projects
Commit 6064dda2 authored by Dónal Cunningham's avatar Dónal Cunningham
Browse files

Update README.md with example output.

parent 0bd89492
No related branches found
No related tags found
No related merge requests found
...@@ -2,22 +2,27 @@ ...@@ -2,22 +2,27 @@
||| |||
|--|--| |--|--|
|![Warning](./images/warning_icon.png)| DISCLAIMER <p> This setup has been tested on Linux and OSX it may not work on Windows. | |![Warning](./images/warning_icon.png)| DISCLAIMER <p> This setup has been tested on Linux and OSX; it __may__ not work on Windows. |
Vagrantfile and additional configuration to deploy a development environment like the one shown in the picture: Vagrantfile and additional configuration to deploy a development environment like the one shown in the picture:
![Dev_Environment_Topology](./images/DevEnvironment.png) ![Dev_Environment_Topology](./images/DevEnvironment.png)
The environment consists of: The full environment consists of:
- 1 VM for Ansible - 1 Ubuntu VM for the Ansible control node
- 3 vSRXs fully connected - 3 vSRXs fully interconnected
VM specifications: VM specifications:
* vSRXs have 2 vCPUs and 4GB RAM * vSRXs have 2 vCPUs and 4GB RAM
* ansible has 2vCPUs and 1GB RAM * The Ansible control node has 2vCPUs and 1GB RAM
In order to keep the initial demands on the host machine low, only one vSRX will be spun up;
the second and third vSRX's are commented out in the `Vagrantfile`.
## What's in this repo?
Here is the directory structure:
## Whats in this repo
These are the contents of this repository:
``` ```
├── docs // Other documentation in addition to this readme file. ├── docs // Other documentation in addition to this readme file.
│ └── virtualbox_create_vsrx3.0.md │ └── virtualbox_create_vsrx3.0.md
...@@ -25,15 +30,16 @@ These are the contents of this repository: ...@@ -25,15 +30,16 @@ These are the contents of this repository:
│ ├── DevEnvironment.drawio │ ├── DevEnvironment.drawio
│ ├── DevEnvironment.png │ ├── DevEnvironment.png
│ └── warning_icon.png │ └── warning_icon.png
├── README.md // This readme files ├── README.md // This file
└── Vagrantfile // The Vagrantfile that describes the resources you are going to instantiate └── Vagrantfile // The Vagrantfile that describes the resources you are going to spin up
``` ```
## Requirements: ## Requirements:
### Git: ### Git:
Git is recommended to clone this repository.
The easiest way to download this repository is to use Git.
* Windows: * Windows:
Download git from: Download git from:
https://git-scm.com/download/win https://git-scm.com/download/win
...@@ -49,26 +55,33 @@ sudo yum install git ...@@ -49,26 +55,33 @@ sudo yum install git
Download git from: Download git from:
https://git-scm.com/download/mac https://git-scm.com/download/mac
If want to know more about git, you can refer to this book: If want to know more about git, you can refer to this book:
https://git-scm.com/book/en/v2 https://git-scm.com/book/en/v2
### VirtualBOX: ### VirtualBox
This is the framework which allows users to run virtual devices on Windows, Linux, MacOS and Solaris hosts.
Download and install virtualbox from: Download and install VirtualBox from:
https://www.virtualbox.org/wiki/Downloads https://www.virtualbox.org/wiki/Downloads
### Vagrant: ### Vagrant
Vagrant will spin up the infrastructure described in the Vagrantfile: Virtual machines and network segments are defined in this file.
Download vagrant from: Vagrant uses node and connectivity definitions in a `Vagrantfile` to orchestrate the creation - using Virtualbox - of the test network.
Download Vagrant from:
https://www.vagrantup.com/downloads.html https://www.vagrantup.com/downloads.html
Some documentation about Vagrant is available here: Some documentation about Vagrant is available here:
https://www.vagrantup.com/intro/getting-started/index.html https://www.vagrantup.com/intro/getting-started/index.html
You need at least Vagrant version 2.2.7 if you are using Virtualbox 6.1+ You need __at least__ Vagrant version 2.2.7 if you are using Virtualbox 6.1+
#### Vagrant plugins
Vagrant needs these plugins to be able to spin up JunOS 12 virtual devices.
#### Vagrant plugins:
``` ```
➜ vagrant plugin list ➜ vagrant plugin list
vagrant-host-shell (0.0.4, global) vagrant-host-shell (0.0.4, global)
...@@ -89,19 +102,29 @@ vagrant plugin install vagrant-host-shell vagrant-junos vagrant-junos_cli ...@@ -89,19 +102,29 @@ vagrant plugin install vagrant-host-shell vagrant-junos vagrant-junos_cli
### vSRX Images ### vSRX Images
We use a public vSRX image: https://app.vagrantup.com/juniper/boxes/ffp-12.1X47-D15.4-packetmode We use a public JunOS 12.1 vSRX image: (https://app.vagrantup.com/juniper/boxes/ffp-12.1X47-D15.4-packetmode, if you're curious).
## How to use ## How to use
Clone this repository using the following command:
``` 1. Install Virtualbox, Vagrant and the vagrant plugins as shown above.
git clone https://gitlab.geant.org/geant-oav/ansible-minilab.git
2. Clone this repository using the following command:
``` ```
testhost> git clone git@gitlab.geant.org:geant-oav/ansible-minilab.git
Cloning into 'ansible-minilab'...
remote: Enumerating objects: 21, done.
remote: Total 21 (delta 0), reused 0 (delta 0), pack-reused 21
Receiving objects: 100% (21/21), 51.72 KiB | 999.00 KiB/s, done.
Resolving deltas: 100% (2/2), done.
testhost> cd ansible-minilab/
```
3. Check the status of the Vagrant environment.
Once you have cloned this repository, installed all the requirements and jumped into the directory, you should see this:
``` ```
vagrant status testhost> vagrant status
vsrx1 not created (virtualbox) vsrx1 not created (virtualbox)
ansible-node not created (virtualbox) ansible-node not created (virtualbox)
...@@ -109,14 +132,52 @@ ansible-node not created (virtualbox) ...@@ -109,14 +132,52 @@ ansible-node not created (virtualbox)
This environment represents multiple VMs. The VMs are all listed This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific above with their current state. For more information about a specific
VM, run `vagrant status NAME`. VM, run `vagrant status NAME`.
```
4. Activate Vagrant
Type ```vagrant up``` without any argument to activate all of the virtual devices. This may take up to 10-15 mins depending on your device and its connection to the Internet.
``` ```
Launching ```vagrant up``` without any argument turn on all the vms - This may take up to 10-15 mins. dcunningham@hellfire ~/D/g/ansible-minilab (master)> vagrant up
Bringing machine 'vsrx1' up with 'virtualbox' provider...
Bringing machine 'ansible-node' up with 'virtualbox' provider...
==> vsrx1: Box 'juniper/ffp-12.1X47-D15.4-packetmode' could not be found. Attempting to find and install...
vsrx1: Box Provider: virtualbox
vsrx1: Box Version: >= 0
==> vsrx1: Loading metadata for box 'juniper/ffp-12.1X47-D15.4-packetmode'
vsrx1: URL: https://vagrantcloud.com/juniper/ffp-12.1X47-D15.4-packetmode
==> vsrx1: Adding box 'juniper/ffp-12.1X47-D15.4-packetmode' (v0.5.0) for provider: virtualbox
vsrx1: Downloading: https://vagrantcloud.com/juniper/boxes/ffp-12.1X47-D15.4-packetmode/versions/0.5.0/providers/virtualbox.box
==> vsrx1: Successfully added box 'juniper/ffp-12.1X47-D15.4-packetmode' (v0.5.0) for 'virtualbox'!
==> vsrx1: Importing base box 'juniper/ffp-12.1X47-D15.4-packetmode'...
==> vsrx1: Matching MAC address for NAT networking...
==> vsrx1: Checking if box 'juniper/ffp-12.1X47-D15.4-packetmode' version '0.5.0' is up to date...
==> vsrx1: Setting the name of the VM: ansible-minilab_vsrx1_1639066331007_61178
==> vsrx1: Clearing any previously set network interfaces...
...
...lots and lots of output including software updates...
...
==> ansible-node: Running provisioner: file...
ansible-node: ./ansible-minilab => /home/vagrant/ansible-minilab
```
5. Post-activation vSRX commands
Once the VSRX VM ou have to do a little manual configuration on vrsx: Once the vSRX device is up, you have to do a __little__ manual configuration. The commands are as follows;
``` ```
> vagrant ssh vsrx1 set system login user vagrant class super-user
set system login user vagrant authentication ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
set interfaces ge-0/0/1 description "HostOnly network"
set interfaces ge-0/0/1 unit 0 family inet address 192.168.56.11/24
set system services netconf ssh
```
To connect to the vSRX, use the `vagrant ssh` command and the name of the virtual device.
```
testhost> vagrant ssh vsrx1
--- JUNOS 12.1X47-D15.4 built 2014-11-12 02:13:59 UTC --- JUNOS 12.1X47-D15.4 built 2014-11-12 02:13:59 UTC
root@vsrx1% cli root@vsrx1% cli
root@vsrx1> configure root@vsrx1> configure
...@@ -135,29 +196,35 @@ root@vsrx1# set system services netconf ssh ...@@ -135,29 +196,35 @@ root@vsrx1# set system services netconf ssh
root@vsrx1# commit check root@vsrx1# commit check
configuration check succeeds configuration check succeeds
[edit] [edit]
root@vsrx1# commit comment “DC - running set commands as per install instructions HELLO SIMONE!” and-quit root@vsrx1# commit comment “Running set commands as per install instructions” and-quit
commit complete commit complete
Exiting configuration mode Exiting configuration mode
root@vsrx1> cd
^
unknown command.
root@vsrx1> exit root@vsrx1> exit
root@vsrx1% exit root@vsrx1% exit
logout logout
Connection to 127.0.0.1 closed. Connection to 127.0.0.1 closed.
```
#### vvvvv Paste config here vvvvvv Once this is done, you can log into the Ansible control node (using `vagrant ssh ansible-node`) and launch your first playbook!
set system login user vagrant class super-user
set system login user vagrant authentication ssh-rsa "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key"
set interfaces ge-0/0/1 description "HostOnly network"
set interfaces ge-0/0/1 unit 0 family inet address 192.168.56.11/24
set system services netconf ssh
``` ```
testhost> vagrant ssh ansible-node
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-91-generic x86_64)
Once this is done, you can login in ansible (using vagrant ssh ansible-node) and launch your first playbook: * Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu Dec 9 16:22:59 UTC 2021
System load: 0.1 Processes: 114
Usage of /: 4.9% of 38.71GB Users logged in: 0
Memory usage: 25% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0% IPv4 address for enp0s8: 192.168.56.199
0 updates can be applied immediately.
```
vagrant@ansible-node:~$ cd ansible-minilab/ vagrant@ansible-node:~$ cd ansible-minilab/
vagrant@ansible-node:~/ansible-minilab$ ansible-playbook -i minilab-inventory/ playbooks/get_facts.yaml vagrant@ansible-node:~/ansible-minilab$ ansible-playbook -i minilab-inventory/ playbooks/get_facts.yaml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment