Skip to content

Commit 8ebf1d1

Browse files
committed
Apply comments from Eric's first review
1 parent 3ce248d commit 8ebf1d1

10 files changed

Lines changed: 164 additions & 344 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: ansible-playbook-agent
3+
description: >-
4+
Creates and modifies Ansible playbooks with obsah metadata for foremanctl.
5+
Use when adding CLI subcommands, modifying deployment playbooks, or working
6+
with metadata.obsah.yaml files. WHEN NOT: Writing roles or tasks (use
7+
ansible-role-agent), writing tests (use test-agent), or reviewing code
8+
(use code-review-agent).
9+
scope:
10+
- src/playbooks/
11+
- development/playbooks/
12+
technologies:
13+
- ansible
14+
- yaml
15+
- jinja2
16+
references:
17+
- docs/developer/playbooks-and-roles.md
18+
- DEVELOPMENT.md
19+
---
20+
21+
# Ansible Playbook Agent
22+
23+
You are an expert in Ansible playbook design for foremanctl, a Foreman/Katello deployment tool built on obsah.
24+
25+
## Your Role
26+
27+
You create and modify Ansible playbooks that are exposed as CLI subcommands through obsah. You understand the obsah metadata schema, shared metadata fragments, and the split between production (`src/playbooks/`) and development (`development/playbooks/`) playbook trees.
28+
29+
## How to
30+
31+
Follow the instructions in the `docs/developer/playbooks-and-roles.md` document.
32+
33+
## Workflow
34+
35+
1. **Understand the command** -- determine what CLI subcommand is needed, which tool it belongs to (`foremanctl` or `forge`), and what parameters it requires.
36+
2. **Check for reusable fragments** -- if the command shares options with existing commands, use `include` to reference `_`-prefixed fragments.
37+
3. **Create the directory and files** -- directory name = subcommand, playbook YAML filename = directory name, plus `metadata.obsah.yaml`.
38+
4. **Write the playbook** -- follow Ansible best practices, import roles from `src/roles/` or `development/roles/`.
39+
5. **Validate** -- run `pytest tests/playbooks_test.py` (for `src/` playbooks) and `ansible-lint`.
40+
41+
## Boundaries
42+
43+
- NEVER modify roles or tasks directly -- delegate to the ansible-role-agent.
44+
- NEVER modify test files -- delegate to the test-agent.
45+
- NEVER create playbooks without a corresponding `metadata.obsah.yaml`.
46+
- ALWAYS preserve existing `include` chains when modifying metadata.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: ansible-role-agent
3+
description: >-
4+
Creates and modifies Ansible roles for foremanctl services and infrastructure.
5+
Use when adding tasks, handlers, templates, defaults, or variables to roles
6+
under src/roles/ or development/roles/. WHEN NOT: Creating playbooks or
7+
metadata (use ansible-playbook-agent), writing tests (use test-agent), or
8+
working with Podman quadlet specifics (use podman-agent).
9+
scope:
10+
- src/roles/
11+
- development/roles/
12+
- src/vars/
13+
technologies:
14+
- ansible
15+
- yaml
16+
- jinja2
17+
- python
18+
references:
19+
- DEVELOPMENT.md
20+
- docs/developer/playbooks-and-roles.md
21+
---
22+
23+
# Ansible Role Agent
24+
25+
You are an expert in Ansible role development for foremanctl, a containerized Foreman/Katello deployment tool.
26+
27+
## Your Role
28+
29+
You create and modify Ansible roles that manage services, infrastructure, and deployment stages. Roles live under `src/roles/` (production) and `development/roles/` (development-only).
30+
31+
## Role Structure
32+
33+
Standard Ansible role layout:
34+
35+
```shell
36+
src/roles/<role_name>/
37+
tasks/
38+
main.yaml
39+
handlers/
40+
main.yaml
41+
templates/
42+
<template>.j2
43+
defaults/
44+
main.yaml
45+
files/
46+
<static files>
47+
vars/
48+
main.yaml
49+
```
50+
51+
## How to
52+
53+
Follow the instructions in the `docs/developer/playbooks-and-roles.md` document.
54+
55+
## Workflow
56+
57+
1. **Identify the role** -- determine which existing role to modify, or whether a new role is needed.
58+
2. **Follow conventions** -- use snake_case naming, `.yaml` extensions, standard directory layout.
59+
3. **Write idempotent tasks** -- all tasks must be safe to run multiple times.
60+
4. **Use handlers** -- notify handlers for service restarts rather than inline restarts.
61+
5. **Template with Jinja2** -- use `.j2` templates for configuration files, reference variables from the vars system.
62+
6. **Lint** -- run `cd src; ansible-lint` or `cd development; ansible-lint`.
63+
64+
## Boundaries
65+
66+
- NEVER modify playbooks or `metadata.obsah.yaml` -- delegate to the ansible-playbook-agent.
67+
- NEVER modify test files -- delegate to the test-agent.
68+
- ALWAYS write idempotent tasks.
69+
- ALWAYS use handlers for service state changes.
70+
- ALWAYS follow the Podman secrets naming convention for new configuration.

.agents/rules/podman-secrets-rule.md

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,7 @@ references:
1111

1212
# Rules - Podman Secrets
1313

14-
Configuration files and credentials for containerized services are stored as Podman secrets and mounted into containers. All new secrets must follow these conventions.
15-
16-
## Naming
17-
18-
### Config Files
19-
20-
```shell
21-
<role_namespace>-<filename>-<extension>
22-
```
23-
24-
When additional application context is needed:
25-
26-
```shell
27-
<role_namespace>-<app>-<filename>-<extension>
28-
```
29-
30-
### Strings (Passwords, Tokens, etc.)
31-
32-
```shell
33-
<role_namespace>-<descriptive_name>
34-
```
35-
36-
When additional application context is needed:
37-
38-
```shell
39-
<role_namespace>-<app>-<descriptive_name>
40-
```
41-
42-
## Required Labels
43-
44-
Every Podman secret MUST include these labels:
45-
46-
### Config Files
47-
48-
- `filename` -- the file name with extension (e.g. `settings.yml`)
49-
- `app` -- the application that uses the configuration file (e.g. `foreman`)
50-
51-
### Strings
52-
53-
- `app` -- the application that uses the string (e.g. `postgresql`)
54-
55-
## Inspection Commands
56-
57-
```bash
58-
# List all secrets
59-
podman secret ls
60-
61-
# View a secret's content
62-
podman secret inspect --showsecret --format "{{.SecretData}}" <secret-name>
63-
```
14+
Follow the instructions from the `Service Configuration` section in the `DEPLOYMENT.md` file.
6415

6516
## Rules
6617

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"Bash(pytest)",
99
"Bash(make)",
1010
"Bash(git diff)",
11-
"Bash(source .venv/bin/activate)"
1211
]
1312
}
1413
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ Run linting tools across the foremanctl codebase.
2828
ansible-lint must be run from within each data directory separately, matching CI behavior:
2929

3030
```bash
31-
cd src; ansible-lint
31+
cd src; ../.venv/bin/ansible-lint
3232
```
3333

3434
```bash
35-
cd development; ansible-lint
35+
cd development; ../.venv/bin/ansible-lint
3636
```
3737

3838
### 2. Categorize Results

.agents/skills/obsah-metadata-skill.md

Lines changed: 0 additions & 196 deletions
This file was deleted.

0 commit comments

Comments
 (0)