tobiko/roles/tobiko/tasks/pre/config.yaml

48 lines
1.3 KiB
YAML

---
- become: yes
become_user: root
block:
- name: "flattern tobiko configuration"
set_fact:
tobiko_conf_yaml: |
{% for section, options in (sections.items() | sort) %}
{% for option, value in (options.items() | sort) %}
- section: "{{ section }}"
option: "{{ option }}"
value: "{{ value }}"
{% endfor %}
{% endfor %}
vars:
sections: "{{ tobiko_default_conf | combine(tobiko_conf, recursive=True) }}"
- name: "show tobiko configuration"
debug:
msg: |
Tobiko configuration:
{{ tobiko_conf_yaml }}
- name: "provide {{ tobiko_conf_file }} file"
ini_file:
path: "{{ tobiko_conf_file }}"
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
owner: root
mode: '0644'
when:
- item.section
- item.option
- item.value
loop: "{{ tobiko_conf_yaml | from_yaml | list }}"
- name: "read {{ tobiko_conf_file }} file"
slurp:
src: "{{ tobiko_conf_file }}"
register: read_tobiko_conf_file
- name: "show {{ tobiko_conf_file }} file"
debug:
msg: "{{ read_tobiko_conf_file['content'] | b64decode }}"