--- - name: Add gpg key ansible.builtin.apt_key: url: https://packages.gitlab.com/runner/gitlab-runner/gpgkey tags: gitlab-runner - name: Add repository ansible.builtin.apt_repository: repo: '{{ gitlab_runner_repository }}' tags: gitlab-runner - name: Install package ansible.builtin.package: name: - gitlab-runner environment: GITLAB_RUNNER_DISABLE_SKEL: 'true' tags: gitlab-runner - name: Create system directory ansible.builtin.file: path: /etc/systemd/system/gitlab-runner.service.d owner: root group: root mode: 0755 state: directory tags: gitlab-runner - name: Add environment variables ansible.builtin.template: src: environment.conf.j2 dest: /etc/systemd/system/gitlab-runner.service.d/ansible.conf owner: root group: root mode: 0644 notify: restart gitlab-runner tags: gitlab-runner - name: Register runners gitlab_runner: name: '{{ item.name }}' url: '{{ item.url }}' token: '{{ item.token }}' executor: '{{ item.executor }}' options: '{{ item.options | default({}) }}' state: '{{ item.state | default("present") }}' loop: '{{ gitlab_runner_runners }}' loop_control: label: '{{ item.name }}' tags: gitlab-runner - name: Enable and start service ansible.builtin.service: name: gitlab-runner state: started enabled: true tags: gitlab-runner