Don't use custom vars for hiera_data

The scope in an ansible execution is global, which means the hiera
module has access to the variables set in the execution. We don't need
to wrap the hiera_data variables.

Change-Id: Iec87c5c6e2d98aefc93d6f8726ad0ff5b0adaa4f
This commit is contained in:
Flavio Percoco 2017-11-01 06:51:01 +01:00 committed by Flavio Percoco
parent fb28a5859d
commit feae1d9f83
2 changed files with 14 additions and 9 deletions

View File

@ -6,9 +6,6 @@ action: provision
service_name: mariadb
namespace: openstack
hiera_data: {}
hiera_data_file: ''
mariadb_config:
host: '{{service_name}}'
root_password: weakpassword

View File

@ -1,9 +1,7 @@
- name: Translate hieradata
include_role:
name: 'ansible-role-k8s-tripleo'
vars:
hieradata: '{{hiera_data}}'
hieradata_file: '{{hiera_data_file}}'
parse_tripleo_hiera:
hieradata_file: '{{ hieradata_file }}'
hieradata: '{{ hieradata }}'
schema:
tripleo::profile::base::database::mysql::bind_address: bind_address
tripleo::profile::base::database::mysql::mysql_server_options: mysql_server_options
@ -11,7 +9,17 @@
mysql_clustercheck_password: clustercheck_password
mysql_max_connections: mysql_max_connections
default: '{{mariadb_config}}'
fact_variable: 'mariadb_config'
when:
- hieradata or hieradata_file
- schema
register: result
- name: Set facts
set_fact:
mariadb_config: '{{result.conf_dict}}'
when:
- result.conf_dict is defined
- fact_variable != ''
- debug:
var: mariadb_config