Actions

Actions¶ actions:

  • name: install playbook: install.yml prompt: message: “Do you really want to run this action?” A block can expose an arbitrary amount of actions. Actions are used to implement the actual functionality of a block. Examples would be install or uninstall, but also status or init.

To execute an Ansible playbook, specify its name in the playbook stanza of an action. Polycrate will create the respective ansible-playbook command and make the workspace snapshot available as extra-vars to the playbook so they can be used even in the host stanza of a playbook.

Actions accept a prompt stanza. If configured with a non-empty message attribute, Polycrate will prompt the user for confirmation before execution an action. If the user declines confirmation, the action will fail. Please note that you can prompt for confirmation in workflow steps, too. If you prompt on an action and on a step, the user will have to confirm 2 times.

Note

You can auto-confirm all prompts by using the –force flag.

Actions also support a script stanza which contains a list of commands that will be merged into a Bash script and executed inside the Polycrate container (or locally if you specifiy –local) when you run the action. The script stanza is mutually exclusive with the playbook stanza.

[…] actions:

  • name: script-action script:
    • ls -la
    • du -hsc
    • env
    • echo “Hello World” […] Note

Action names are limited to certain characters: ^[a-zA-Z]+([-/]?[a-zA-Z0-9]+)+$.

This constraint applies to ALL name stanzas in Polycrate.

Note

Polycrate does not persist data between runs apart from changes made to the workspace directory (mounted at /workspace inside the execution container).

Note

It’s fine to write data to the workspace directory. However it’s best-practice to use Artifacts to persist custom data.

Kontakt

Unsere Container-Experten beraten Sie gerne und individuell. Wir antworten in der Regel innerhalb weniger Stunden auf Ihre Nachricht.

🏠 Halbergstr. 4, 66121, Saarbrücken
🕑 Mo - Fr: 09.00 - 17.00 Uhr
✉ hello@ayedo.de
☎ +49 681 3875 3330