assert

stop a host when a check command fails

The plan marks the step with * and runs nothing. Apply runs the command. A failed assert stays pending on the host, and the next apply runs it again, also when nothing else changes.

Keys

KeyTypeDefaultMeaning
commandstringrequiredcheck command
messagestringrequirederror when the check fails

assert.command

string, required

Check command. It runs during apply, through sh -e as root, in /. Exit 0 passes.

assert.message

string, required

Error when the check fails. The host fails with it when the command exits non-zero, followed by the shell's error when the exit is 126 or 127.

Example

- name: Check that nginx answers
  assert:
    command: curl -fsS http://localhost/
    message: nginx does not answer on port 80