Milestone 6 BlueNetwork - 5huckle/OFFICIALTECHJOURNAL GitHub Wiki

Intro

The intersection between Virtual Machine Automation and Physical Networking is interesting. How do you provision a system that is meant to be on another network? We will use a combination of PowerCLI to control the network the virtual machines are on and Ansible to adjust the actual virtual machine OS settings. Automating the vyos router is not an easy task to start with but it is the logical one before we configure the Blue network

6.1 BlueX Networking

  • Requirements
    • Extend 480-utils.psm1 to
      • Add a new function (e.g. called New-Network) that creates a Virtual Switch and Portgroup
        • Tips on helpful PowerCLI commands
          • New-Virtual-Switch
          • New- VirtualPortGroup
          • Get-VirtualSwitch…
      • Add a new function (e.g. called Get-IP) to get the IP, vm name and MAC address from the first interface of a named VM.
        • Tips on helpful PowerCLI commands
          • Get-NetworkAdapter can be used for mac address
          • vm_object.guest.ipaddress can be used to pull ip
          • May need to append [0] if multiple adapters and IP All of the code for this is linked in the Code section.

Ansible

We set up ansible in an earlier module, however if you don't want to go back to that module and don't have it installed already I'll throw the stuff in here real quick.

sudo apt install sshpass python3-paramiko git
sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt install ansible
ansible --version

After this, we type

cat >> ~/.ansible.cfg << EOF                                            
[defaults]
host_key_checking = false
EOF

this is how we write to a new file without opening it. It is more verbose and easy to use than just echoing everything into a file or appending it.


Deliverables

Here is a link to the ansible code demonstrating all of the deliverables

  • Milestone 6.3 Ansible Ping

image

  • Ansible playbook + Get-ip

image

image