This Ansible playbook automates the installation of essential development tools on a server, including MySQL, PHP, Composer, Laravel, Node.js, Docker, Nginx, Neovim, Lazygit, and more.
- A Linux server (Ubuntu recommended)
- Ansible installed on your local machine
- SSH access to the server
- A user with
sudoprivileges
Run the following command on your local machine:
sudo apt update && sudo apt install -y ansibleVerify Ansible installation:
ansible --versionCopy the install.yml playbook file and the hosts.ini inventory file to your local machine.
Create or edit the hosts.ini file to specify your server details:
[servers]
your_server_ip ansible_user=your_ssh_userFor local installation, use:
[servers]
localhost ansible_connection=localTo install the software on a remote server, run:
ansible-playbook -i hosts.ini install.ymlFor local installation, run:
ansible-playbook -i localhost, --connection=local install.ymlAfter running the playbook, verify the installation:
php -v
composer --version
node -v
docker --version
lazygit --version-
If Ansible fails due to SSH issues, ensure you can connect via SSH:
ssh your_ssh_user@your_server_ip
-
For debugging, add the
-vvvflag to the playbook execution command:ansible-playbook -i hosts.ini install.yml -vvv
This playbook installs the following:
- System Tools: Git, Make, GCC, Unzip, Xclip
- Database: MySQL
- Web Server: Nginx
- Programming Languages & Runtimes: PHP, Node.js, npm
- Development Tools: Composer, Laravel, Neovim, Ripgrep, Lazygit
- Containers: Docker, Docker Compose
- Ensure your firewall allows necessary ports (e.g., 80, 443 for Nginx, 3306 for MySQL).
- Some installations (e.g., Laravel) require
~/.composer/vendor/binto be added to the system PATH.
This script automates your development environment setup with Ansible. Feel free to modify it based on your requirements.