Skip to Content
GuidesAnsible Automation

Ansible Automation

Quazzar Space includes a built-in Ansible scheduler for automating operational tasks across your infrastructure. Available on Business plans and above, the scheduler lets you create, schedule, and monitor Ansible playbook executions directly from the platform.

Overview

The Ansible scheduler integrates with your registered infrastructure. You can:

  • Store and manage Ansible playbooks in the platform
  • Target specific servers, services, groups, or entire environments
  • Schedule playbooks on recurring cron schedules or run them on demand
  • Monitor execution logs and track success/failure rates
  • Set up alerts for failed task runs

Prerequisites

Before using the Ansible scheduler, make sure you have:

  • A Business plan or above
  • At least one server registered in your environment
  • SSH keys configured for the target hosts

Managing SSH Keys

The scheduler needs SSH access to your target servers. To configure keys:

  1. Navigate to Settings > SSH Keys
  2. Click Add SSH Key
  3. Enter the private key or generate a new key pair
  4. Assign the key to the relevant servers or groups

All SSH keys are encrypted at rest. You can rotate keys at any time without affecting scheduled tasks — just update the key and the next execution will use the new one.

Creating Scheduled Tasks

Step 1: Write or Upload a Playbook

  1. Navigate to Automation > Ansible in your project
  2. Click New Playbook
  3. Enter a name and description
  4. Write your Ansible YAML in the built-in editor, or paste an existing playbook

Example — System Update Playbook:

--- - name: Update system packages hosts: all become: true tasks: - name: Update apt cache apt: update_cache: yes cache_valid_time: 3600 when: ansible_os_family == "Debian" - name: Upgrade all packages apt: upgrade: safe when: ansible_os_family == "Debian" - name: Check if reboot is required stat: path: /var/run/reboot-required register: reboot_required - name: Report reboot status debug: msg: "Reboot required: {{ reboot_required.stat.exists }}"

Example — Docker Cleanup Playbook:

--- - name: Clean up Docker resources hosts: all become: true tasks: - name: Remove stopped containers command: docker container prune -f - name: Remove unused images command: docker image prune -af - name: Remove unused volumes command: docker volume prune -f

Step 2: Create a Scheduled Task

  1. Click New Task
  2. Select the playbook to run
  3. Choose your targets (see the targeting section below)
  4. Set the schedule
  5. Save and enable the task

Scheduling Options

Tasks can run on a recurring schedule using cron expressions, or be triggered manually.

Preset Schedules

ScheduleDescription
DailyRuns once per day at a specified time
WeeklyRuns on selected days of the week
MonthlyRuns on a specific day of the month

Custom Cron Expressions

For more control, enter a custom cron expression:

ExpressionFrequency
0 3 * * 0Every Sunday at 3:00 AM
0 */6 * * *Every 6 hours
0 2 1 * *First day of each month at 2:00 AM
*/30 * * * *Every 30 minutes
0 0 * * 1-5Weekdays at midnight

Manual Execution

You can also run any task on demand by clicking the Run Now button on the task detail page. This is useful for testing playbooks before scheduling them or for one-off operations.

Selecting Targets

Playbooks can target infrastructure at different levels:

Target TypeDescription
ServerA single specific server
ServiceServers associated with a particular service
GroupAll servers within a group
EnvironmentAll servers in an environment

Select targets when creating or editing a scheduled task. You can combine multiple targets — for example, run a playbook against all servers in the “Backend” group plus a specific database server.

Viewing Execution Logs

After a playbook runs, you can review the results:

  1. Navigate to Automation > Ansible > Run History
  2. Each execution shows:
    • Status — Queued, Running, Succeeded, or Failed
    • Start and end time — When the run started and how long it took
    • Target servers — Which servers were included
    • Task results — Per-task breakdown with success, changed, or failed status
    • Output logs — Full Ansible output for debugging

Filter the history by playbook, status, date range, or target to find specific runs.

Alert Configuration for Failed Tasks

Set up notifications so your team knows immediately when an automation fails:

  1. Open a scheduled task
  2. Go to the Alerts tab
  3. Enable failure notifications
  4. Select notification channels (email, Slack, Discord, Teams, or webhook)

You can also configure alerts at the project level under Automation > Settings to apply default notification rules to all tasks.

Approval Workflows

For critical operations — such as playbooks targeting production servers — you can require manual approval before execution:

  1. Edit a scheduled task
  2. Enable Require Approval
  3. Select the approvers (team members with Administrator role)

When the task is scheduled to run, it enters a “Pending Approval” state. Designated approvers receive a notification and can approve or reject the execution. The task only runs after approval.

This is particularly valuable for change management processes and compliance requirements.

Best Practices

  • Test first — Always run playbooks manually against a single non-production server before scheduling them broadly
  • Use groups for targeting — Organize servers into groups that map to your automation needs (e.g., “web-servers”, “database-servers”)
  • Set reasonable schedules — Avoid scheduling resource-intensive playbooks during peak traffic hours
  • Monitor failure rates — Enable alerts for all scheduled tasks and investigate failures promptly
  • Version your playbooks — Update the playbook description when you make changes so the run history provides context
  • Limit blast radius — Start with narrow targets and expand gradually once you have confidence in the playbook

Plan Requirements

FeatureRequired Plan
Ansible schedulerBusiness
SSH key managementBusiness
Execution logs and historyBusiness
Approval workflowsEnterprise

Next Steps