Skip to content

Triggering pipelines through ChatOps

When logging into Mattermost and going to the private channel of one of the inventories, you can trigger ChatOps commands for that inventory by typing /[inventory] help. This will show you a list of all available commands.

The first time you will use one of those commands, the bot responds with the note Hi there! Before I do anything for you, please connect your GitLab account. Click on the provided link and authorize your user account in the opening browser window.

To trigger a pipeline for your inventory, call /[inventory] run [taskname] [arguments], where all the available task names can be found in this GitLab CI Template. Subsequent arguments are optional and can e.g. limit the scope of the pipeline to a specific host with --limit=[hostname].

After submitting the ChatOps command, the bot responds with Sorry, this chat service is currently not supported by GitLab ChatOps. - this message is misleading. It means that your submission was successful but you won't see command output in Mattermost, you have to go to GitLab in order to see the pipeline output.

In addition to all the prepared jobs in the GitLab CI template, you can effectively run any Ansible script by calling /[inventory] run Ansible [script name] [arguments], e.g. /[inventory] run Ansible haproxy-config to run the re-configuration script for HaProxy.


Last update: January 12, 2021 18:06:10