Skip to content
Back to skills

Ansible Playbook

ASecurity

Ansible playbooks and roles: ansible-playbook, undefined variable, variable precedence, idempotency, changed tasks, shell task, FQCN, handlers, vault, ansible-lint. Not generic CI/CD rollout. Triggers: ansible-playbook, playbook, inventory, vault, handler, ansible.builtin, ansible-galaxy, плейбук, инвентарь, роль, ансибл.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 14, 2026
ai-agentsgoshelldockergitdevopsci/cd

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned October 14, 2026

npx -y skills add nordz0r/skills --skill ansible-playbook --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ansible Playbook?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ansible Playbook
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nordz0r-ansible-playbook/badge)](https://www.skillsdirectory.com/skills/nordz0r-ansible-playbook)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ansible-playbook
description: "Ansible playbooks and roles: ansible-playbook, undefined variable, variable precedence, idempotency, changed tasks, shell task, FQCN, handlers, vault, ansible-lint. Not generic CI/CD rollout. Triggers: ansible-playbook, playbook, inventory, vault, handler, ansible.builtin, ansible-galaxy, плейбук, инвентарь, роль, ансибл."
---

# Ansible Playbook

Write idempotent playbooks and roles. `--check --diff` first, then apply.

Do not replace this skill with Docker-only or GitLab YAML work. For containers inside
the task use `community.docker` here; for `.gitlab-ci.yml` use `gitlab-ci`.

## When to use

- Write/review a playbook, role, inventory, group_vars.
- Task failed, undefined var, wrong host, module missing.
- Vault, secrets, `no_log`.
- Turn manual shell commands into modules.

## Workflow

1. Find the existing inventory and roles. Do not introduce a second style into one repo.
2. State the goal as a state: package present, unit enabled, file 0644.
3. FQCN is mandatory: `ansible.builtin.copy`, not `copy`.
4. Secrets only in vault. `no_log: true` on tasks with passwords.
5. Verify: `ansible-lint`, then
   `ansible-playbook -i inventory play.yml --check --diff`.
6. Apply narrowly: `--limit`, `--tags`. Do not run all of prod "just in case".

## Skeleton

```yaml
---
- name: Configure app hosts
  hosts: app
  become: true
  gather_facts: true
  vars_files:
    - vars/app.yml
  handlers:
    - name: Restart app
      ansible.builtin.service:
        name: app
        state: restarted
  tasks:
    - name: Install app package
      ansible.builtin.package:
        name: "{{ app_package }}"
        state: present
      tags: [packages]

    - name: Deploy app config
      ansible.builtin.template:
        src: app.conf.j2
        dest: /etc/app/app.conf
        owner: root
        group: app
        mode: "0640"
        validate: "/usr/sbin/app -t -c %s"
      notify: Restart app
      tags: [config]
```

## Rules

- Every task has a `name:`.
- Do not use `shell`/`command` when a module exists.
- `changed_when`/`failed_when` for command wrappers.
- No `latest` for packages in prod — pin the version if the environment supports it.
- `serial:` and `max_fail_percentage` for rolling updates.
- Never log vault values.

## Companion skills

- Unit/journal on a single host without automation → `administering-linux`.
- Compose file as an artifact → `docker-ops`.
- Running a playbook from a GitLab job → `gitlab-ci`.
- General delivery/rollback framing → `agency-devops-automator`.

## References

- `references/playbooks.md` — inventory, vars, roles, vault, docker.
- `references/debug.md` — check/diff, lint, failed task, precedence.

<!-- A-EVOLVE-ROUTING-SIGNALS:START -->
## Routing signals: ansible ansible-playbook playbook inventory vault ansible-lint fqcn handler role become community.docker
<!-- A-EVOLVE-ROUTING-SIGNALS:END -->

Russian version: [`references/README.ru.md`](references/README.ru.md).

Files in this skill

  • SKILL.md2.9 KB
  • agents/openai.yaml250 B
  • evals/evals.json801 B
  • references/README.ru.md3.1 KB
  • references/debug.md2.9 KB
  • references/playbooks.md2.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.