Skip to content

Ansible Control Node

Cloud Codger edited this page Sep 9, 2026 · 2 revisions

The Ansible Control Node

The machine from which you run the Ansible CLI tools is called the Control Node and can be run on many different systems. This showcase has used three different systems as the Control Node.

Which ever OS is chosen to be the Control Node, it must have Python3 installed with an important consideration regarding the proxmoxer module.

Debian Control Node

In order to provide the easiest setup, these steps are for anyone that has a Debian based Linux system that will be used as the Ansible Control Node. The following steps are for a Debian based OS but should be fairly easy to convert to other Linux operation systems by using the appropriate package managers.

Going forward, a showcase VM will be created and used as the Ansible Control host. This can, of course, also be a physical machine.

Step 1: Create a VM or install Linux on a computer and SSH into it.

This computer will be called showcase for these steps and assumed to be resolvable in DNS for SSH connectivity. Or that your are logged into the console of the system.

A showcase.yml playbook is being developed for the creation of a VM for this use. It will try and perform as many of the following steps as possible.

Step 2: Inside the VM, clone the cloudcodger/showcase repository and cd into the directory.

REPO_DIR="${HOME}/git-repos/cloudcodger/showcase"
git clone git@github.com:cloudcodger/showcase.git ${REPO_DIR}
cd ${REPO_DIR}

Step 3: Inside the VM, run the vminit script. This will install APT updates, Python3 packages and a Python virtual environment. As well as installing the PIP requirements and Ansible Collections. Look at the script if you want to run these manually. And cd into the showcase directory where you can run all the commands. Comment out the sudo snap commands if not needed or not available.

showcase/bin/vminit
cd showcase

MacOS Control Node

Everyone must start somewhere and for anyone using a Mac, this is the simplest way to get started if you have a Mac.

This steps here use the homebrew package manager. Other methods can be used to install the packages if desired but are left to the reader to figure out.

Step 1: Install Python3, pyenv and pyenv-virtualenv. Maybe check for the latest version of Python3 and install it, if not 3.14.

brew install python@3.14
brew install pyenv
brew install pyenv-virtualenv

Step 2: Install, create and activate a pyenv. The pyenv install --list command can be used to find the versions available to install. Use | grep ' 3\.' to get less output.

pyenv install 3.14
pyenv virtualenv 3.14 venv3.14
# You can skip these if you run the 'source ~/.zshrc' below
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv activate venv3.14

Step 3: Configure ZSH for the virtual environment to automatically activate it for every shell.

echo 'eval "$(pyenv init -)"' >> ~/.zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
# Optionally, add this as well
echo 'pyenv activate venv3.14' >> ~/.zshrc
source ~/.zshrc

Step 4: Clone the cloudcodger/showcase repository and cd into the directory.

REPO_DIR="${HOME}/git-repos/cloudcodger/showcase"
git clone git@github.com:cloudcodger/showcase.git ${REPO_DIR}
cd ${REPO_DIR}

Step 5: Install PIP packages. The python-requirements.txt file is in the showcase repository directory, so either cd to that directory or supply the full path to the file.

cd ${REPO_DIR}
pip3 install -r python-requirements.txt

Step 6: Install the Ansible Collections. The requirements.txt file is in the showcase repository directory, so either cd to that directory or supply the full path to the file.

cd ${REPO_DIR}
ansible-galaxy collection install -r requirements.yml

Multipass Control Node

The majority of this showcase was previously created using multipass which provided a Virtual Machine dedicated to performing tasks for the showcase items described and isolating it from any changes made on the host computer.

In order to use an editor on the Mac to edit the files inside the VM, the git repository is cloned on the Mac and then mounted inside the VM using multipass mount. Some strange behaviour has been noticed with the mounted directory and for this reason all editing and file changes to the repository are made on the Mac and only accessed inside the VM for running playbooks and other commands.

As a VM running Ubuntu, the steps follow typical Ubuntu commands.

Step 1: Install multipass. This assumes the use of a Mac but multipass supports many operating systems. Installation on a different OS is left to the reader.

brew install --cask multipass

Step 2: Clone the cloudcodger/showcase repository and cd into the directory.

REPO_DIR="${HOME}/git-repos/cloudcodger/showcase"
git clone git@github.com:cloudcodger/showcase.git ${REPO_DIR}
cd ${REPO_DIR}

Step 3: Create the showcase VM, mount the showcase repository (the --mount option), copy up any desired files, and shell into the VM. Adjust the CPU (-c), disk size (-d), and memory size (-m) as desired.

multipass launch -c 4 -d 20G -m 4G -n showcase --mount ${REPO_DIR}:/home/ubuntu/showcase
multipass transfer -p ~/.pve_tokens/lab-s1m0ne-pve-*.token showcase:.pve_tokens/
multipass transfer ~/.ssh/cloudcodger* ~/.ssh/showcase* showcase:.ssh/
multipass shell showcase

Step 4: Inside the VM, run the vminit script. This will install APT updates, Python3 packages and a Python virtual environment. As well as installing the PIP requirements and Ansible Collections. Look at the script if you want to run these manually. And cd into the showcase directory where you can run all the commands.

showcase/bin/vminit
cd showcase

Clone this wiki locally