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

14 lines
579 B
YAML

---
- 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