Set Up the Ansible Development Desktop Node

Create the c2d-devtop Ansible development desktop node with Vagrant. This node simulates the host development desktop used for Ansible engineering.

Projects:  c2platform/c2/ansible-inventory ,  c2platform.dev.desktop ,  c2platform.core.linux

Overview

This how-to describes how to use your configured C2 Platform Ansible development desktop to locally deploy another Ansible development desktop node named c2d-devtop as a VirtualBox node. The automated deployment lets you test, inspect, and customize the automation. It can also help you understand how the automation that created the Ansible development desktop you are using was built, including its components and responsibilities.

The deployment uses the desktop role from the Dev collection and the Linux role from the Core collection. These roles are defined and managed in the inventory project.

The c2d-devtop node provides a safe sandbox for experimentation. You can modify Ansible automation, explore new configurations, or test Ubuntu desktop features without risking your primary development environment. If something breaks, simply run vagrant destroy c2d-devtop followed by vagrant up c2d-devtop to restore a clean state.

Prerequisites

Setup

Create the node with Vagrant:

vagrant up c2d-devtop

This takes approximately 9 minutes. See the Vagrant logging in c2d-devtop.log  for detailed Vagrant and Ansible logging.

Verify

RDP with Remmina

Open an RDP connection with Remmina that uses the fixed Vagrant user credentials shown below.

IP AddressUsernamePassword
192.168.56.13vagrantvagrant

The RDP connection displays a screen similar to the one below. Because this is the first login for the user via RDP, complete the simple setup by choosing the language and keyboard layout. You can then start using Ubuntu.

Vagrant, LXD, VirtualBox

Use the application launcher in the top-left corner (three dots) to start a terminal. Type “Terminal” to select it quickly.

In the terminal, run the following commands to verify that Vagrant, LXD, VirtualBox, and Visual Studio Code are installed:

vagrant --version
lxd --version
vboxmanage --version
code --version

The output shows the versions, for example:

vagrant@c2d-devtop:~$ vagrant --version
Vagrant 2.4.0
vagrant@c2d-devtop:~$ lxd --version
5.21.6 LTS
vagrant@c2d-devtop:~$ vboxmanage --version
7.2.14r174565
vagrant@c2d-devtop:~$ code --version
1.132.0
df53daabb18cd157bdb08c7f01c34df936cf12f4
x64

Visual Studio Code

Start Visual Studio Code from the application launcher in the same way as the terminal. You will see a GNOME Keyring prompt, which you have encountered before when setting up your host Ansible development desktop. Use a simple, easy-to-remember password (for example your default development password) because this is a development environment where nodes are created and destroyed frequently. Security is not a primary concern here.

For more information about the GNOME Keyring, see the setup instructions for your host Ansible development desktop: Setup a Development Environment on Ubuntu 24 .

LXD Configuration and Initialization

The desktop role initializes LXD and creates network bridges such as lxdbr0, lxdbr1, lxdbrag1, and phx. List them with:

lxc network ls

Example output:

vagrant@c2d-devtop:~$ lxc network ls
+----------+----------+---------+-----------------+------+-----------------------------------------------+---------+---------+
|   NAME   |   TYPE   | MANAGED |      IPV4       | IPV6 |                  DESCRIPTION                  | USED BY |  STATE  |
+----------+----------+---------+-----------------+------+-----------------------------------------------+---------+---------+
| eth0     | physical | NO      |                 |      |                                               | 0       |         |
+----------+----------+---------+-----------------+------+-----------------------------------------------+---------+---------+
...
| lxdbr0   | bridge   | YES     | 10.13.151.1/24  | none | Default LXD bridge                            | 3       | CREATED |
...

The desktop role also creates several LXD profiles, including default, agd, microk8s, and phx. List them with:

lxc profile ls

Example output:

vagrant@c2d-devtop:~$ lxc profile ls
+----------+----------------------+---------+
|   NAME   |     DESCRIPTION      | USED BY |
+----------+----------------------+---------+
| agd      | GSD LXD profile      | 0       |
+----------+----------------------+---------+
| default  | Default LXD profile  | 0       |
+----------+----------------------+---------+
| microk8s | MicroK8s LXD profile | 0       |
+----------+----------------------+---------+
| phx      | PHX LXD profile      | 0       |
+----------+----------------------+---------+

Optionally, use lxc --help to discover additional LXC commands for inspecting the LXD configuration. Review the pre-seed file roles/desktop/files/lxd-init-preseed.yml to identify the initialization steps performed by the desktop role.

Review

This section explains how the result was achieved. It references the desktop role and the inventory project.

Vagrant

The files Vagrantfile and Vagrantfile.yml in the inventory project are relevant for Vagrant.

Vagrant always uses the first file: Vagrantfile (without an extension). In the C2 Platform approach this file is kept generic and rarely changes. It reads Vagrantfile.yml because the YAML format lets you define the environment more concisely than a plain Vagrantfile. As the environment grows, a traditional Vagrantfile quickly becomes hard to read. Keeping the node, memory, and disk definitions in a separate YAML file avoids duplication, improves readability, and makes maintenance easier. See Vagrant for more information about this optimization.

So the nodes are defined in Vagrantfile.yml. The snippet below defines the Vagrant box ubuntu24:

 Vagrantfile.yml

52  ubuntu24:
53    name: c2platform/ubuntu-24
54    version: 0.0.2
55    labels: [ubuntu24, ubuntu, linux, vbox]

Further down, the Vagrant node c2d-devtop is defined:

 Vagrantfile.yml

285  - name: devtop
286    short_description: Development Desktop
287    description: Ubuntu 24.04 Development Desktop
288    memory: 8192
289    box: ubuntu24
290    ip-address: 192.168.56.13
291    plays:
292      - plays/dev/desktop.yml
293    labels: [devtop, ubuntu_desktop, xrdp]

Both the Vagrant box and Vagrant node have labels. These labels are not used by Vagrant but are consumed by Ansible, as explained below.

Ansible

Ansible Play

The node definition references the play plays/dev/desktop.yml, which uses two roles:

Ansible Configuration

The file Vagrantfile.yml is parsed by the Vagrant inventory plugin1. The plugin places the node in groups based on the labels of both the image ubuntu24 and the node c2d-devtop: devtop, linux, ubuntu, ubuntu24, ubuntu_desktop, vbox, and xrdp.

An additional group development appears. This is the environment group for the default development environment, following the C2 Platform group-based environments strategy.

The table below lists the groups and their corresponding variable files. You can follow each link to inspect the configuration for that group. This helps you understand which settings are relevant for deploying the Ansible development desktop.

GroupCommentFile
developmentEnvironment configgroup_vars/development.yml
devtopDesktop configgroup_vars/devtop/main.yml
linux2
ubuntuUbuntu configgroup_vars/ubuntu/main.yml
ubuntu242
ubuntu_desktopUbuntu desktop configgroup_vars/ubuntu_desktop/main.yml
group_vars/ubuntu_desktop/dev.yml
vbox2
xrdpInstall XRDPgroup_vars/xrdp/main.yml

For further reference, explore the following information:

  • Setup a Development Environment on Ubuntu 24: Install Ansible, Vagrant, LXD, Virtualbox and clone the project directories.
  • Development Environment: A local open-source development environment boosts Ansible automation by providing maximum flexibility and productivity for rapid iteration, testing, and independence from external infrastructure teams or even other engineers on your team due to shared environments.
  • Vagrant: Vagrant provides a user-friendly platform for creating and managing simple local development environments, streamlining the setup process.
  • Ansible Inventory Project: A structured collection of files used for managing hosts and configurations. It typically includes inventory files, playbooks, host configurations, group variables, and Ansible vault files.
  • Simulate Dynamic Inventory in Development: Guideline for using an inventory plugin in Ansible development environments as a concrete example to illustrate future full automation for organizations new to Ansible.

  1. For more information about the Vagrant inventory plugin, see:

    • Ansible Inventory Project: A structured collection of files used for managing hosts and configurations. It typically includes inventory files, playbooks, host configurations, group variables, and Ansible vault files.
    • Simulate Dynamic Inventory in Development: Guideline for using an inventory plugin in Ansible development environments as a concrete example to illustrate future full automation for organizations new to Ansible.
     ↩︎
  2. The Ansible groups linux, ubuntu24, and vbox are currently unused. No group variables exist for these groups, and no corresponding folder is present in the group_vars directory. ↩︎ ↩︎ ↩︎