Skip to content

Commit 592acff

Browse files
committed
Claude Code guidance
1 parent bf62280 commit 592acff

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

CLAUDE.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
This is an Ansible-based project that automates the deployment of an Ansible Controller with SemaphoreUI web interface. The project deploys SemaphoreUI, PostgreSQL, and Nginx in a production-like setup for managing Ansible automation workflows.
8+
9+
## Core Commands
10+
11+
### Environment Setup
12+
```bash
13+
# Set up Python virtual environment and install Ansible dependencies
14+
source ansible.sh
15+
16+
# Install Ansible roles and collections
17+
./prepare.sh
18+
```
19+
20+
### Required Environment Variables
21+
Before running the playbook, set these environment variables:
22+
```bash
23+
export DB_PASS=your_database_password # Must be >8 characters
24+
export SSH_PASS=KeyWillBeGeneratedWithAPassphrase # Must be >8 characters
25+
```
26+
27+
### Main Deployment Command
28+
```bash
29+
# Deploy full stack (database, semaphore, nginx, tools)
30+
./provision.yml
31+
32+
# Deploy specific components
33+
./provision.yml --tags postgres,database
34+
./provision.yml --tags semaphore
35+
./provision.yml --tags nginx
36+
./provision.yml --tags tools
37+
./provision.yml --tags api
38+
39+
# List all available tags
40+
./provision.yml --list-tags
41+
42+
# Remove Semaphore
43+
./provision.yml --tags semaphore -e desired_state=absent
44+
```
45+
46+
### Testing and Verification
47+
```bash
48+
# Run with verbose output and debug mode
49+
./provision.yml -v -e debug=true
50+
51+
# Run ansible-lint on playbooks
52+
ansible-lint provision.yml
53+
54+
# Check Semaphore credentials
55+
sudo grep ADMIN /home/semaphore/.env
56+
```
57+
58+
## Architecture
59+
60+
### Inventory Structure
61+
- **inventory/local/**: For localhost deployment (AlmaLinux/Rocky/Ubuntu)
62+
- **inventory/dev/**: Development environment configuration
63+
- **inventory/test/**: Test environment configuration
64+
65+
### Ansible Roles Structure
66+
- **Custom roles**: `semaphore/`, `api/`, `bbaassssiiee.*` (nginx_ssl, postgres_ssl, proxy, kubeblocks)
67+
- **Third-party roles**: `andrewrothstein.*` (for tools like kubectl, helm, terraform, k9s)
68+
- **Community roles**: `geerlingguy.docker`
69+
70+
### Key Components
71+
1. **Database layer**: PostgreSQL with SSL configuration
72+
2. **Application layer**: SemaphoreUI running as systemd service
73+
3. **Web layer**: Nginx reverse proxy with SSL
74+
4. **Tools layer**: Optional DevOps tools (kubectl, helm, terraform, k9s, powershell)
75+
5. **API configuration**: Automated Semaphore setup via REST API
76+
77+
### Variable Hierarchy
78+
- `inventory/{env}/group_vars/all.yml`: Global environment settings
79+
- `inventory/{env}/group_vars/semaphore.yml`: Semaphore-specific configuration
80+
- `inventory/{env}/group_vars/database.yml`: Database configuration
81+
- `roles/*/defaults/main.yml`: Role default variables
82+
- `roles/*/vars/main.yml`: Role variables
83+
84+
### Host Groups
85+
- **database**: PostgreSQL installation target
86+
- **semaphore**: SemaphoreUI and tools installation target
87+
- **web**: Nginx reverse proxy target
88+
- **proxy**: Optional forward proxy (Squid) target
89+
90+
## Configuration Notes
91+
92+
### PostgreSQL Version
93+
Check `inventory/{env}/group_vars/database.yml` for correct PostgreSQL version:
94+
- Ubuntu 22.04: `postgres_version: 14`
95+
- AlmaLinux 8/9: `postgres_version: 15`
96+
97+
### Tool Selection
98+
Control which tools to install via `inventory/{env}/group_vars/semaphore.yml`:
99+
- `use_docker: true/false`
100+
- `use_helm: true/false`
101+
- `use_k9s: true/false`
102+
- `use_terraform: true/false`
103+
- `use_opentofu: true/false`
104+
- `use_powershell: true/false`
105+
106+
### SSL Configuration
107+
- Self-signed certificates are used by default
108+
- For production, replace with trusted CA certificates
109+
- Nginx configuration in `roles/bbaassssiiee.nginx_ssl/`
110+
111+
## Development Workflow
112+
113+
1. Modify inventory variables in `inventory/{env}/group_vars/`
114+
2. Test changes with specific tags: `./provision.yml --tags {component}`
115+
3. Use debug mode for troubleshooting: `./provision.yml -v -e debug=true`
116+
4. Verify installation by accessing SemaphoreUI web interface
117+
5. Check service status: `systemctl status semaphore`
118+
119+
## Vagrant Integration
120+
121+
For development with VirtualBox/VMware/Hyper-V:
122+
- Use `Vagrantfile.template` as starting point
123+
- `controller.sh` script handles VM provisioning
124+
- Default inventory: `inventory/local/hosts`

0 commit comments

Comments
 (0)