Skip to content

Instantly share code, notes, and snippets.

View platu's full-sized avatar

Philippe Latu platu

View GitHub Profile

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

C-3PO has to be fixed

Starting from a Debian bullseye base install on host system with old naming interface scheme ...


Consistent vs Oldfashioned network interface naming

Nowadays, network interface names follow the consistent naming rule. In

@platu
platu / resize.sh
Last active June 14, 2024 13:07
IaC Lab01 vm image file resize script
#!/bin/bash
resize_cmd="virt-resize"
if ! command -v "${resize_cmd}" &>/dev/null; then
echo "Command '${resize_cmd}' not found. Please install 'libguestfs-tools' package."
exit 1
fi
# This script resizes $1 VM disk image adding $2 GB to the original size
@platu
platu / ovs+vxlan+lxd-lab.md
Last active April 28, 2024 17:28
VXLAN lab based on OpenVSwitch and lxd containers

% VXLAN lab based on OpenVSwitch and LXD containers


Preamble

The very first idea when I started writing this lab was to illustrate the Virtual Extensible LAN (VXLAN) technology. Now that OpenVSwitch configuration is smoothely integrated in the Debian networking configuration files, this should have resulted in somewhat easy-to-read gist.

@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