We use dynamic inventory plugin. It our case it aws_ec2_inventory plugin.
- Install collection
ansible-galaxy install -r ansible/requirements.yml
- Install the dependencies required by the collection
pip install --upgrade pip
pip install --upgrade setuptools==62.0.0
pip install -r ansible/requirements.txt
- Set environment variables:
export AWS_ACCESS_KEY_ID="***"
export AWS_SECRET_ACCESS_KEY="***"
ansible-inventory -i sandbox_aws_ec2.yml --graph
ansible -u ec2-user -i sandbox_aws_ec2.yml -m ping all
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
pip install --upgrade pip
pip install --upgrade setuptools==62.0.0
pip install -r ansible/requirements.txt
sudo yum install python-requests
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
ansible-inventory --list -i google_cloud_filter.gcp.yml
ansible -u vagrant -i google_cloud_filter.gcp.yml -m ping all
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