Files
gitlab-runner/tasks/config.yml

37 lines
978 B
YAML

---
- name: Create gitlab runner user
user:
name: "{{ gitlab_runner_user }}"
comment: "User for gitlab runner"
state: present
create_home: false
when: gitlab_runner_user != 'root'
- name: create gitlab runner service
template:
src: gitlab-runner.service.j2
dest: /etc/systemd/system/gitlab-runner.service
register: gitlab_runner_service
- name: Create GitLab runner work directory
ansible.builtin.file:
path: "{{ gitlab_runner_working_directory }}"
state: directory
owner: "{{ gitlab_runner_user }}"
group: "{{ gitlab_runner_user }}"
recurse: yes
- name: "Post-fix altered config"
ansible.builtin.replace:
path: "{{ gitlab_runner_config_path }}"
regexp: "concurrent *= *\\d+"
replace: "concurrent = {{ gitlab_runner_concurrent }}"
- name: "Reload config"
ansible.builtin.shell:
# see https://docs.gitlab.com/runner/commands/#signals
cmd: "pkill -SIGHUP -f gitlab-runner"
- meta: flush_handlers