Lenvi Ansible Provisioner
Lenvi is a lightweight, Ansible-powered tool for managing local Laravel development environments. It provides a Homestead-like experience without the overhead of a virtual machine, running natively on Linux or on Windows via WSL2.
Features
- Centralized Configuration: Manage all your projects from a single
lenvi.yaml
file. - Multi-PHP: Assign a specific PHP version (e.g., 8.0, 8.2, 8.3) to each site.
- Database Support: Automatically creates databases using a shared MariaDB, MySQL, or PostgreSQL server.
- Idempotent: Safely run the provisioner at any time to update your environment.
Prerequisites
- Ansible: You must have Ansible installed.
# On Debian/Ubuntu sudo apt update sudo apt install python3-pip -y pip3 install ansible
- WSL2 (for Windows users): Install WSL2 and a Linux distribution like Ubuntu 22.04 from the Microsoft Store. All subsequent commands must be run from the WSL2 terminal.
How to Use
-
Clone this repository:
git clone <your-repo-url> ~/tools/lenvi_ansible
-
Configure
lenvi.yaml
: Open~/tools/lenvi_ansible/lenvi.yaml
and configure it for your projects. Set yourdb_engine
and list all your sites under thesites
key. -
Run the Playbook: Navigate to the
lenvi_ansible
directory and run the main playbook.cd ~/tools/lenvi_ansible ansible-playbook playbook.yml --ask-become-pass
Ansible will ask for your
sudo
password to install software and configure services.
Important Note for Windows (WSL2) Users
For your Windows browser (Chrome, Firefox, etc.) to access a site like myapp.test
, you must manually edit the Windows hosts file.
- Open Notepad as an Administrator.
- Open the file:
C:\Windows\System32\drivers\etc\hosts
- For each site in your
lenvi.yaml
, add a new line:127.0.0.1 myapp.test 127.0.0.1 another-app.test
- Save the file. You only need to do this once per new domain.
You can now access your sites in your browser!