CoAnsible use-cases
Ansible Grid'5000 Provisioning Script
This script automates the provisioning of hosts on Grid'5000 based on an Ansible inventory. It updates the inventory with the correct connection variables (e.g., ansible_host
).
Prerequisites
- Python 3.11 or later
-
uv
(recommended for running the script): uv installation guide - Required Python dependencies:
enoslib>=10,<11
pyyaml>=6,<7
Installation
Clone the repository and install dependencies:
# Clone the repository
git clone https://gitlab.inria.fr/STACK-RESEARCH-GROUP/software/coansible-use-cases.git
cd coansible-use-cases
# Install dependencies using uv
uv pip install -r requirements.txt
Usage
To provision hosts and update the inventory:
./script.py inventory.yml
Command-line Arguments
-
inventory_file
(required): Path to the Ansible inventory file. -
--cluster
(default:ecotype
): Grid'5000 cluster for VM provisioning. -
--cores
or-c
(default:2
): Number of CPU cores per VM. -
--mem
or-m
(default:4096
MB): Memory allocation per VM. -
--os
(default:debian12-x64-min
): OS image to use. -
--walltime
(default:auto
): Reservation duration (HH:MM:SS
format).
Example
To provision resources on Grid'5000 using a specific inventory:
./script.py inventory.yml --cluster lyon --cores 4 --mem 8192 --os ubuntu22-x64-min --walltime 02:00:00
What the Script Does
- Reads the provided Ansible inventory.
- Provisions virtual machines on Grid'5000.
- Updates the inventory with assigned IP addresses and SSH connection details.
- Saves the modified inventory to
99-auto-generated-enoslib.yml
.
Output
The script generates a new inventory file (99-auto-generated-enoslib.yml
) with updated connection details for Ansible.
Notes
- The script automatically determines the walltime based on the current time (
auto
mode). - If
uv
is not used, dependencies must be installed manually withpip install enoslib pyyaml
.
License
This project is maintained by the STACK Research Group and follows the applicable open-source license.