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

15 lines
579 B
YAML
Raw Normal View History

2021-02-13 14:20:18 +01:00
---
- name: Ensure section exists
lineinfile:
path: "{{ temp_runner_config.path }}"
regexp: '^(\s*)\[{{ section|regex_escape }}\]$'
line: '{{ " " * (section.split(".")|length -1) }}[{{ section }}]'
- name: Modify existing line
lineinfile:
path: "{{ temp_runner_config.path }}"
insertafter: '\s+\[{{ section | regex_escape }}\]'
regexp: '^(\s*){{ line | to_json | regex_escape }} ='
line: '{{ " " * (section.split(".")|length) }}{{ line | to_json }} = {{ gitlab_runner.extra_configs[section][line] | to_json }}'
register: modified_config_line