@@ -32,169 +32,107 @@ This repository tests two different virtualization technologies:
3232
3333** [ 📖 See detailed documentation →] ( config/tofu/multipass/README.md ) **
3434
35- ## 🔄 ** Quick Comparison**
35+ ## � Provider Comparison
3636
37- | Feature | LXD Containers (Official) | Multipass (Experimental) |
38- | -------------------------- | --------------------------- | ------------------------------ |
39- | ** Status** | ✅ Official Provider | ⚠️ Experimental |
40- | ** GitHub Actions Support** | ✅ Guaranteed | 🔶 Discovered but undocumented |
41- | ** Nested Virtualization** | ❌ Not needed | ✅ Required |
42- | ** Cloud-init Support** | ✅ Container boot | ✅ Full VM boot |
43- | ** Resource Usage** | ✅ Lower (containers) | ❌ Higher (full VMs) |
44- | ** Isolation Level** | 🔶 Process-level | ✅ Complete (separate kernel) |
45- | ** Boot Time** | ✅ Faster (container start) | ❌ Slower (full boot) |
46- | ** Docker Support** | ✅ Full support | ✅ Full support |
47- | ** Setup Complexity** | 🔶 Requires LXD setup | ✅ Simple (snap install) |
37+ ** [ 📖 See detailed comparison →] ( docs/vm-providers.md ) **
4838
49- ## 🚀 ** Getting Started**
39+ | Feature | LXD (Official) | Multipass (Experimental) |
40+ | -------------------------- | ---------------- | ------------------------ |
41+ | ** GitHub Actions Support** | ✅ Guaranteed | ⚠️ Undocumented |
42+ | ** Nested Virtualization** | ❌ Not needed | ✅ Required |
43+ | ** Boot Time** | ✅ ~ 5-10s | ❌ ~ 30-60s |
44+ | ** Resource Usage** | ✅ Lower | ❌ Higher |
45+ | ** Isolation Level** | 🔶 Process-level | ✅ Hardware-level |
5046
51- ### 🏠 ** Local Deployment (Recommended) **
47+ ## 🚀 Quick Start
5248
53- The ** LXD provider ** is the official and recommended approach for both local development and CI/CD environments. Multipass is experimental as GitHub runners' full virtualization support is undocumented.
49+ ### Prerequisites
5450
55- #### ** 1. Prerequisites Verification**
56-
57- Before deploying, verify that all required tools are installed:
51+ Install the required tools:
5852
5953``` bash
60- # Check LXD installation
61- lxd version
54+ # Check installations
55+ lxd version && tofu version && ansible --version
56+ ```
6257
63- # Check OpenTofu installation
64- tofu version
58+ ** Missing tools?** See detailed installation guides:
6559
66- # Check Ansible installation
67- ansible --version
68- ```
60+ - ** [ 📖 OpenTofu Setup Guide →] ( docs/opentofu.md ) **
61+ - ** [ 📖 Ansible Setup Guide →] ( docs/ansible.md ) **
6962
70- ** Install missing tools :**
63+ ** Quick install :**
7164
7265``` bash
73- # Install LXD (via snap - recommended)
74- sudo snap install lxd
75- sudo lxd init --auto
76- sudo usermod -a -G lxd $USER
66+ # Install LXD
67+ sudo snap install lxd && sudo lxd init --auto && sudo usermod -a -G lxd $USER && newgrp lxd
7768
7869# Install OpenTofu
79- curl --proto ' =https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
80- chmod +x install-opentofu.sh
81- ./install-opentofu.sh --install-method deb
70+ curl -fsSL https://get.opentofu.org/install-opentofu.sh | sudo bash
8271
8372# Install Ansible
84- sudo apt update && sudo apt install ansible
85-
86- # IMPORTANT: After adding user to lxd group, restart your terminal or run:
87- newgrp lxd
73+ sudo apt install ansible
8874```
8975
90- #### ** 2. Deploy Infrastructure with OpenTofu **
76+ ### Deployment Steps
9177
92- Navigate to the LXD configuration and deploy the VM:
78+ #### 1. Deploy Infrastructure
9379
9480``` bash
9581# Navigate to LXD configuration
9682cd config/tofu/lxd
9783
98- # Initialize OpenTofu
99- tofu init
100-
101- # Review planned changes (optional)
102- tofu plan
103-
104- # Deploy the infrastructure
105- tofu apply
106- # Type 'yes' when prompted
107-
108- # View deployment results
109- tofu output
84+ # Initialize and deploy
85+ tofu init && tofu apply
11086```
11187
112- After successful deployment, you should see output similar to:
113-
114- ``` text
115- container_info = {
116- "image" = "ubuntu:24.04"
117- "ip_address" = "10.140.190.177"
118- "name" = "torrust-vm"
119- "status" = "Running"
120- }
121- ```
122-
123- #### ** 3. Configure with Ansible**
124-
125- Execute Ansible playbooks to configure and verify the deployed VM:
88+ #### 2. Configure with Ansible
12689
12790``` bash
12891# Navigate to Ansible configuration
12992cd ../../ansible
13093
131- # Update inventory with the VM's IP address
132- # Edit inventory.yml and update ansible_host with the IP from step 2
133-
134- # Test connectivity
135- ansible all -m ping
136-
137- # Execute the cloud-init verification playbook
94+ # Update inventory.yml with the VM's IP from step 1
95+ # Then run the verification playbook
13896ansible-playbook wait-cloud-init.yml
13997```
14098
141- #### ** 4. Verification**
142-
143- Verify the deployment is working correctly:
99+ #### 3. Verify Deployment
144100
145101``` bash
146102# Check VM status
147103lxc list torrust-vm
148104
149- # Connect to the VM
105+ # Connect to VM
150106lxc exec torrust-vm -- /bin/bash
151107
152- # Test SSH connection (from Ansible directory)
108+ # Test SSH connection
153109ssh -i ~ /.ssh/testing_rsa torrust@< VM_IP>
154110```
155111
156- ### 🧪 ** Alternative Approaches**
157-
158- Choose your preferred approach for specific use cases:
159-
160- 1 . ** For local development** : Start with [ LXD configuration] ( config/tofu/lxd/README.md ) (recommended)
161- 2 . ** For experimental testing** : Try [ Multipass configuration] ( config/tofu/multipass/README.md ) (nested virtualization required)
162- 3 . ** For testing both** : Compare both approaches to evaluate differences
163-
164- ## 🎭 ** Ansible Configuration Management**
165-
166- Once VMs are provisioned by OpenTofu, we use ** Ansible** to execute tasks and manage configuration on the running instances.
167-
168- ### ⚙️ ** Ansible Setup (` config/ansible/ ` )**
169-
170- - ** Technology** : Agentless configuration management and task automation
171- - ** Purpose** : Execute tasks on OpenTofu-provisioned VMs
172- - ** Features** : Cloud-init verification, system configuration, application deployment
173-
174- ** [ 📖 See detailed Ansible documentation →] ( config/ansible/README.md ) **
175-
176- ### 🔄 ** Infrastructure Workflow**
112+ ## 🎭 Infrastructure Workflow
177113
1781141 . ** Provision** : OpenTofu creates and configures VMs with cloud-init
1791152 . ** Configure** : Ansible connects to VMs and executes management tasks
1801163 . ** Verify** : Automated checks ensure proper setup and functionality
181117
182- | Phase | Tool | Purpose |
183- | ------------------ | ------------------ | ------------------------------------------- |
184- | ** Infrastructure** | OpenTofu/Terraform | VM provisioning and cloud-init setup |
185- | ** Configuration** | Ansible | Task execution and configuration management |
186- | ** Verification** | Ansible Playbooks | System checks and validation |
118+ | Phase | Tool | Purpose |
119+ | ------------------ | ----------------- | ------------------------------------------- |
120+ | ** Infrastructure** | OpenTofu | VM provisioning and cloud-init setup |
121+ | ** Configuration** | Ansible | Task execution and configuration management |
122+ | ** Verification** | Ansible Playbooks | System checks and validation |
123+
124+ ** [ 📖 See detailed Ansible documentation →] ( docs/ansible.md ) **
187125
188- ## 🧪 ** Testing in GitHub Actions**
126+ ## 🧪 Testing in GitHub Actions
189127
190128Both configurations include GitHub Actions workflows for CI testing:
191129
192130- ** ` .github/workflows/test-multipass-provision.yml ` ** - Tests Multipass VMs
193131- ** ` .github/workflows/test-lxd-provision.yml ` ** - Tests LXD containers
194132
195- ## 📊 ** Current Status**
133+ ## 📊 Current Status
196134
197- ### ✅ ** Completed**
135+ ### ✅ Completed
198136
199137- [x] Multipass VM provisioning (local + GitHub Actions)
200138- [x] LXD container provisioning (local + GitHub Actions)
@@ -204,53 +142,48 @@ Both configurations include GitHub Actions workflows for CI testing:
204142- [x] Basic cloud-init verification playbook
205143- [x] Automated testing workflows
206144
207- ### 🔄 ** In Progress**
145+ ### 🔄 In Progress
208146
209147- [ ] Extended Ansible playbooks for application deployment
210148- [ ] Docker Compose integration testing
211149- [ ] Performance benchmarking
212150- [ ] Official GitHub Actions nested virtualization clarification
213151
214- ### 📋 ** Planned**
152+ ### 📋 Planned
215153
216154- [ ] Additional VM providers evaluation
217155- [ ] Integration with Torrust application testing
218156- [ ] Multi-architecture support (ARM64)
219157
220- ## 📁 ** Repository Structure**
158+ ## 📁 Repository Structure
221159
222160``` text
161+ ├── docs/ # Detailed documentation
162+ │ ├── opentofu.md # OpenTofu setup and usage guide
163+ │ ├── ansible.md # Ansible setup and usage guide
164+ │ └── vm-providers.md # Detailed provider comparison
223165├── config/
224166│ ├── tofu/
225- │ │ ├── multipass/
226- │ │ │ ├── main.tf # OpenTofu configuration for Multipass VMs
227- │ │ │ ├── cloud-init.yml # Cloud-init configuration
228- │ │ │ └── README.md # Multipass-specific documentation
229- │ │ └── lxd/
230- │ │ ├── main.tf # OpenTofu configuration for LXD containers
231- │ │ ├── cloud-init.yml # Cloud-init configuration (same as multipass)
232- │ │ └── README.md # LXD-specific documentation
233- │ └── ansible/
234- │ ├── ansible.cfg # Ansible configuration
235- │ ├── inventory.yml # Host inventory for provisioned VMs
236- │ ├── wait-cloud-init.yml # Playbook to wait for cloud-init completion
237- │ └── README.md # Ansible-specific documentation
238- ├── .github/
239- │ └── workflows/
240- │ ├── test-multipass-provision.yml # Tests Multipass VMs
241- │ └── test-lxd-provision.yml # Tests LXD containers
242- ├── README.md # This file - project overview
243- └── .gitignore # Git ignore rules
167+ │ │ ├── multipass/ # Multipass VM configuration
168+ │ │ └── lxd/ # LXD container configuration
169+ │ └── ansible/ # Ansible configuration management
170+ ├── .github/workflows/ # CI/CD workflows
171+ ├── README.md # This file - project overview
172+ └── .gitignore # Git ignore rules
244173```
245174
246- The repository now properly documents this significant discovery and provides a clear path for others to follow the official GitHub Actions team response. The commit message follows conventional commit standards and clearly describes the documentation improvements.
175+ ## 📚 Documentation
176+
177+ - ** [ 📖 OpenTofu Setup Guide] ( docs/opentofu.md ) ** - Installation, common commands, and best practices
178+ - ** [ 📖 Ansible Setup Guide] ( docs/ansible.md ) ** - Installation, configuration, and project usage
179+ - ** [ 📖 VM Providers Comparison] ( docs/vm-providers.md ) ** - Detailed comparison and decision rationale
247180
248- ## Next Steps
181+ ## 🔮 Next Steps
249182
250183This is a basic setup. Future enhancements could include:
251184
252185- Multiple VMs for different testing scenarios
253186- Custom images with pre-installed Torrust components
254187- Network configuration for multi-VM setups
255188- Enhanced CI/CD integration with nested virtualization
256- - Automated testing scripts
189+ - Automated testing scripts for Torrust applications
0 commit comments