Skip to main content
Glama

list_tasks

View all tasks that will run when executing a specified Ansible playbook to understand the sequence of operations before deployment.

Instructions

List all tasks that would be executed by a playbook

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
playbookYes

Implementation Reference

  • The main handler function that runs 'ansible-playbook --list-tasks' to list tasks in the specified playbook.
    export async function listTasks(options: ListTasksOptions): Promise<string> {
      const playbookPath = validatePlaybookPath(options.playbook);
      
      // Build command with list-tasks option
      const command = `ansible-playbook ${playbookPath} --list-tasks`;
    
      try {
        // Execute command
        const { stdout, stderr } = await execAsync(command);
        return stdout || 'No tasks found in playbook';
      } catch (error) {
        // Handle exec error
        const execError = error as { stderr?: string; message: string };
        throw new AnsibleExecutionError(
          `Error listing tasks: ${execError.message}`,
          execError.stderr
        );
      }
  • Zod schema defining the input parameters for the list_tasks tool (requires playbook path).
    export const ListTasksSchema = z.object({
      playbook: z.string().min(1, 'Playbook path is required'),
    });
    
    export type ListTasksOptions = z.infer<typeof ListTasksSchema>;
  • Registration of the 'list_tasks' tool in the MCP server, linking schema and handler.
    list_tasks: {
      description: 'List all tasks that would be executed by a playbook',
      schema: ListTasksSchema,
      handler: playbooks.listTasks,
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tarnover/mcp-sysoperator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server