# Configuration Projects

Source: https://docs.ops0.com/docs/configurations/projects

Manage Ansible playbooks and Kubernetes manifests for server and cluster configuration.

## Project Types

Ansible

Playbooks for servers and server groups. SSH-based configuration management.

Kubernetes

YAML manifests and Helm charts for K8s clusters.

## Creating a Project

1. Click **+ Create Project**

2. Enter name and select type (Ansible or Kubernetes)

3. Select target (server, group, or cluster)

4. Click **Create** to open the editor

## Project Card Fields

| Field | Description |
|-------|-------------|
| **Name** | Project name |
| **Type** | Ansible or Kubernetes |
| **Target** | Server, group, or cluster |
| **Files** | Number of files |
| **Last Modified** | When last updated |
| **Policies** | Attached policies |

## Project Actions

| Action | Description |
|--------|-------------|
| **Open** | Edit in Configuration Editor |
| **Edit** | Change settings |
| **Duplicate** | Create a copy |
| **Delete** | Remove project |

## Policy Indicators

| Badge | Severity |
|-------|----------|
| Red | Error - blocks deployment |
| Yellow | Warning |
| Blue | Info only |

---

## AI Playbook Generation

For Ansible projects, ops0 can generate playbooks from natural language using Claude.

In the AI chat panel, describe what you need:

```
Set up nginx as a reverse proxy for a Node.js app on port 3000,
with SSL using Let's Encrypt and a systemd service for auto-restart.
```

ops0 generates complete Ansible YAML with tasks, handlers, and variable definitions. Review the generated code, then click **Validate** before deploying.

---

## Validating Configurations

Click **Validate** in the toolbar to lint files before deploying:

| Type | Tool |
|------|------|
| **Ansible** | `ansible-lint` + `yamllint` |
| **Kubernetes** | `kubectl validate` (dry-run against cluster API) |

Validation errors are shown inline in the editor. Deployments are blocked until all validation errors are resolved.

---

## GitHub and GitLab Sync

Link a configuration project to a repository to push files, pull changes, and create pull/merge requests for review.

1. Open the project editor → click **GitHub** or **GitLab** in the toolbar
2. Select integration, repository, branch, and base path (e.g. `/configs/nginx-setup`)
3. Click **Connect**

After connecting, use **Push** to commit files, **Pull** to fetch the latest, or **Create PR/MR** to open a review request before applying changes.

---

## Approval Workflow

Projects can require approval before deployments run. Approval is configured via policies.

| Status | Meaning |
|--------|---------|
| **pending_approval** | Awaiting an approver |
| **approved** | Approved — deployment proceeds |
| **rejected** | Rejected — deployment cancelled, reason recorded |

---

## Prerequisites

Ansible Projects

Servers registered with SSH access and PEM keys configured

Kubernetes Projects

Cluster connected via ops0 agent or kubeconfig

Warning

Deleted projects cannot be recovered. All files and history are permanently removed.

---

## Example: Creating Projects

### Ansible Project for Web Servers

**Project Setup:**
```
Name:        nginx-webserver-setup
Type:        Ansible
Target:      Server Group: production-web
Description: Configure nginx with SSL and monitoring
```

**File Structure:**
```
nginx-webserver-setup/
├── site.yml
├── inventory/
│   └── hosts.ini        (auto-created from target)
├── roles/
│   └── nginx/
│       ├── tasks/
│       │   └── main.yml
│       ├── handlers/
│       │   └── main.yml
│       ├── templates/
│       │   └── nginx.conf.j2
│       └── vars/
│           └── main.yml
└── vars/
    └── main.yml
```

### Kubernetes Project for Microservice

**Project Setup:**
```
Name:        api-gateway-deploy
Type:        Kubernetes
Target:      Cluster: production-eks
Description: Deploy API gateway with HPA and ingress
```

**File Structure:**
```
api-gateway-deploy/
├── namespace.yml
├── deployment.yml
├── service.yml
├── configmap.yml
├── hpa.yml
└── ingress.yml
```

### Project List View

| Name | Type | Target | Files | Last Modified | Policies |
|------|------|--------|-------|---------------|----------|
| nginx-webserver-setup | Ansible | production-web (4 servers) | 8 | 2 hours ago | 1 warning |
| api-gateway-deploy | Kubernetes | production-eks | 6 | 30 min ago | Passed |
| postgres-backup | Ansible | db-servers (2 servers) | 5 | 1 day ago | - |
| redis-cluster | Kubernetes | staging-eks | 4 | 3 days ago | Passed |
