339 lines
12 KiB
YAML
339 lines
12 KiB
YAML
---
|
|
- name: (Windows) Print "[[runners]]" section
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
line: '[[runners]]'
|
|
state: present
|
|
insertbefore: BOF
|
|
|
|
- name: (Windows) Set concurrent limit option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*limit =.*'
|
|
line: ' limit = {{ gitlab_runner.concurrent_specific|default(0) }}'
|
|
state: present
|
|
insertafter: '^\s*name ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set coordinator URL
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*url =.*'
|
|
line: ' url = {{ gitlab_runner_coordinator_url | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*limit ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set clone URL
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*clone_url ='
|
|
line: ' clone_url = {{ gitlab_runner.clone_url | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*url ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner
|
|
when: gitlab_runner.clone_url is defined
|
|
|
|
- name: (Windows) Set environment option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*environment =.*'
|
|
line: ' environment = {{ gitlab_runner.env_vars|default([]) | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*url ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set pre_clone_script
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*pre_clone_script ='
|
|
line: ' pre_clone_script = {{ gitlab_runner.pre_clone_script | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*url ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner
|
|
when: gitlab_runner.pre_clone_script is defined
|
|
|
|
- name: (Windows) Set pre_build_script
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*pre_build_script ='
|
|
line: ' pre_build_script = {{ gitlab_runner.pre_build_script | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*url ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner
|
|
when: gitlab_runner.pre_build_script is defined
|
|
|
|
- name: (Windows) Set post_build_script
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*post_build_script ='
|
|
line: ' post_build_script = {{ gitlab_runner.post_build_script | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*url ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner
|
|
when: gitlab_runner.post_build_script is defined
|
|
|
|
- name: (Windows) Set runner executor option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*executor =.*'
|
|
line: ' executor = {{ gitlab_runner.executor|default("shell") | to_json }}'
|
|
state: present
|
|
insertafter: '^\s*url ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set runner shell option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*shell =.*'
|
|
line: ' shell = {{ gitlab_runner.shell|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.shell is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set output_limit option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*output_limit =.*'
|
|
line: ' output_limit = {{ gitlab_runner.output_limit|default(4096) }}'
|
|
state: present
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set runner docker image option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*image =.*'
|
|
line: ' image = {{ gitlab_runner.docker_image|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.docker_image is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set docker privileged option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*privileged =.*'
|
|
line: ' privileged = {{ gitlab_runner.docker_privileged|default(false) | lower }}'
|
|
state: "{{ 'present' if gitlab_runner.docker_privileged is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set docker volumes option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*volumes =.*'
|
|
line: ' volumes = {{ gitlab_runner.docker_volumes|default([])|to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.docker_volumes is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache type option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*Type =.*'
|
|
line: ' Type = {{ gitlab_runner.cache_type|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_type is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache path option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*Path =.*'
|
|
line: ' Path = {{ gitlab_runner.cache_path|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_path is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache s3 server addresss
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*ServerAddress =.*'
|
|
line: ' ServerAddress = {{ gitlab_runner.cache_s3_server_address|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_s3_server_address is defined else 'absent' }}"
|
|
insertafter: '^\s*\[runners\.cache\.s3\]'
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache s3 access key
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*AccessKey =.*'
|
|
line: ' AccessKey = {{ gitlab_runner.cache_s3_access_key|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_s3_access_key is defined else 'absent' }}"
|
|
insertafter: '^\s*\[runners\.cache\.s3\]'
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache s3 secret key
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*SecretKey =.*'
|
|
line: ' SecretKey = {{ gitlab_runner.cache_s3_secret_key|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_s3_secret_key is defined else 'absent' }}"
|
|
insertafter: '^\s*\[runners\.cache\.s3\]'
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
|
|
- name: (Windows) Set cache shared option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*Shared =.*'
|
|
line: ' Shared = {{ gitlab_runner.cache_shared|default("") | lower }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_shared is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache s3 bucket name option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*BucketName =.*'
|
|
line: ' BucketName = {{ gitlab_runner.cache_s3_bucket_name|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_s3_bucket_name is defined else 'absent' }}"
|
|
insertafter: '^\s*\[runners\.cache\.s3\]'
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache s3 bucket location option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*BucketLocation =.*'
|
|
line: ' BucketLocation = {{ gitlab_runner.cache_s3_bucket_location|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_s3_bucket_location is defined else 'absent' }}"
|
|
insertafter: '^\s*\[runners\.cache\.s3\]'
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache s3 insecure option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*Insecure =.*'
|
|
line: ' Insecure = {{ gitlab_runner.cache_s3_insecure|default("") | lower }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_s3_insecure is defined else 'absent' }}"
|
|
insertafter: '^\s*\[runners\.cache\.s3\]'
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set ssh user option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*user =.*'
|
|
line: ' user = {{ gitlab_runner.ssh_user|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.ssh_user is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set ssh host option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*host =.*'
|
|
line: ' host = {{ gitlab_runner.ssh_host|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.ssh_host is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set ssh port option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*port =.*'
|
|
line: ' port = {{ gitlab_runner.ssh_port|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.ssh_port is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set ssh password option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*password =.*'
|
|
line: ' password = {{ gitlab_runner.ssh_password|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.ssh_password is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set ssh identity file option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*identity_file =.*'
|
|
line: ' identity_file = {{ gitlab_runner.ssh_identity_file|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.ssh_identity_file is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set builds dir file option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*builds_dir =.*'
|
|
line: ' builds_dir = {{ gitlab_runner.builds_dir|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.builds_dir is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- name: (Windows) Set cache dir file option
|
|
win_lineinfile:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
regexp: '^\s*cache_dir =.*'
|
|
line: ' cache_dir = {{ gitlab_runner.cache_dir|default("") | to_json }}'
|
|
state: "{{ 'present' if gitlab_runner.cache_dir is defined else 'absent' }}"
|
|
insertafter: '^\s*executor ='
|
|
backrefs: no
|
|
check_mode: no
|
|
notify: restart_gitlab_runner_windows
|
|
|
|
- include: section-config-runner-windows.yml
|
|
loop: "{{ gitlab_runner.extra_configs|list }}"
|
|
loop_control:
|
|
loop_var: section
|
|
when:
|
|
- gitlab_runner.extra_configs is defined
|
|
- gitlab_runner.extra_configs|list|length > 0
|