# Configurations

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

Server and cluster configuration management with Ansible and Kubernetes.

![ops0 Configurations with AI-powered Ansible playbook](https://docs.ops0.com/images/ai-ansible.png)

## What are Configurations?

Configurations in ops0 let you manage server settings and Kubernetes deployments using Ansible playbooks and Kubernetes manifests. Unlike Infrastructure as Code (which provisions cloud resources), Configurations handle what runs *on* your infrastructure.

## Configuration Types

- **Ansible**: Automate server configuration with playbooks. SSH-based, agentless, idempotent.

- **Kubernetes**: Deploy containerized workloads with YAML manifests. Declarative, self-healing.

---

## How It Works

### Create Project
Choose Ansible or Kubernetes type.

### Write Code
Use AI-assisted editor to create playbooks or manifests.

### Validate
Lint and syntax check your code.

### Deploy
Run with dry-run first, then apply to targets.

---

## Use Cases

| Use Case | Tool | Example |
|----------|------|---------|
| Web server setup | Ansible | Install nginx, configure SSL, enable gzip |
| Database installation | Ansible | Install PostgreSQL, create databases, set up replication |
| User management | Ansible | Create users, manage SSH keys, configure sudo |
| Microservice deployment | Kubernetes | Deploy containers with replicas and autoscaling |
| Secret management | Kubernetes | Store credentials in Secrets, mount to pods |
| Load balancing | Kubernetes | Expose services via Ingress with SSL termination |

---

## Ansible vs Kubernetes

| Aspect | Ansible | Kubernetes |
|--------|---------|------------|
| **Target** | Servers (VMs, bare metal) | Kubernetes clusters |
| **Connection** | SSH | Kubernetes API |
| **Format** | YAML playbooks | YAML manifests |
| **Execution** | Push-based, run on demand | Declarative, controller-based |
| **Best for** | Server configuration | Container orchestration |

---

## Task Status Colors

When deployments run, tasks show colored status indicators:

| Status | Color | Meaning |
|--------|-------|---------|
| **OK** | Green | No change needed |
| **Changed** | Yellow | Resource was modified |
| **Failed** | Red | Task encountered an error |
| **Skipped** | Cyan | Conditional skip |
| **Unreachable** | Dark Red | No connection to host |

---

## Quick Start

- [Create a Project](https://docs.ops0.com/docs/configurations/projects): Start a new Ansible or Kubernetes configuration project

- [Use the Editor](https://docs.ops0.com/docs/configurations/editor): Write playbooks and manifests with AI assistance

- [Deploy Configurations](https://docs.ops0.com/docs/configurations/deployments): Run playbooks on servers or apply manifests to clusters

- [Kubernetes Deep Dive](https://docs.ops0.com/docs/kubernetes/overview): Monitor clusters, incidents, and resource graphs

---

## Example: Configure Web Servers with Ansible

Here's a typical workflow for configuring nginx on a group of web servers:

### 1. Create Project

```
Name:        nginx-webserver-setup
Type:        Ansible
Target:      Server Group: production-web (4 servers)
```

### 2. Write Playbook with AI

Prompt: *"Install nginx with SSL using Let's Encrypt, enable gzip, add security headers"*

**Produced site.yml:**

```yaml
---
- name: Configure secure nginx web server
  hosts: webservers
  become: yes
  vars_files:
    - vars/main.yml

  roles:
    - nginx
    - certbot
```

### 3. Validate

```
✓ ansible-lint passed
✓ Syntax check passed
✓ 0 errors, 0 warnings
```

### 4. Deploy (Dry Run First)

```
PLAY RECAP ***********************************************
web-1.example.com  : ok=6  changed=3  unreachable=0  failed=0
web-2.example.com  : ok=6  changed=3  unreachable=0  failed=0
web-3.example.com  : ok=6  changed=3  unreachable=0  failed=0
web-4.example.com  : ok=6  changed=3  unreachable=0  failed=0
```

### 5. Apply Changes

```
Deployment #47 - nginx-webserver-setup
Status:  ✓ Completed
Duration: 2m 34s
Changed: 12 tasks across 4 hosts
```
