Available Commands

Please note the colon - : - after the conditionals and before the arguments, as it's required for the deploy to work.

0. comments

Any line starting with a hash (#) is interpreted as a comment and won't be executed. There's an special kind of comment, the alert, which displays an alert message before launching the deploy. This is useful in case your deploy require some custom variables or you want to warn the user to check something before executing a deploy. Please note that the alerts only work on "def" files and not in "def.sudo". The alerts are done by starting a line with # alert:

Syntax:

# Normal comment

# Alert: Message to display before confirming the execution of a deploy

1. install / uninstall

The install command can be used to define a (space separated) list of packages to be installed on the target system. Internally, ASYD will check the kind of system on which is going to install the packages and will use the appropriate package manager for it. Optionally you can define conditionals - please read the conditionals section of the documentation for usage information. On Solaris systems it also accept an extra argument for defining the package manager. Please check the Solaris section of the documentation for more detailed information.

Syntax:

install [if <condition>]: package_a package_b package_c

The uninstall command performs like the install command, but for removing software packages. It also accepts conditionals optionally and package manager in the case of Solaris.

Syntax:

uninstall [if <condition>]: package_a package_b package_c

2. config file

This command allows you to upload a configuration stored in the "configs" directory (first parameter) to the path defined for the target host (second parameter). The name of the local file must be written as is named inside the "configs" directory of the deploy, but you can use any name on the target as it will get renamed when uploaded. Optionally it also accepts conditionals and a "noparse" argument in case you don't want the configuration file to be parsed before uploading but to be uploaded as-is. Please also read the configurations section of the documentation.

Syntax:

[noparse] config file [if <condition>]: file.conf, /destination/file.conf

3. config dir

Behaves the same way as the "config file" command, but inspects recursively all the files and subfolders inside the defined directory, parsing each one of the configuration files in there. Like for "config file", it also accepts the optional conditionals and the "noparse" parameter (see "config file" above).

Syntax:

[noparse] config dir [if <condition>]: confdir, /destination/dir

4. exec

This command simply executes any user defined (bash/sh) command, thus is the most versatile command on ASYD. It accepts optionally conditionals and also a host parameter, on which you can specify any other host on which the command should be executed, instead of the target of the deploy (for example if you wish to update a database or perform any action on a defined host every time a new system is deployed). The exec command also accepts any variable on the defined command, so you can include there passwords, variable parameters, system information, etc. as parameters for any command.

Syntax:

exec [host] [if <condition>]: command

5. http

This command allows you to perform an HTTP GET or POST request from a deploy. This call is performed by the ASYD server instead of the target host. It is particulary useful for interacting with an API, as you can also use "http" from the "var" command to store it's return (see next point).

Syntax:

http get [if <condition>]: url

http post [if <condition>]: url[, key1=val1, key2=val2, ...]

6. service

This command allows you to manage the services on a host. The command is transparent to the user and will work on sysvinit, systemd and OpenBSD init scripts. You can specify a list of services separated by spaces.

Syntax:

<enable|disable|start|stop|restart> service [if <condition>]: <service>

7. var

This command allows you to set a host variable from a "def" or "undeploy" file, which can be called later as a normal variable (<%VAR:varname%> - see variables). The variable can be set with the output of an "exec" command - make sure the command produces an output - or "http" command. If a variable with the same name exists, it will be overwritten to the new value.

Syntax:

var <varname> = exec [host] [if <condition>]: command

var <varname> = http <get|post> [if <condition>]: url[, key1=val1, key2=val2, ...]

7.1. var from json

This command allows you to set a series of variables from a json string. This string can be retrieved from the output of an "exec" or "http" command. On multidimensional hash/arrays the variable name to be set is in the form of level1[level2][levelN]. If a variable with the same name exists, it will be overwritten to the new value.

Syntax:

var from json = exec [host] [if <condition>]: command

var from json = http <get|post> [if <condition>]: url[, key1=val1, key2=val2, ...]

7.2. var from xml

Behaves the same way as "var from json" (see point 7.1) but for XML-formatted outputs.

Syntax:

var from xml = exec [host] [if <condition>]: command

var from xml = http <get|post> [if <condition>]: url[, key1=val1, key2=val2, ...]

8. monitor / unmonitor

This command allows you to monitor (or stop monitoring if "unmonitor" is used) a service. The service parameter must have the same name as the "monitor" file inside the data/monitors directory, which must exist. You can also specify several services separated by spaces. It also accepts optionally conditionals.

Syntax:

monitor [if <condition>]: service

unmonitor [if <condition>]: service

9. deploy / undeploy

With this command you can also launch other deploys from a deploy, even allowing you to create a meta-deploy defining the deploys that should be launched depending on conditionals. The named deploy must exist.

Optionally, this command also accepts both conditionals and defining a target host (as for the exec command).

Syntax:

deploy [host] [if <condition>]: another_deploy

The "undeploy" command behaves the same way but using the undeploy file instead of the normal def file.

Syntax:

undeploy [host] [if <condition>]: another_deploy

10. reboot

It simply reboots a system. This command doesn't requires the colon - : - and the only optional parameter allowed is a conditional. Please note that this command should always be used at the end of a deploy, else, the ASYD server will lose communication with the target host and the following commands won't be executed.

Syntax:

reboot [if <condition>]