Run the Install Script
c2d-devtop node. The script executes the desktop role in local play mode to set up a personal development environment for a local user.Categories:
Projects:
c2platform/c2/ansible-inventory , c2platform.dev.desktop
Overview
This how-to shows how to run the install script on the c2d-devtop node
in the
development environment. The script executes the desktop role
in local play mode. It creates a personal development environment for the
vagrant user by cloning Git repositories, setting up a Visual Studio Code
workspace, adding an aliases file, and configuring the standard C2
Platform development environment.
The script is a fully non-interactive bootstrap for any user on Ubuntu
24.04. It detects or creates an SSH key, clones the inventory project,
prepares a Python virtual environment, installs requirements, roles and
collections, and then runs the local playbook plays/dev/desktop_local.yml.
That playbook applies the desktop role to converge the personal
development environment.
Prerequisites
- Start the
c2d-devtopnode as described in Set Up the Ansible Development Desktop Node . - Connect via RDP with Remmina as described in Remmina .
Install script
Use Remmina to open an RDP session to the node as the vagrant user. Run
the install script as described in the development environment setup
guide:
- Manage Your Development Environment: Learn how to create, set up, and effectively use your development environment.
wget -qO- https://c2platform.org/install.sh | bash
Open a new terminal so the updated terminal configuration becomes active.
Activate the Python virtual environment with the c2d alias and then
provision the reverse proxy node c2d-rproxy1.
c2d
vagrant up c2d-rproxy1
Test with a new account
Test the local play with a new user account. As the vagrant user, create
the account with the commands below.
export TEST_USER=local-play-test-user
sudo userdel -r $TEST_USER
sudo useradd -G sudo $TEST_USER -m -s /bin/bash -c "Test account for local play"
echo "$TEST_USER:secret" | sudo chpasswd
Log in again as local-play-test-user with password secret and run the
install script again. Provisioning c2d-rproxy1 fails with the following
error:
409 - Error: Instance “c2d-rproxy1” already exists
Show me
The container c2d-rproxy1 already exists because it was created by the
vagrant user. You can confirm this with sudo lxc ls:
(c2) local-play-test-user@c2d-devtop:~/git/gitlab/c2/ansible-c2d$ sudo lxc ls
+-------------+---------+---------------------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-------------+---------+---------------------+------+-----------+-----------+
| c2d-rproxy1 | RUNNING | 10.181.4.149 (eth0) | | CONTAINER | 0 |
| | | 1.1.4.205 (eth1) | | | |
+-------------+---------+---------------------+------+-----------+-----------+
An Ansible development environment that uses local virtualization (VirtualBox or LXD) is single-user. Only one user can use the environment at a time. The install script does not remove nodes created by other users. You can delete the container manually:
sudo lxc delete c2d-rproxy1 --force
The desktop role does update the LXD trust. You can inspect it with:
lxc config trust ls
(c2) local-play-test-user@c2d-devtop:~/git/gitlab/c2/ansible-c2d$ lxc config trust ls
+--------+------------+---------------------------------+--------------+------------------------------+-----------------------------+
| TYPE | NAME | COMMON NAME | FINGERPRINT | ISSUE DATE | EXPIRY DATE |
+--------+------------+---------------------------------+--------------+------------------------------+-----------------------------+
| client | client.crt | local-play-test-user@c2d-devtop | fcbe00bfc1b1 | Aug 10, 2026 at 8:09am (UTC) | Aug 7, 2036 at 8:09am (UTC) |
+--------+------------+---------------------------------+--------------+------------------------------+-----------------------------+
The new user is also added to the vboxusers and lxd groups, but these
are not yet active:
local-play-test-user@c2d-devtop:~/git/gitlab/c2/ansible-c2d$ cat /etc/group | grep lxd
lxd:x:110:vagrant,local-play-test-user
local-play-test-user@c2d-devtop:~/git/gitlab/c2/ansible-c2d$ groups
local-play-test-user sudo
Log out and log back in, reboot the machine, or run the following commands:
newgrp lxd
newgrp vboxusers
Afterwards the user belongs to both groups:
local-play-test-user@c2d-devtop:~$ groups
local-play-test-user sudo lxd vboxusers
With the correct LXD trust, group membership, and no existing node you can now run the provisioning command successfully:
vagrant up c2d-rproxy1
Conclusion
The install script runs the desktop role in local play mode to set up a personal development environment. The Ansible development environment is single-user when local virtualization is used. The desktop role supports switching users by updating the LXC trust (except for removing nodes created by the previous user).
TODO (c2) vagrant@c2d-devtop:~/git/gitlab/c2/ansible-c2d$ ansible-playbook plays/dev/desktop_local.yml -i hosts.ini | tee provision.log
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.