-
Notifications
You must be signed in to change notification settings - Fork 281
/
Copy pathline-config-runner-windows.yml
24 lines (22 loc) · 1.15 KB
/
line-config-runner-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
---
- name: "Ensure section exists {{ line_name_prefix }}"
community.windows.win_lineinfile:
path: "{{ temp_runner_config.path }}"
regexp: ^(\s*)\[{{ section | regex_escape }}\]$
line: '{{ " " * (section.split(".") | length - 1) }}[{{ section }}]'
- name: "Modify existing line {{ line_name_prefix }}"
community.windows.win_lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: \s+\[{{ section | regex_escape }}\]
regexp: ^(\s*)({{ line | regex_escape }}|{{ line | regex_escape }}) =.*
line: '{{ " " * (section.split(".") | length) }}{{ line }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line
when: not '.' in line
- name: "Modify existing line to_json {{ line_name_prefix }}"
community.windows.win_lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: \s+\[{{ section | regex_escape }}\]
regexp: ^(\s*)({{ line | to_json | regex_escape }}|{{ line | regex_escape }}) =.*
line: '{{ " " * (section.split(".") | length) }}{{ line | to_json }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line
when: "'.' in line"