homeserver/roles/riemers.gitlab-runner/tasks/global-setup.yml

54 lines
1.5 KiB
YAML

---
- name: Create .gitlab-runner dir
file:
path: "{{ gitlab_runner_config_file_location }}"
state: directory
mode: '0755'
become: "{{ gitlab_runner_system_mode }}"
- name: Ensure config.toml exists
file:
path: "{{ gitlab_runner_config_file }}"
state: touch
modification_time: preserve
access_time: preserve
become: "{{ gitlab_runner_system_mode }}"
- name: Set concurrent option
lineinfile:
dest: "{{ gitlab_runner_config_file }}"
regexp: '^(\s*)concurrent ='
line: '\1concurrent = {{ gitlab_runner_concurrent }}'
state: present
backrefs: yes
become: "{{ gitlab_runner_system_mode }}"
notify:
- restart_gitlab_runner
- restart_gitlab_runner_macos
- name: Add listen_address to config
lineinfile:
dest: "{{ gitlab_runner_config_file }}"
regexp: '^listen_address ='
line: 'listen_address = "{{ gitlab_runner_listen_address }}"'
insertafter: '\s*concurrent.*'
state: present
when: gitlab_runner_listen_address | length > 0 # Ensure value is set
become: "{{ gitlab_runner_system_mode }}"
notify:
- restart_gitlab_runner
- restart_gitlab_runner_macos
- name: Add sentry dsn to config
lineinfile:
dest: "{{ gitlab_runner_config_file }}"
regexp: '^sentry_dsn ='
line: 'sentry_dsn = "{{ gitlab_runner_sentry_dsn }}"'
insertafter: '\s*concurrent.*'
state: present
when: gitlab_runner_sentry_dsn | length > 0 # Ensure value is set
become: "{{ gitlab_runner_system_mode }}"
notify:
- restart_gitlab_runner
- restart_gitlab_runner_macos