generated from bisco/codex-bootstrap
1.2 KiB
1.2 KiB
Ansible profile
Enable this profile for repositories containing Ansible playbooks, roles, inventories, or automation scripts.
Rules
Codex MUST:
- prefer idempotent tasks;
- use Ansible builtin modules instead of
shellorcommandwhen possible; - use
service_factswhen checking service availability or service state; - use
becomeexplicitly when privilege escalation is needed; - avoid
ignore_errorsunless explicitly justified; - avoid
changed_when: falseunless semantically correct; - avoid storing secrets in plain YAML;
- keep roles and tasks modular;
- write comments in English;
- preserve compatibility requirements stated in the repository.
Validation examples
Use Docker-based validation commands configured for the project, for example:
docker compose run --rm ansible ansible-playbook --syntax-check playbook.yml
docker compose run --rm ansible ansible-lint
Shell and command usage
shell and command are allowed only when there is no suitable module or when interacting with legacy tools.
When using shell or command, Codex SHOULD:
- make the task idempotent;
- define
changed_whenandfailed_whenwhere needed; - explain why a module is not used.