Using Ansible¶
If you also use an Ansible inventory for your hosts, you can of
course integrate them into the GitLab pipelines too. To make this work, you
need a separate GitLab runner tagged with ansible
and a configuration
like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
The used placeholders in this example are:
TOKEN
: the token of the GitLab runner being generated during setup.YOURAUTHTOKEN
: your auth token to the LakeDrops GitLab Docker registry.INVENTORYNAME
: the name of the Ansible inventory to be used.
To learn more about the Ansible images for an inventory and how to set up some configuration files, please have a look into Docker for Ansible.
Once you have the GitLab runner for Ansible setup for the Drupal project, you can adjust your GitLab CI configuration:
Using Ansible to Dump DB¶
You can replace the task above with this simple instruction:
1 2 |
|
Using Ansible for Deployment¶
You need a couple of additional variables and then you can replace the deploy task above with this simple instruction:
1 2 3 4 5 6 |
|
The host name needs to be set to how the destination host is known in the Ansible inventory, and the site name needs to be set to the ID of the Drupal site in your inventory.