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
knowledgeandprerequisites: 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 doctorpatterns for your inputs
3. Act — execute with configuration-management tools
- Tools:
Glob,Grep,Read,Ansible,Ansible-playbook(see frontmattertools/allowed-tools) - Use
safe_pathfor 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
pip install ansible
ansible --version
Inventory
[web]
api01.example.com
api02.example.com
[web:vars]
ansible_user=deploy
api_port=8080
Playbook
---
- 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
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
ansible-galaxy init api-config-role
ansible-galaxy role install geerlingguy.nginx
Testing
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.iniplaybook(string): Path to the playbook yaml fileextra_vars(string): Extra variables in key=value form via -e
Commands:
ansible --versionansible-playbook -i inventory.ini site.yml --checkansible-playbook -i inventory.ini site.yml --syntax-checkansible-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 scaffoldtemplate(string): Jinja2 template path
Commands:
ansible-galaxy init api-config-roleansible-galaxy role install geerlingguy.nginxansible-config dump | grep -i timeoutansible -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"