homeserver/roles/riemers.gitlab-runner/tasks/config-runner-windows.yml

38 lines
1.2 KiB
YAML
Raw Normal View History

2021-02-13 14:20:18 +01:00
---
- name: (Windows) Create temporary file
win_tempfile:
state: file
path: "{{ temp_runner_config_dir.path }}"
prefix: "gitlab-runner.{{ runner_config_index }}."
register: temp_runner_config
check_mode: no
changed_when: false
- name: (Windows) Isolate runner configuration
win_copy:
dest: "{{ temp_runner_config.path }}"
content: "{{ runner_config }}"
check_mode: no
changed_when: false
- include_tasks: update-config-runner-windows.yml
when:
- ('name = "'+gitlab_runner.name|default(ansible_hostname+'-'+gitlab_runner_index|string)+'"') in runner_config
- gitlab_runner.state|default('present') == 'present'
loop: "{{ gitlab_runner_runners }}"
loop_control:
index_var: gitlab_runner_index
loop_var: gitlab_runner
- name: (Windows) Remove runner config
win_file:
path: "{{ temp_runner_config.path }}"
state: absent
when:
- ('name = "'+gitlab_runner.name|default(ansible_hostname+'-'+gitlab_runner_index|string)+'"') in runner_config
- gitlab_runner.state|default('present') == 'absent'
loop: "{{ gitlab_runner_runners }}"
loop_control:
index_var: gitlab_runner_index
loop_var: gitlab_runner