ansible-expert

Provides Ansible reference guidance on variable precedence, collections, Jinja2, vault, and CI integration.

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/psmfd/pi-config --skill ansible-expert-psmfd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ansible-expert
Source: https://github.com/psmfd/pi-config/tree/main/agent/skills/ansible-expert
Command: npx skills add https://github.com/psmfd/pi-config --skill ansible-expert-psmfd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Ansible's 22-level variable precedence, collection architecture changes, and Jinja2 type coercion rules cause frequent misconfigurations that are hard to debug. This Skill gives an AI agent a structured reference so it can answer Ansible questions and review playbooks accurately without guessing. ## Core Features & Use Cases - Variable Precedence Reference: Full 22-level hierarchy with common traps like role defaults vs role vars and set_fact persistence. - Collections and FQCN Guidance: Covers the ansible-core vs ansible meta-package split, FQCN requirements, and collection installation via requirements.yml. - Operational Patterns: Documents privilege escalation pitfalls (pipelining vs requiretty), handler semantics, include_role vs import_role, vault encryption patterns, and GitHub Actions CI constraints. - Use Case: When a playbook silently ignores a group_vars value, consult this reference to identify that a role var at precedence level 15 is overriding the inventory variable. ## Quick Start Ask the agent to explain why my Ansible variable defined in group_vars is being overridden by the role, using the ansible-expert reference.

Frequently Asked Questions about ansible-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does Ansible variable precedence work?▼

Ansible evaluates variables across 22 precedence levels, from command-line values (lowest) to extra vars passed with -e (highest). Common traps include role vars at level 15 overriding most inventory variables, and set_fact at level 19 persisting for the rest of the play.

What is the difference between ansible-core and the ansible package?▼

ansible-core contains only the runtime engine and ansible.builtin modules, suiting minimal CI installs. The ansible meta-package bundles ansible-core plus curated community collections. Playbooks using community.* or ansible.posix.* modules need those collections installed explicitly under ansible-core.

Should I use include_role or import_role in Ansible?▼

import_role is processed statically at parse time, applies when conditions to every task, and inherits tags. include_role is dynamic at runtime, applies conditions once to the include, and supports loops. Choose include_role when you need runtime conditionals or looping.

Why does Ansible sudo fail with pipelining enabled?▼

When pipelining is true, Ansible pipes module code via stdin instead of temp files, but sudo with requiretty in /etc/sudoers rejects stdin-based execution because there is no TTY. Fix it by setting Defaults !requiretty in sudoers or disabling pipelining.

How do I encrypt a single variable with ansible-vault?▼

Use ansible-vault encrypt_string 'value' --name 'var' to encrypt one value while keeping other variables in the file plaintext. The standard ansible-vault encrypt command encrypts the entire file, so encrypt_string is required for mixed sensitive and non-sensitive files.

Why does the systemd module fail in GitHub Actions runners?▼

GitHub-hosted runners do not run systemd, so ansible.builtin.systemd fails when using --connection=local. CI pipelines also require explicitly installing ansible-core via pip and installing any needed collections before running playbooks.