Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Latest commit

 

History

History
83 lines (58 loc) · 1.92 KB

README.md

File metadata and controls

83 lines (58 loc) · 1.92 KB

Install gitlab runner

AWS

Prepare host AWS

We use dynamic inventory plugin. It our case it aws_ec2_inventory plugin.

  1. Install collection
ansible-galaxy install -r ansible/requirements.yml
  1. Install the dependencies required by the collection
pip install --upgrade pip
pip install --upgrade setuptools==62.0.0
pip install -r ansible/requirements.txt
  1. Set environment variables:
export AWS_ACCESS_KEY_ID="***"
export AWS_SECRET_ACCESS_KEY="***"

Check the dynamic inventory

ansible-inventory -i sandbox_aws_ec2.yml --graph
ansible -u ec2-user -i sandbox_aws_ec2.yml -m ping all

Install gitlab runner AWS

ansible-playbook \
    -vvv \
    -e "gitlab_runner_registration_token=GR1348941QSezy3ZFNb8JNtSm8jix runner_tags=devops_school1,devops_school2" \
    -u ec2-user \
    -i /vagrant/ansible/sandbox_aws_ec2.yml \
    /vagrant/ansible/install_gitlab_runner.yml

GCP

pip install --upgrade pip
pip install --upgrade setuptools==62.0.0
pip install -r ansible/requirements.txt
sudo yum install python-requests

Credential preparation

Create and upload gce creds in json to place where you are using ansible https://docs.ansible.com/ansible/latest/scenario_guides/guide_gce.html

change the path to the cred file and your project name in google_cloud_filter.gcp.yml

Check Dynamic ansible inventory GCP

ansible-inventory --list -i google_cloud_filter.gcp.yml
ansible -u vagrant -i google_cloud_filter.gcp.yml -m ping all

Install gitlab runner GCP

ansible-playbook \
    -vvv \
    -e "gitlab_runner_registration_token=xxx runner_tags=devops_school1,devops_school2" \
    -u vagrant \
    -i google_cloud_filter.gcp.yml \
    /vagrant/ansible/install_gitlab_runner.yml