Skip to content

Instantly share code, notes, and snippets.

View platu's full-sized avatar

Philippe Latu platu

View GitHub Profile
@platu
platu / ovs+incus+sharedvlans-setup.md
Last active October 14, 2024 17:25
Host Incus containers networked on VLANs in the physical world

Host Incus containers networked on VLANs in the physical world

The installation process begins with a Debian trixie base installation on the host system or virtual machine.

It is important to note that this system is networked on a trunk mode port, which allows for the sharing of VLANs between the host or virtual machine and other devices on the networks.

Target topology

Start UNprivileged Incus containers on top of Open vSwitch in a few steps

C-3PO has to be fixed

The installation process begins with a Debian trixie base installation on the host system or virtual machine.


Install Netplan and OvS and other tools on host

@platu
platu / .gitlab-ci.yml
Created March 24, 2024 18:17
IaC Lab 3 GitLab pipeline
variables:
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
cache:
paths:
- .cache/pip
- ansible/
stages:
- Build
@platu
platu / routers_config.yml
Created March 24, 2024 17:42
IaC Lab 3 virtual routers network configuration
---
- name: CONFIGURE ROUTER INTERFACES AND DEFAULT ROUTES
hosts: routers
# Base topology configuration tasks for the three routers
tasks:
- name: APPLY HOSTNAME
cisco.ios.ios_hostname:
config:
hostname: "{{ inventory_hostname }}"
@platu
platu / build_lab_inventory.py
Created March 24, 2024 15:01
IaC Lab 3 Dynamic inventory build python script
#!/usr/bin/env python3
import os
import re
import sys
import yaml
"""
VM launch trace file
@platu
platu / copy_run.yml
Last active March 24, 2024 14:29
IaC Lab 3 Ansible copy and run virtual routers stage playbook
---
- name: COPY MASTER IMAGE AND RUN ROUTERS
hosts: hypervisors
tasks:
- name: COPY MASTER IMAGE TO LAB DIRECTORY
ansible.builtin.copy:
src: "{{ item }}"
dest: "{{ ansible_env.HOME }}/vm/{{ lab_name }}/"
mode: "0644"
remote_src: true
@platu
platu / prepare.yml
Last active March 24, 2024 13:33
IaC Lab 3 Ansible prepare stage playbook
---
- name: PREPARE LAB ENVIRONMENT
hosts: hypervisors
tasks:
- name: ENSURE SYMLINK TO MASTERS DIRECTORY EXISTS
ansible.builtin.file:
src: /var/cache/kvm/masters
dest: "{{ ansible_env.HOME }}/masters"
state: link
@platu
platu / ansible.cfg
Created March 24, 2024 09:11
IaC Lab 3 Ansible configuration file
[defaults]
# Use inventory/ folder files as source
inventory = inventory/
host_key_checking = False # Don't worry about RSA Fingerprints
retry_files_enabled = False # Do not create them
deprecation_warnings = False # Do not show warnings
interpreter_python = /usr/bin/python3
[inventory]
enable_plugins = auto, host_list, yaml, ini, toml, script
[persistent_connection]
@platu
platu / bob.yml
Last active March 24, 2024 08:41
IaC Lab 3 host_vars
---
lab_name: iac_lab03
image_name: c8000v-universalk9.17.13.01a
oob_vlan: 28
taps:
- name: tapXX3
vlan_mode: access
tag: "{{ oob_vlan }}"
link: RXXX_mgmt
switch: dsw-host
@platu
platu / hosts.yml
Last active March 24, 2024 08:30
IaC Lab 3 inventory file
---
hypervisors:
hosts:
bob:
ansible_host: fe80:1c::1%enp0s1
vars:
ansible_ssh_user: "{{ hypervisor_user }}"
ansible_ssh_pass: "{{ hypervisor_pass }}"
ansible_ssh_port: 2222