Building AVD Environment

$ id -P "$USER" | awk -F: '{print "Author: " $1 ", " $8}'
Author: pa, Petr Ankudinov
#        └─ @arista.com

$ date +"%b %Y"
Aug 2025

AVD Installation Options

  • Ansible CE (Community Edition)
    • free to use
    • check AVD docs for the installation manual
  • Ansible Automation Platform
  • AVD Studios on CloudVision
    • coming soon

After 4.9 (PyAVD is the foundation ⚠️)

# ansible-core will be installed as PyAVD requirement
pip install "pyavd[ansible]"
ansible-galaxy collection install arista.avd
# install community.general to support callback plugins, etc.
ansible-galaxy collection install community.general
  • ⚠️ PyAVD is not intended to be used directly for customer projects
  • If you have an exception - you know what to do 🤓 or have Arista PS support
  • Ansible provides a lot of value, for ex. inventory management - use Ansible ⚠️

How to Cook AVD Inventory

  • Be structured.
  • Craft your environment and confirm that it works with some basic test.
  • Create a minimalistic inventory and generate first configs.
  • Grow your environment slowly, keep it clean and easy to read. Avoid workarounds.
  • When required - step back to the last working setup
  • Iterate
  • Cloning existing repo and adjusting to the new setup is not always a good idea.
    • Make sure that you understand every single knob in the cloned inventory

AVD Repository Building Blocks

  • Environment
  • ansible.cfg
  • inventory
  • variables
  • playbooks
  • life quality improvements
    • shortcuts
    • useful hacks

Keep Your AVD Environment Clean

  • ⛔ NEVER use "handcrafted" installation direclty on your machine. It will break! Troubleshooting that is wasted time. ⏱️🗑️
  • ⛔ NEVER use root account!
  • Feasible options:
    • Dedicated and well maintained VM
    • Virtual environment
    • Containers
      • AVD container images are in preview: fully functional, but breaking changes can happen any time
      • No Arista TAC support possible for customers who ordered AVD support
    • AnsibleEEs
      • This one is for RedHat support 💵

Virtual Environment vs Containers

venv/pyenv 📦

  • Pro:
    • simple and lightweight
    • no special tools required
  • Breaks often. Troubleshooting complexity: average
  • How it breaks:
    • multiple Pythons
    • incorrect requirements installation
    • broken path, custom ansible.cfg, tweaks, etc.
    • ../../../<ansible-collection> 🤦 🙈

Containers 🐳

  • Pro:
    • stable, portable
    • high level of isolation
  • Breaks rarely. Troubleshooting complexity: high
  • How it breaks:
    • permission issues 👑
    • broken Docker installation or host OS
    • tools can be "too heavy" for some users 🔨
    • Podman and SELinux require advanced skills

Start AVD Environment in CLI

  • Check available AVD images

  • ⚠️ AVD container images are in preview ⚠️

  • Set alias:

    # use ~/.bashrc if ZSH is not installed
    echo 'alias avd="docker run --rm -it -v avd-playground:/home/avd/playground -w /home/avd/playground ghcr.io/aristanetworks/avd/universal:python3.11-avd-v5.5.1"' >> ~/.zshrc
    # copy an example
    cp -r /home/avd/.ansible/collections/ansible_collections/arista/avd/examples/<example-name>/* .
    
  • Start AVD container in interactive mode:

    avd
    
  • Check installed Ansible collections:

    avd ➜ ~ $ ansible-galaxy collection list | grep avd
    # /home/avd/.ansible/collections/ansible_collections
    arista.avd        5.5.1
    
  • You can exit container any time with exit command

⚠️ To start fresh delete the volume: docker volume rm avd-playground

Create AVD Environment in VSCode

# create devcontainer.json
mkdir -p avd-playground/.devcontainer
cat <<EOF > avd-playground/.devcontainer/devcontainer.json
{
    "image": "ghcr.io/aristanetworks/avd/universal:python3.11-avd-v5.5.1",
    "remoteUser": "avd",
    "onCreateCommand": "mkdir -p /home/avd/playground",
    "workspaceFolder": "/home/avd/playground",
    "workspaceMount": "source=avd-playground,target=/home/avd/playground,type=volume"
}
EOF
# start the AVD environment in VSCode
cd avd-playground
code .
  • Click Reopen in Container button or use VSCode command pallete to find Dev Container: Reopen in Container

💡 if code . not working, open VSCode command pallete and find and use "Install code command in the PATH"

Keep Your ansible.cfg Small

[defaults]
inventory = inventory.yml
jinja2_extensions =  jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n

WARNING: If you need longer ansible.cfg - your environment is likely suboptimal.

  • Avoid custom collection path, etc. when you don't need it.
  • Avoid any kind of relative path, like ../..
  • Test your installation and .cfg on different machines and make sure it works.

Environment Troubleshooting Cheatsheet

  • PyAVD is critical in latest AVD versions

    pip freeze | grep pyavd
    
  • You can encounter Ansible "world writable directory" error in CI, remote containers, etc. due to very relaxed permissions and Ansible thinking it's not secure. Fix:

    $ printenv | grep ANSIBLE
    ANSIBLE_CONFIG=ansible.cfg
    
  • Confirm that your environment is not isolated

    curl --user <login>:<password> --data "show version"
    --insecure https://<switch-mgmt-ip>:443/command-api --verbose
    
# Ansible collection setup
ansible --version
# check collections versions and install location
ansible-galaxy collection list
which ansible
# requirements
pip3 freeze
python3.XX -m pip freeze # may not be the same
# and where to find them
pip --version
python3 -c "import ansible as _; print(_.__file__)"
# python
python3 --version
which python
which python3
which python3.XX
python3.11 -c "import sys;print(sys.path)"
# user
whoami
id -u
id -g
echo ${HOME}
# check the PATH
echo ${PATH}

Fun with iFrames

  • Check your environment
pip freeze | grep pyavd
printenv | grep ANSIBLE
ansible --version
# check collections versions and install location
ansible-galaxy collection list
which ansible
# requirements
pip3 freeze
python3.XX -m pip freeze # may not be the same
# and where to find them
pip --version
python3 -c "import ansible as _; print(_.__file__)"
# python
python3 --version
which python
which python3
which python3.XX
python3.11 -c "import sys;print(sys.path)"
# user
whoami
id -u
id -g
echo ${HOME}
# check the PATH
echo ${PATH}
  • Test connection to Arista switch
curl --user <login>:<password> --data "show version"
--insecure https://<switch-mgmt-ip>:443/command-api --verbose
  • Finally run something
make build

Credits and Attributions

THE END

- One more slide!
+ No more slides.
git commit -m "The END!"

Do not add page number on this slide

Add footer starting from this slide

Add footer starting from this slide