- Refactor Makefile to enhance command structure, including clearer descriptions and usage examples for targets related to development, inventory, and monitoring tasks. - Update inventory files to ensure correct host configurations and user settings, including adjustments to ansible_user for specific hosts. - Modify group_vars to streamline Tailscale configuration and ensure proper handling of authentication keys. These changes improve the clarity and usability of the Makefile and inventory setup, facilitating smoother operations across the infrastructure.
250 lines
5.8 KiB
Markdown
250 lines
5.8 KiB
Markdown
# Role: development
|
|
|
|
## Description
|
|
Installs core development tools and utilities for software development. This role provides a lightweight foundation for coding without heavy data science dependencies.
|
|
|
|
**For data science tools (Anaconda, Jupyter, R), see the `datascience` role.**
|
|
|
|
## Requirements
|
|
- Ansible 2.9+
|
|
- Debian/Ubuntu systems
|
|
- Root or sudo access
|
|
|
|
## Installed Components
|
|
|
|
### Development Tools
|
|
- **git**: Version control system
|
|
- **build-essential**: C/C++ compilation tools (gcc, g++, make)
|
|
- **python3**: Python 3 interpreter
|
|
- **python3-pip**: Python package manager
|
|
|
|
### Node.js
|
|
- **Node.js 22.x**: Latest LTS from NodeSource
|
|
- **npm**: Node package manager (included with Node.js)
|
|
- Configured from official NodeSource repository
|
|
|
|
### Code Editors
|
|
- **Cursor IDE**: AI-powered code editor (AppImage)
|
|
- Installed to `/usr/local/bin/cursor`
|
|
- Latest stable version from cursor.com
|
|
|
|
## Variables
|
|
|
|
### Core Settings
|
|
| Variable | Default | Description |
|
|
|----------|---------|-------------|
|
|
| `install_cursor` | `true` | Install Cursor IDE |
|
|
| `install_cursor_extensions` | `false` | Install Cursor extensions |
|
|
|
|
### Extension Groups
|
|
Enable specific extension groups based on your development needs:
|
|
|
|
| Variable | Default | Extensions Included |
|
|
|----------|---------|-------------------|
|
|
| `install_python` | `false` | Python, Pylance, Black, isort, Flake8, Ruff |
|
|
| `install_jupyter` | `false` | Jupyter notebooks, keybindings, renderers |
|
|
| `install_web` | `false` | Prettier, ESLint, Tailwind, Vue, Svelte |
|
|
| `install_playwright` | `false` | Playwright testing framework |
|
|
| `install_devops` | `false` | Go, Rust, YAML, Docker, Ansible |
|
|
| `install_r` | `false` | R language support and pack development |
|
|
| `install_docs` | `false` | Markdown tools and linter |
|
|
|
|
### Base Extensions (Always Installed)
|
|
When `install_cursor_extensions: true`, these are always installed:
|
|
- ErrorLens (better error highlighting)
|
|
- GitLens (Git supercharged)
|
|
- Git Graph (visualization)
|
|
- Code Spell Checker
|
|
- EditorConfig support
|
|
- Material Icon Theme
|
|
- GitHub Copilot (if licensed)
|
|
- Copilot Chat
|
|
|
|
## Dependencies
|
|
- `base` role (for core utilities)
|
|
|
|
## Example Playbook
|
|
|
|
### Basic Installation
|
|
```yaml
|
|
- hosts: developers
|
|
roles:
|
|
- role: development
|
|
```
|
|
|
|
### Python Data Science Machine
|
|
```yaml
|
|
- hosts: datascience
|
|
roles:
|
|
- role: development
|
|
vars:
|
|
install_cursor_extensions: true
|
|
install_python: true
|
|
install_jupyter: true
|
|
install_docs: true
|
|
```
|
|
|
|
### Web Development Machine
|
|
```yaml
|
|
- hosts: webdevs
|
|
roles:
|
|
- role: development
|
|
vars:
|
|
install_cursor_extensions: true
|
|
install_web: true
|
|
install_playwright: true
|
|
install_docs: true
|
|
```
|
|
|
|
### Full Stack with DevOps
|
|
```yaml
|
|
- hosts: fullstack
|
|
roles:
|
|
- role: development
|
|
vars:
|
|
install_cursor_extensions: true
|
|
install_python: true
|
|
install_web: true
|
|
install_devops: true
|
|
install_docs: true
|
|
```
|
|
|
|
### Custom Extension List
|
|
You can also override the extension list completely in `host_vars`:
|
|
```yaml
|
|
# host_vars/myhost.yml
|
|
install_cursor_extensions: true
|
|
cursor_extensions:
|
|
- ms-python.python
|
|
- golang.go
|
|
- hashicorp.terraform
|
|
# ... your custom list
|
|
```
|
|
|
|
### With Cursor disabled
|
|
```yaml
|
|
- hosts: servers
|
|
roles:
|
|
- role: development
|
|
install_cursor: false
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# Install on specific host
|
|
make dev HOST=dev01
|
|
|
|
# Install only development tools (skip other roles)
|
|
ansible-playbook playbooks/development.yml --limit dev01 --tags development
|
|
```
|
|
|
|
## Tags
|
|
- `development`, `dev`: All development tasks
|
|
- `cursor`, `ide`: Cursor IDE installation only
|
|
|
|
## Post-Installation
|
|
|
|
### Verify Installations
|
|
```bash
|
|
git --version
|
|
node --version
|
|
npm --version
|
|
python3 --version
|
|
cursor --version
|
|
```
|
|
|
|
### Node.js Usage
|
|
```bash
|
|
# Install packages globally
|
|
npm install -g <package>
|
|
|
|
# Check Node.js version
|
|
node --version # Should show v22.x
|
|
```
|
|
|
|
### Cursor IDE Usage
|
|
```bash
|
|
# Launch Cursor (if using X11/Wayland)
|
|
cursor
|
|
|
|
# For root users, use the aliased version from .zshrc:
|
|
cursor # Automatically adds --no-sandbox flags
|
|
```
|
|
|
|
## Performance Notes
|
|
|
|
### Installation Time
|
|
- **Base packages**: 1-2 minutes
|
|
- **Node.js**: 1-2 minutes
|
|
- **Cursor IDE**: 2-5 minutes (~200MB download)
|
|
- **Total**: ~5-10 minutes
|
|
|
|
### Disk Space
|
|
- **Node.js + npm**: ~100MB
|
|
- **Cursor IDE**: ~200MB
|
|
- **Build tools**: ~50MB
|
|
- **Total**: ~350MB
|
|
|
|
## Integration
|
|
|
|
### With Data Science Role
|
|
```yaml
|
|
- hosts: datascience_workstation
|
|
roles:
|
|
- role: development # Core dev tools
|
|
- role: datascience # Anaconda, Jupyter, R
|
|
```
|
|
|
|
### With Docker
|
|
```yaml
|
|
- hosts: fullstack_dev
|
|
roles:
|
|
- role: development
|
|
- role: docker
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Node.js Version Issues
|
|
If Node.js doesn't upgrade to v22:
|
|
```bash
|
|
# Check current version
|
|
node --version
|
|
|
|
# Force reinstall
|
|
apt-get remove nodejs
|
|
# Re-run playbook
|
|
```
|
|
|
|
### Cursor Won't Launch
|
|
For root users, use the alias that adds required flags:
|
|
```bash
|
|
# Check alias in .zshrc
|
|
alias cursor="cursor --no-sandbox --disable-gpu-sandbox..."
|
|
```
|
|
|
|
## Notes
|
|
- Node.js 22 is the current LTS version
|
|
- NodeSource repository is configured for automatic updates
|
|
- Cursor IDE is installed as AppImage for easy updates
|
|
- Build tools (gcc, make) are essential for npm native modules
|
|
- Python 3 is included for development scripts
|
|
- All installations are idempotent (safe to re-run)
|
|
|
|
## Comparison with Data Science Role
|
|
|
|
| Component | Development Role | Data Science Role |
|
|
|-----------|------------------|-------------------|
|
|
| Git | ✅ | - |
|
|
| Node.js | ✅ | - |
|
|
| Build Tools | ✅ | - |
|
|
| Cursor IDE | ✅ | - |
|
|
| Anaconda | ❌ | ✅ |
|
|
| Jupyter | ❌ | ✅ |
|
|
| R Language | ❌ | ✅ |
|
|
| Install Time | ~10 min | ~30-60 min |
|
|
| Disk Space | ~350MB | ~3GB |
|
|
|
|
**Recommendation**: Use `development` role for general coding. Add `datascience` role only when needed for data analysis/ML work.
|