Add tripleo-hieradata role
The tripleo-hieradata ansible role will be used to copy hieradata files to nodes. It will be an initial replacement of the Heat SoftwareDeployment resources that use group:hiera. A followup patch will add support for configuring the hierarchy in /etc/puppet/hiera.yaml (as the Heat hook script does today). Change-Id: I28b5c2bedbba1c27da628c6bda4c7a57ca0f3ad7 implements: blueprint reduce-deployment-resources
This commit is contained in:
parent
6b7220639a
commit
ba3891b338
35
roles/tripleo-hieradata/README.md
Normal file
35
roles/tripleo-hieradata/README.md
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
tripleo-hieradata
|
||||||
|
=================
|
||||||
|
|
||||||
|
An Ansible role to hieradata files.
|
||||||
|
|
||||||
|
Role variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Required:
|
||||||
|
|
||||||
|
* `hieradata_template` -- path to template of hieradata content
|
||||||
|
* `hieradata_variable_start_string` -- string marking the beginning of a template print statement.
|
||||||
|
* `hieradata_variable_end_string` -- string marking the end of a template print statement.
|
||||||
|
|
||||||
|
Test playbook
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Assuming you have tripleo-inventory.yml generated, you can run the
|
||||||
|
test playbook like:
|
||||||
|
|
||||||
|
ANSIBLE_ROLES_PATH=tripleo-common/roles \
|
||||||
|
ANSIBLE_HOST_KEY_CHECKING=False \
|
||||||
|
ansible-playbook \
|
||||||
|
-i tripleo-inventory.yml \
|
||||||
|
tripleo-common/roles/tripleo-hieradata/test-playbook.yml
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
Free software: Apache License (2.0)
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
OpenStack TripleO team
|
3
roles/tripleo-hieradata/defaults/main.yaml
Normal file
3
roles/tripleo-hieradata/defaults/main.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
hieradata_template: ""
|
||||||
|
hieradata_variable_start_string: "{{"
|
||||||
|
hieradata_variable_end_string: "}}"
|
27
roles/tripleo-hieradata/tasks/main.yaml
Normal file
27
roles/tripleo-hieradata/tasks/main.yaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
- name: Create /etc/puppet/hieradata
|
||||||
|
file:
|
||||||
|
path: /etc/puppet/hieradata
|
||||||
|
state: directory
|
||||||
|
mode: 0700
|
||||||
|
|
||||||
|
- name: Template hieradata file
|
||||||
|
when: hieradata_template != ""
|
||||||
|
delegate_to: localhost
|
||||||
|
run_once: True
|
||||||
|
become: false
|
||||||
|
template:
|
||||||
|
src: "{{ hieradata_template }}"
|
||||||
|
dest: "{{ hieradata_template ~ '.rendered' }}"
|
||||||
|
variable_start_string: "{{ hieradata_variable_start_string }}"
|
||||||
|
variable_end_string: "{{ hieradata_variable_end_string }}"
|
||||||
|
|
||||||
|
- name: Copy hieradata files
|
||||||
|
copy:
|
||||||
|
dest: /etc/puppet/hieradata/{{ item.key }}.json
|
||||||
|
mode: 0600
|
||||||
|
content: "{{ item.value }}"
|
||||||
|
loop: "{{ hieradata_content['datafiles'] | dict2items }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
||||||
|
vars:
|
||||||
|
hieradata_content: "{{ lookup('file', hieradata_template ~ '.rendered') | from_yaml }}"
|
9
roles/tripleo-hieradata/test-playbook.yaml
Normal file
9
roles/tripleo-hieradata/test-playbook.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
- hosts: overcloud
|
||||||
|
tasks:
|
||||||
|
- name: test tripleo-hieradata
|
||||||
|
include_role:
|
||||||
|
name: tripleo-hieradata
|
||||||
|
vars:
|
||||||
|
hieradata_template: hieradata.j2.yaml
|
||||||
|
variable_start_string: "{{"
|
||||||
|
variable_end_string: "}}"
|
Loading…
Reference in New Issue
Block a user