diff --git a/roles/tobiko/defaults/main.yaml b/roles/tobiko/defaults/main.yaml index ae6299a97..1c2256764 100644 --- a/roles/tobiko/defaults/main.yaml +++ b/roles/tobiko/defaults/main.yaml @@ -16,23 +16,13 @@ tobiko_user: "{{ ansible_user }}" # Configuration options tobiko_conf_file: /etc/tobiko/tobiko.conf -tobiko_conf_options: +tobiko_default_conf: + DEFAULT: + debug: "{{ tobiko_debug }}" + log_dir: "{{ tobiko_log_file | dirname }}" + log_file: "{{ tobiko_log_file | basename }}" - - section: DEFAULT - option: debug - value: "{{ tobiko_debug }}" - - - section: DEFAULT - option: log_dir - value: "{{ tobiko_log_file | dirname }}" - - - section: DEFAULT - option: log_file - value: "{{ tobiko_log_file | basename }}" - - - section: keystone - option: cloud_name - value: "{{ tobiko_cloud_name }}" +tobiko_conf: {} # Logging options @@ -40,10 +30,6 @@ tobiko_debug: True tobiko_log_file: "{{ tobiko_dir }}/tobiko.log" -# Keystone options: -tobiko_cloud_name: "" - - # Output directories where tobiko should write to tobiko_output_dirs: - "{{ tox_dir }}" diff --git a/roles/tobiko/tasks/pre/config.yaml b/roles/tobiko/tasks/pre/config.yaml index 0e9da7f7a..c1391766c 100644 --- a/roles/tobiko/tasks/pre/config.yaml +++ b/roles/tobiko/tasks/pre/config.yaml @@ -4,16 +4,32 @@ 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) }}" + - name: "provide {{ tobiko_conf_file }} file" ini_file: path: "{{ tobiko_conf_file }}" - section: '{{ item.section }}' - option: '{{ item.option }}' - value: '{{ item.value }}' + section: "{{ item.section }}" + option: "{{ item.option }}" + value: "{{ item.value }}" owner: root mode: '0644' - loop: "{{ tobiko_conf_options }}" - when: item.value + when: + - item.section + - item.option + - item.value + loop: "{{ tobiko_conf_yaml | from_yaml | list }}" - name: "read {{ tobiko_conf_file }} file" slurp: