37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
---
|
|
- name: Create temporary file
|
|
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: Isolate runner configuration
|
|
copy:
|
|
dest: "{{ temp_runner_config.path }}"
|
|
content: "{{ runner_config }}"
|
|
check_mode: no
|
|
changed_when: false
|
|
|
|
- include_tasks: update-config-runner.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: Remove runner config
|
|
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
|