You've already forked gitlab-runner
31 lines
1.1 KiB
YAML
31 lines
1.1 KiB
YAML
---
|
|
- name: Check if GitLab Runner is already registered
|
|
ansible.builtin.stat:
|
|
path: /etc/gitlab-runner/config.toml
|
|
register: gitlab_runner_config
|
|
|
|
- name: Register GitLab Runner with Docker executor
|
|
ansible.builtin.shell:
|
|
gitlab-runner register
|
|
--non-interactive
|
|
--url {{ gitlab_runner_instance_url }}
|
|
--registration-token {{ gitlab_runner_registration_token }}
|
|
--executor docker
|
|
--description "{{ gitlab_runner_runner_description }}"
|
|
--docker-image "{{ gitlab_runner_docker_default_image }}"
|
|
--tag-list "{{ gitlab_runner_tags | default('') }}"
|
|
when: gitlab_runner_config.stat.exists == False and gitlab_runner_executor == 'docker'
|
|
become: yes
|
|
|
|
- name: Register GitLab Runner with Shell executor
|
|
ansible.builtin.shell: >
|
|
gitlab-runner register
|
|
--non-interactive
|
|
--url {{ gitlab_runner_instance_url }}
|
|
--registration-token {{ gitlab_runner_registration_token }}
|
|
--executor shell
|
|
--description "{{ gitlab_runner_runner_description }}"
|
|
--tag-list "{{ runner_tags | default('') }}"
|
|
when: gitlab_runner_config.stat.exists == False and gitlab_runner_executor == 'shell'
|
|
become: yes
|