agentleFS
Cogni-AI-OUCogni-AI-OU/cogni-ai-agent-skills/ansible/SKILL.md

ansible

Skill4 starsChanged 6 months agoMITView on GitHub

How to run and manage Ansible operations. You MUST load this skill when working with the `ansible` command.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 2 are distinctive, and 3 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.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the task explicitly requires agentic AI decision-making loops (Ansible is deterministic).

    line 22
  2. Very specific:

    If you encounter hangs during Ansible execution, especially when interacting with package managers like apt on Debian/Ubuntu systems:

    line 34
  3. Very specific:

    Use the DEBIAN_FRONTEND environment variable to prevent prompts from hanging the process.

    line 37
  4. Distinctive:

    Do NOT use mocking to work around unexpected errors:

    line 43
  5. Very specific:

    Never use mock_modules or mock_roles to bypass tasks that are failing due to environment-specific issues or other "shouldn't happen" errors.

    line 45

“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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->

Ansible Operations

When to Use

  • Agent needs to execute Ansible playbooks or commands.
  • User needs to run Ansible automation scripts.
  • Troubleshooting hanging issues during Ansible execution.

When Not to Use

  • For localized script automation on a single machine where simple shell scripts suffice.
  • For managing ephemeral, immutable container infrastructure better suited for Terraform or Dockerfiles.
  • When the task explicitly requires agentic AI decision-making loops (Ansible is deterministic).

Common Pitfalls

  • Interactive Hangs: Failing to set DEBIAN_FRONTEND=noninteractive or handling sudo passwords poorly, causing the agent to hang indefinitely.
  • Ignoring Idempotency: Writing raw shell commands (ansible.builtin.shell) instead of using native Ansible modules, breaking the idempotency guarantee of playbooks.
  • Masking Errors: Using ignore_errors: yes to bypass failures rather than fixing the underlying system state.

Troubleshooting

Ansible Environment issues

If you encounter hangs during Ansible execution, especially when interacting with package managers like apt on Debian/Ubuntu systems:

  • Use the DEBIAN_FRONTEND environment variable to prevent prompts from hanging the process.
  • Set DEBIAN_FRONTEND=noninteractive when running your Ansible commands or in your playbook environment.
  • Example: DEBIAN_FRONTEND=noninteractive ansible-playbook playbook.yml

Prohibiting Mocking for Workarounds

Do NOT use mocking to work around unexpected errors:

  • Never use mock_modules or mock_roles to bypass tasks that are failing due to environment-specific issues or other "shouldn't happen" errors.
  • Underlying issues must be fixed directly; do not mask failures with mocks to unblock progress.

Performance Profiling

To profile the execution time of your playbooks and roles, you can enable the profile_tasks callback plugin. This is useful for identifying slow tasks and optimizing your automation.

  • Enable the plugin by adding it to your ansible.cfg file under [defaults] or via environment variables.
  • Using environment variables: ANSIBLE_CALLBACKS_ENABLED=profile_tasks ansible-playbook playbook.yml
  • In ansible.cfg:

    [defaults]
    callbacks_enabled = ansible.posix.profile_tasks

Related Skills

  • molecule: You MUST load this skill when running or managing Molecule tests for Ansible.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.