用途:为编写或审阅 Ansible 变更提供实践规则,按任务类型读取 .agents/skills/pflow-ansible/references/ 下对应参考文件,其余跳过;若与项目约定(ansible.cfg、.ansible-lint、现有 role/inventory 布局)冲突,以项目为准并说明。
主要能力:按任务读取不同参考,如任意 task/play/handler/template 读 tasks-style.md;role 结构或变量加读 roles.md;inventory、group_vars/host_vars、ansible.cfg、requirements.yml、仓库布局加读 inventory-layout.md;密钥、vault、become、文件权限加读 security.md;lint/CI、molecule、发布策略加读 testing-run.md。审阅时先读 tasks-style.md 与 security.md,再按任务补充。
使用方式:写或审阅后,二次运行须 changed=0 且 --check 下可工作,否则附注释说明原因。可用时运行 ansible-lint(项目配置,否则 --profile production)与 ansible-playbook --syntax-check;行为变更另在非生产 inventory 上跑 --check --diff,并报告结果。失败的项目命令(ansible-lint、--syntax-check)视为发现,报告后继续。
铁律:状态即数据,期望状态放 inventory(group_vars/host_vars),逻辑放 role,粘合放 playbook;不得用 -e 或 set_fact 遮蔽 role 变量定义状态。role 变量带 role 前缀(如 nginx_port),内部变量用 nginx*,每个输入在 defaults/main.yml 有默认值。密钥不得明文进 Git:vault 加密的 vault* 变量由明文变量引用,密钥流经处用 no_log: true。
适用场景与限制:适用于 Ansible 项目内的编写、审阅、lint 与检查;具体平台与工具版本等暂未提供。