f8f74e11ce
Currently there isn't a good way to pass dynamic information from ansible to puppet to end up in the configuration. This change adds an ansible_managed hierafile that can be updated via ansible to pass dynamic variables into a future puppet execution. An example playbook would be: - name: Set my data set_fact: my_data: foo - name: Add my_data to hieradata include_role: name: tripleo_hieradata tasks_from: ansible_hierdata.yml vars: hieradata_ansible_data: my_magical_var: "{{ my_data }}" The puppet code that would be executed later would just be: class myclass( $my_data = lookup('my_magical_var', 'bar') ) { file { '/var/tmp/data': ensure = present, content = $my_data } } Change-Id: I52ba520dbdd97b25cb093f7e09609e6e1797e3a1
61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
---
|
|
# Copyright 2019 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
|
|
# `hieradata_content` can be formatted for all hosts or for specific hosts
|
|
# containing potentially different values.
|
|
#
|
|
# Host specific example:
|
|
#
|
|
# controller1:
|
|
# extraconfig:
|
|
# foo: bar
|
|
# foo2: bar2
|
|
# other_hierafile:
|
|
# foo: bar3
|
|
# controller2:
|
|
# extraconfig:
|
|
# foo: bar2
|
|
# foo2: bar3
|
|
# other_hierafile:
|
|
# foo: bar
|
|
#
|
|
#
|
|
# Global format example:
|
|
#
|
|
# extraconfig:
|
|
# foo: bar
|
|
# foo2: bar2
|
|
# other_hierafile:
|
|
# foo: bar3
|
|
#
|
|
hieradata_template: ""
|
|
hieradata_files: []
|
|
# jinja2 escape trick for simple {{ and }} strings:
|
|
hieradata_variable_start_string: "{{ '{{' }}"
|
|
hieradata_variable_end_string: "{{ '}}' }}"
|
|
hieradata_per_host: false
|
|
hieradata_templates_list:
|
|
- bootstrap_node
|
|
- all_nodes
|
|
- vip_data
|
|
# define a local address. If the ipv6 is found to be enable on the
|
|
# loopback device the local address will be set to "localhost" otherwise
|
|
# the local address will be defined as "127.0.0.1".
|
|
hieradata_localhost_address: "{{ ('ipv6' in (ansible_lo | default({}))) | ternary('localhost', '127.0.0.1') }}"
|
|
# file included in hieradata hierarchy for ansible to pass data to puppet
|
|
hieradata_ansible_file: /etc/puppet/hieradata/ansible_managed.json
|