ansible
Skill1 starsChanged 59 days agoMITView on GitHub
Ansible standards for role structure, FQCN modules, idempotency, Vault secrets, least-privilege become, block rescue recovery, collection pinning, and the ansible-lint plus Molecule gate. Use when you say "write an Ansible role for this", "this playbook is not idempotent", "encrypt these variables with Vault", "add Molecule tests to this role", or "why does my shell task always report changed". Not for one-off host scripting, use `bash`.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- iuliandita/skillstheir own version, first seen Sep 24, 2026
- indiosmo/skillstheir own version, first seen Jun 5, 2026
- greedychipmunk/agent-skillstheir own version, first seen May 25, 2026
- Cogni-AI-OU/cogni-ai-agent-skillstheir own version, first seen May 19, 2026
- Kubementat/ai_agent_skillstheir own version, first seen Mar 20, 2026
Used with
Projects with it also use docker.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
akornmeierSkilldocker
Guide for using Docker - a containerization platform for building, running, and deploying applications in isolated containers. Use when containerizing applications, creating Dockerfiles, working with Docker Compose, managing images/containers, configuring networking and storage, optimizing builds, deploying to production, or implementing CI/CD pipelines with Docker.
Also in 3 projects that use this
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- greedychipmunk/agent-skills★ 19same name
- iuliandita/skills★ 7same name
- Cogni-AI-OU/cogni-ai-agent-skills★ 4same name
- Kubementat/ai_agent_skills★ 2same name
- indiosmo/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- agentic-engineeringSkill
- ai-regression-testingSkill
- angularSkill
- api-designSkill
- architecture-decision-recordsSkill
- ascend-memorySkill
- ascend-web-hunterSkill
- audio-scribeSkill
- automation-inventorySkill
- backend-patternsSkill
- bashSkill
- build-dependency-managementSkill
- code-formatterSkill
- code-reviewerSkill
- coding-standardsSkill
- dart-flutter-patternsSkill
- database-migrationsSkill
- deployment-patternsSkill
- design-systemSkill
- docker-patternsSkill
- e2e-runbooksSkill
- e2e-testingSkill
- embedded-c-arduinoSkill
- frontend-designSkill
- g-code-3d-printingSkill
- github-opsSkill
- git-workflowSkill
- golang-patternsSkill
- hexagonal-architectureSkill
- home-assistantSkill
- java-coding-standardsSkill
- jetbrains-ide-opsSkill
- jira-integrationSkill
- keycloak-patternsSkill
- kicadSkill
- markdown-writerSkill
- mongodb-patternsSkill
- nextjs-app-router-patternsSkill
- node-backend-patternsSkill
- observability-and-loggingSkill
- obsidianSkill
- performance-optimizationSkill
- postgres-patternsSkill
- powershellSkill
- project-trackingSkill
- python-patternsSkill
- pytorch-patternsSkill
- react-patternsSkill
- researchSkill
- review-duplicationSkill
- security-reviewSkill
- seoSkill
- soap-webservicesSkill
- springboot-patternsSkill
- tdd-workflowSkill
- unitySkill
- web-accessibilitySkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 40
Every unit of work is a role with defaults/, tasks/, handlers/, and a meta/main.yml that names its dependencies explicitly.
- Very specific: line 59
Keep configuration data in host_vars and group_vars, out of the task files that consume it, and keep each task file focused on one domain …
- Distinctive: line 71
Every secret lives in Ansible Vault or in an AWX credential, never in plain text.
- Very specific: line 89
Every task declares a desired state and reports changed only when it actually changed something.
- Very specific: line 225
Use async with poll: 0 plus ansible.builtin.async_status for genuinely long tasks, so the rest of the play is not blocked waiting on a …
- Distinctive: line 232
Run these in order in CI, before any production execution:
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Ansible Standards
How a playbook stays safe to run twice: every task declares the state it wants, secrets never sit in plain text, and a role proves itself in Molecule before it touches a real host. Ansible's failure mode is a play that appears to succeed while quietly doing nothing, or doing it again every run.
Baseline: ansible-core current stable, with ansible-lint and Molecule at their current stable releases. Pin the exact versions in the repository so every contributor and every CI run resolves the same toolchain.
When to activate
- Writing or reviewing a playbook, a role, or a task file.
- Making a task idempotent, or diagnosing one that reports changed on every run.
- Moving secrets into Ansible Vault or into an AWX credential.
- Adding
ansible-lint,--check, or Molecule to CI. - Pinning collections in
requirements.yml. - Targeting more than one operating system from a single role.
When not to activate
- Writing a one-off script for a single host, use
bashorpowershell. - Provisioning cloud infrastructure declaratively rather than configuring it, use
deployment-patterns. - Building the container image the service runs in, use
docker-patterns. - Wiring health checks, metrics, or the readiness banner into the service itself, use
observability-and-logging. - Designing the GitHub Actions workflow that invokes Ansible, use
deployment-patterns.
Roles, not monolithic playbooks
Every unit of work is a role with defaults/, tasks/, handlers/, and a meta/main.yml that names its
dependencies explicitly. A playbook only composes roles against hosts. Use Fully Qualified Collection Names for
every module, so a collection rename or a namespace collision cannot silently change which code runs.
Pass:
- name: Ensure nginx is installed
ansible.builtin.apt:
name: nginx
state: presentFail:
- package: name=nginx state=presentKeep configuration data in host_vars and group_vars, out of the task files that consume it, and keep each task
file focused on one domain of responsibility.
Variables and secrets
Prefix every role variable with the role name so two roles cannot collide in the single flat variable namespace
Ansible actually has. Put defaults in defaults/main.yml and override only where a host genuinely differs. Validate
types and required values with ansible.builtin.assert at the top of the role, so a missing variable fails on the
first task rather than halfway through a change.
Every secret lives in Ansible Vault or in an AWX credential, never in plain text.
Pass:
nginx_tls_key: "{{ vault_nginx_tls_key }}"Fail:
nginx_tls_key: "-----BEGIN PRIVATE KEY-----MIIEvQIBADANBg..."Idempotency is the contract
Every task declares a desired state and reports changed only when it actually changed something. Reach for
ansible.builtin.command or ansible.builtin.shell only when no module covers the job, and give it creates or
removes so a second run is a no-op. A command that runs only from a rescue has no such marker, so it states its
real result with changed_when: true instead.
Pass:
- name: Extract the release bundle
ansible.builtin.command: tar -xzf /tmp/app.tar.gz -C /opt/app
args:
creates: /opt/app/VERSIONFail, changed_when: false here hides a task that runs every time and really does mutate the host:
- name: Extract the release bundle
ansible.builtin.shell: tar -xzf /tmp/app.tar.gz -C /opt/app
changed_when: falsechanged_when and failed_when exist to describe a command's real semantics, not to paper over a non-idempotent
task. Write task names as a description of the desired state, so --check output reads as a plan.
Least privilege on become
Apply become on the individual tasks that need root. A playbook-level become: true escalates every task,
including the ones that read a file or template a config the service user already owns.
Pass:
- name: Install the systemd unit
ansible.builtin.template:
src: app.service.j2
dest: /etc/systemd/system/app.service
become: trueFail:
- hosts: all
become: trueSet become_user explicitly when switching to a non-root service account, and quote every variable interpolated
into a shell task so a value containing a space or a semicolon cannot change the command.
Recover deliberately with block, rescue, always
Any task group that mutates system state and may need rolling back is wrapped. rescue restores a known-good state
and logs the error, always releases locks and removes temp files whether or not the block succeeded.
Pass:
- block:
- name: Deploy application
ansible.builtin.unarchive:
src: app.tar.gz
dest: /opt/app
rescue:
- name: Restore previous release
ansible.builtin.command: /opt/app/bin/rollback.sh
changed_when: true
always:
- name: Remove the staging directory
ansible.builtin.file:
path: /tmp/app-staging
state: absentFail:
- name: Deploy application
ansible.builtin.unarchive:
src: app.tar.gz
dest: /opt/app
ignore_errors: truePin every collection
requirements.yml carries an exact version for every collection. A floating version means two runs of the same
commit can execute different module code, which is the hardest class of Ansible bug to reproduce.
Pass, with the exact versions your resolve step produced:
collections:
- name: community.general
version: "9.5.1"
- name: amazon.aws
version: "8.2.0"Fail:
collections:
- name: community.generalInstall with ansible-galaxy collection install -r requirements.yml --force in CI so the pinned set is what runs.
Performance
Enable SSH pipelining and connection reuse once, in ansible.cfg, rather than tuning individual plays. Cache facts
for large inventories so every run does not re-gather them.
Pass:
[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60sFail:
[defaults]
gathering = alwaysUse async with poll: 0 plus ansible.builtin.async_status for genuinely long tasks, so the rest of the play is
not blocked waiting on a package install.
Gate every change behind lint, check, and Molecule
Run these in order in CI, before any production execution:
ansible-lint, zero violations.ansible-playbook --syntax-check, zero errors.ansible-playbook --check --diffagainst a staging inventory, review the diff.- Molecule, full role execution plus an idempotency run in an isolated container or VM.
verify.yml, assertions that confirm the expected infrastructure state.- Promote. A merge produces a release artifact or a ready-to-run Job Template. Production execution needs an
explicit approval gate, an AWX approval node or a manually triggered
workflow_dispatchrun.
Pass:
molecule test --scenario-name defaultFail:
ansible-playbook -i production site.ymlThe Molecule idempotency step is the one that matters most: it runs the role twice and fails if the second run reports any change. That is the only mechanical proof the idempotency rule above was actually followed.
Reference files
| Open this | For |
| references/platform-targets.md | Targeting several operating systems, wiring dynamic cloud inventory, or setting up AWX and AAP Job Templates |
Related skills
bashandpowershellfor the scripts acommandorwin_shelltask ends up invoking.deployment-patternsfor the pipeline that runs Ansible and the approval gate in front of production.docker-patternsfor the container images Ansible deploys.observability-and-loggingfor the health and readiness signals a deployed service must expose.security-reviewbefore any change that touches credentials, privilege escalation, or a public listener.
Checklist
- Every unit of work is a role with
meta/main.ymland explicit dependencies. - Every module call uses its Fully Qualified Collection Name.
- Role variables are prefixed, defaulted in
defaults/main.yml, and asserted at role entry. - No secret in plain text, everything in Vault or an AWX credential.
- Every
commandorshelltask carriescreatesorremoves, or runs only from arescuewithchanged_when: true. - No
changed_when: falsemasking a task that really does change the host. becomeis on the tasks that need it, never on the play.- State-mutating groups are wrapped in
block/rescue/always, no bareignore_errors. - Every collection in
requirements.ymlcarries an exact version. ansible-lint,--syntax-check,--check --diff, Molecule, andverify.ymlall pass in CI.- Molecule's second run reports zero changes.
- Production execution sits behind an explicit approval gate.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

