Yes there are many ways to do so:
- First generate an ssh key pair for your
- Copy the public key into the
authorized_keys on your Centos server.
Settings > CI/CD > Variables and store your SSH private key as a file. For more information GitLab CI/CD variables | GitLab.
- Create a deploy shell script with the commands you want to run against your machine.
- On the
deploy job ssh into your machine and execute the deploy script.
- ssh -i 'bash -s' < deploy.sh
Also you can run your commands ad-hoc without using a script.
My preferred way is using Ansible. You’ll need to write an ansible playbook with all the command you want to execute and run in in the deploy job.
This is an overall description on how you can deploy using ssh. If you need more details, feel free to leave me a comment.