# Configuration Management

> Manage API server and service configuration with Ansible playbooks, roles, and config validation commands. Use when working with ansible playbooks, roles and config, api or when the user mentions ansible playbooks, roles and config, api.

- Skill: `opknock/configuration-management` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/configuration-management`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/configuration-management/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/configuration-management

---


Manage API server and service configuration with Ansible playbooks, roles, and config validation commands.

## Agentic Workflow: Read -> Reason -> Act (configuration-management)

You are **Configuration Management** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — api context for `configuration-management`
- Domain: Manage API server and service configuration with Ansible playbooks, roles, and config validation commands.
- **ansible-playbooks**: Write and run Ansible playbooks to deploy and configure API services — `ansible --version`
- **roles-and-config**: Create reusable roles and manage templated configuration files — `ansible-galaxy init api-config-role`
- Check `knowledge` and `prerequisites: ansible, ansible-config, ansible-galaxy, ansible-playbook`

### 2. Reason — think for `configuration-management`
- For `ansible-playbooks`: Write and run Ansible playbooks to deploy and configure API services — decide which checks to run
- For `roles-and-config`: Create reusable roles and manage templated configuration files — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `configuration-management` tools
- Tools: `Glob`, `Grep`, `Read`, `Ansible`, `Ansible-playbook` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `configuration-management:c7835d7a`

# Configuration Management

Manage API configuration across servers with Ansible.

## When to Use

- Rolling out API config changes to fleets of servers
- Templating per-environment config from a single source
- Enforcing drift-free, idempotent configuration

## Setup

```bash
pip install ansible
ansible --version
```

## Inventory

```ini
[web]
api01.example.com
api02.example.com

[web:vars]
ansible_user=deploy
api_port=8080
```

## Playbook

```yaml
---
- name: Configure API servers
  hosts: web
  become: yes
  tasks:
    - name: Deploy config from template
      ansible.builtin.template:
        src: app.conf.j2
        dest: /etc/api/config.json
        mode: "0644"
      notify: restart api
  handlers:
    - name: restart api
      ansible.builtin.systemd:
        name: api
        state: restarted
```

## Run

```bash
ansible-playbook -i inventory.ini site.yml --syntax-check
ansible-playbook -i inventory.ini site.yml --check
ansible-playbook -i inventory.ini site.yml
```

## Roles

```bash
ansible-galaxy init api-config-role
ansible-galaxy role install geerlingguy.nginx
```

## Testing

```bash
ansible -i inventory.ini all -m ping
ansible -i inventory.ini web -m copy -a "src=nginx.conf dest=/etc/nginx/nginx.conf backup=yes" --check
```

## Best Practices

- Always run --check and --syntax-check before real runs
- Keep secrets in ansible-vault, never plain text
- Use handlers to restart services only on change
- Make tasks idempotent and declarative
- Store inventory and playbooks in version control

## Capabilities

### ansible-playbooks
Write and run Ansible playbooks to deploy and configure API services

**Parameters:**
- `inventory` (string): Path to inventory file such as inventory.ini
- `playbook` (string): Path to the playbook yaml file
- `extra_vars` (string): Extra variables in key=value form via -e

**Commands:**
- `ansible --version`
- `ansible-playbook -i inventory.ini site.yml --check`
- `ansible-playbook -i inventory.ini site.yml --syntax-check`
- `ansible-playbook -i inventory.ini site.yml -l web`

**Examples:**
- ansible-playbook -i inventory.ini site.yml --syntax-check
- ansible-playbook -i inventory.ini site.yml --check --diff
- ansible-playbook -i inventory.ini site.yml -e "api_port=8081"

### roles-and-config
Create reusable roles and manage templated configuration files

**Parameters:**
- `role_name` (string): Name of the role to scaffold
- `template` (string): Jinja2 template path

**Commands:**
- `ansible-galaxy init api-config-role`
- `ansible-galaxy role install geerlingguy.nginx`
- `ansible-config dump | grep -i timeout`
- `ansible -i inventory.ini all -m ping`

**Examples:**
- ansible-galaxy init api-config-role
- ansible -i inventory.ini web -m copy -a "src=nginx.conf dest=/etc/nginx/nginx.conf backup=yes"
- ansible -i inventory.ini web -m template -a "src=app.conf.j2 dest=/etc/app/config.json mode=0644"

## References
- [Ansible Documentation](https://docs.ansible.com/ansible/latest/)
- [Ansible Galaxy](https://galaxy.ansible.com/)

