Gardience Documentation gardience.com →
Docs / Using Gardience

Runbooks

A runbook is a task defined once and run from a form. The form asks only for the inputs the task needs, such as a node group or a service name. Nobody types raw Salt commands to run it.

To open runbooks: choose Automation > Runbooks.

Run a runbook

  1. Find the runbook card and choose Run….
  2. Fill in the form. Each field shows its default.
  3. Choose Run now as your name.
  4. Follow the run under Recent runs. Open log to see each machine's result as it finishes and a closing line such as "result: 48 of 50 machine(s) succeeded; failed: web-07, web-12". Ansible playbook runs end with Ansible's own PLAY RECAP.

What happens when you run it:

The job runs under Gardience's automation identity, and the audit log records you as the person who asked. A run ends as success, failed or held.

To run a runbook on a timetable, choose Schedule… on its card. See Schedules.

Built-in runbooks

RunbookWhat it doesInputs
Patch a node groupInstalls pending OS updates on Windows and Linux. Never upgrades the Salt agent.Node group (default Ring0-Pilot)
Patch, restart when needed, patch againInstalls pending OS updates; machines that need a restart to finish them are restarted, and patched again (up to 3 passes), so a Windows cumulative update that waits for a restart is installed in the same run. The Patch Tuesday workflows use it.Node group (default Ring0-Pilot)
Apply security baselineFixes every failing baseline control on the group.Node group (default Linux)
Health checkChecks that every node in the group answers. Used as the verify step in rollouts.Node group (default Ring0-Pilot)
Agent self-recovery settingsHas agents ping the master every 5 minutes and restart themselves if their connection hangs. New enrollments get this already; run it once for agents enrolled earlier or on an attached master. Each agent restarts once (Linux needs systemd).Node group (default Ring0-Pilot)
Restart a serviceRestarts one service on Windows or Linux nodes.Node group (default Windows), Service name (required, default Spooler)
Run a commandRuns one shell command and shows every node's output. Needs command-execution rights.Node group (default Linux), Command (required, printable characters, up to 500)
Install softwareInstalls a package from your repository (winrepo on Windows, apt or dnf on Linux).Node group (default Windows), Package: 7zip, nginx, curl or vim
Enable a Windows roleTurns on IIS or OpenSSH Server.Node group (default Windows), Role: iis or openssh
Set a registry value (Windows)Sets one value under HKLM.Node group (default Windows), Key under HKLM, Value name, Data, Type: REG_SZ or REG_DWORD
Add a hosts file entryAdds an IP address and host name to /etc/hosts or the Windows hosts file.Node group (default Linux), IP address, Hostname
Run an Ansible playbook (Linux)Runs a playbook on each Linux node itself over the Salt connection.Node group, Project, Playbook, Login banner text, Vault secrets, Check mode
Run an Ansible playbook (Windows and Linux, no WinRM)Runs a playbook from Gardience against Windows and Linux nodes over the Salt connection.Node group, Project, Playbook, Vault secrets, Check mode
Reboot a node groupReboots every node in the group and waits for each one to reconnect.Node group (default Ring0-Pilot)

A hidden built-in runbook, Run an uploaded Ansible playbook, runs playbooks uploaded with the gdn command line. It does not appear on this page. See Ansible playbooks.

Built-in runbooks cannot be deleted. They are updated with each Gardience release.

Inputs

Every input is checked before anything runs:

An input that fails a check stops the run with a message that names the field.

Create a custom runbook

Only Gardience admins can create or delete runbooks.

  1. On Automation > Runbooks, go to New runbook.
  2. Fill in the fields:

    • Name: what people see on the card. Saving a runbook with the same name replaces the earlier one.
    • Salt function: the function to run, written as module.function, for example service.restart.
    • Description: what it does and when to use it.
    • Arguments: the function's arguments, separated by commas. Write {{field}} to insert a form value, for example {{service}}.
    • Target: who it runs on. The default {{nodegroup}} uses the node group picked in the form.
    • Target type: nodegroup, glob, list or compound.
    • Form fields: one field per line, in this format:

      name | label | type | options | default

      The type is text, select or nodegroup. For select, list the options separated by commas.

  3. Choose Save runbook. The page reloads with the new runbook card.

Example: a runbook that restarts IIS on a chosen group.

Name:          Restart IIS on web servers
Salt function: service.restart
Arguments:     {{service}}
Target:        {{nodegroup}}
Target type:   nodegroup
Form fields:
nodegroup | Node group | nodegroup | | Windows
service | Service name | text | | W3SVC

To delete a custom runbook, choose Delete on its card. Any schedule that runs it is turned off. Saving a runbook is recorded in the audit log.

Run a runbook from the command line

The gdn command line can list and run runbooks with an API key that has the Operate scope:

./gdn runbooks
./gdn runbook restart-service -e nodegroup=Windows -e service=Spooler

If the key requires approval, the run waits for a second person in Automation > Workflows and approvals.

Gardience by Bouziden Management LLC.