Configuring aliases

You can configure the commonly used commands as alias by editing the bnz-command-alias.yaml file.

Procedure

  1. Go to the Z ChatOps configuration directory.
    • For Container users:
      1. Go to the directory where you extract the IBM Z® ChatOps Container archive.
      2. Run the following command to open an interactive shell on the IBM Z ChatOps container that is running.
        ./bnzContainer.sh shell
      3. Go to the configuration directory.
        cd config
      Tip: If you are familiar with docker/podman commands, you can use the commands to open the interactive bash shell. You can also edit the configuration files directly in the mounted path of the zchatops-configuration-1131 or zchatops-configuration-113 volume.
    • For native installation users:
      cd $ZCHATOPS_HOME/config
  2. Edit the alias list configuration file bnz-command-alias.yaml.
    The format for creating an alias is as follows:
    alias: command
    where,
    • the alias parameter specifies the name of the alias.
    • the command parameter specifies the commands that you want to give an alias. You can also include variables.
      • The variables must be a sequence of numbers that begins with 1. For example, ${1} ${2} ${3}
      • If there is space in the variable strings, you must enclose the variable in single quotation marks ''. For example, workstation list status 'station ${1}' --en ${2}
    For example,
    Table 1.
    Commands that you want to give an alias workstation list status 'ALTW' --en IZWS
    Alias created in the configuration file ws: workstation list status '${1}' –-en ${2}
    Commands you can type in ChatOps ws ALTW IZWS

    In this example, whenever you enter the command ws ALTW IZWS, the actual command performed is workstation list status 'ALTW' --en IZWS.

    The following snippet is a sample list of aliases defined in the configuration file.
    
    1: lpar list status
    2: ar list status --dn $1
    ws: workstation list status 'station ${1}' --en ${2}
  3. Run the bnzsvr restart command to restart Z ChatOps to make the changes take effect. For more information, see Starting and stopping Z ChatOps.

Results

You can type aliases that you created to interact with Z ChatOps.