Pass tobiko.conf changes using a dictionary
Pass tobiko.conf via a dictionary where sections are sub-dictionaries like below: section-1: option-1-1: value-1-1 option-1-2: value-1-2 section-2: option-2-1: value-2-1 Dictionary is flattered to a list before being consumed to update tobiko.conf file like below: - section: section-1 option: option-1-1 value: value-1-1 - section: section-1 option: option-1-2 value: value-1-2 # etc. Change-Id: I997a44de9ad4841197c8264a84039c034c823fe9
This commit is contained in:
parent
24d62a2609
commit
1f0bca4c20
@ -16,23 +16,13 @@ tobiko_user: "{{ ansible_user }}"
|
|||||||
|
|
||||||
# Configuration options
|
# Configuration options
|
||||||
tobiko_conf_file: /etc/tobiko/tobiko.conf
|
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
|
tobiko_conf: {}
|
||||||
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 }}"
|
|
||||||
|
|
||||||
|
|
||||||
# Logging options
|
# Logging options
|
||||||
@ -40,10 +30,6 @@ tobiko_debug: True
|
|||||||
tobiko_log_file: "{{ tobiko_dir }}/tobiko.log"
|
tobiko_log_file: "{{ tobiko_dir }}/tobiko.log"
|
||||||
|
|
||||||
|
|
||||||
# Keystone options:
|
|
||||||
tobiko_cloud_name: ""
|
|
||||||
|
|
||||||
|
|
||||||
# Output directories where tobiko should write to
|
# Output directories where tobiko should write to
|
||||||
tobiko_output_dirs:
|
tobiko_output_dirs:
|
||||||
- "{{ tox_dir }}"
|
- "{{ tox_dir }}"
|
||||||
|
@ -4,16 +4,32 @@
|
|||||||
become_user: root
|
become_user: root
|
||||||
block:
|
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"
|
- name: "provide {{ tobiko_conf_file }} file"
|
||||||
ini_file:
|
ini_file:
|
||||||
path: "{{ tobiko_conf_file }}"
|
path: "{{ tobiko_conf_file }}"
|
||||||
section: '{{ item.section }}'
|
section: "{{ item.section }}"
|
||||||
option: '{{ item.option }}'
|
option: "{{ item.option }}"
|
||||||
value: '{{ item.value }}'
|
value: "{{ item.value }}"
|
||||||
owner: root
|
owner: root
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
loop: "{{ tobiko_conf_options }}"
|
when:
|
||||||
when: item.value
|
- item.section
|
||||||
|
- item.option
|
||||||
|
- item.value
|
||||||
|
loop: "{{ tobiko_conf_yaml | from_yaml | list }}"
|
||||||
|
|
||||||
- name: "read {{ tobiko_conf_file }} file"
|
- name: "read {{ tobiko_conf_file }} file"
|
||||||
slurp:
|
slurp:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user