diff --git a/roles/tripleo-hieradata/tasks/all_hosts.yaml b/roles/tripleo-hieradata/tasks/all_hosts.yaml deleted file mode 100644 index 6bb1448a8..000000000 --- a/roles/tripleo-hieradata/tasks/all_hosts.yaml +++ /dev/null @@ -1,8 +0,0 @@ -- name: Copy hieradata files - copy: - dest: /etc/puppet/hieradata/{{ item.key }}.json - mode: 0600 - content: "{{ item.value }}" - loop: "{{ hieradata_content['datafiles'] | default({})| dict2items }}" - loop_control: - label: "{{ item.key }}" diff --git a/roles/tripleo-hieradata/tasks/main.yaml b/roles/tripleo-hieradata/tasks/main.yaml index 16f143ba8..18025d795 100644 --- a/roles/tripleo-hieradata/tasks/main.yaml +++ b/roles/tripleo-hieradata/tasks/main.yaml @@ -18,56 +18,4 @@ :json: :datadir: /etc/puppet/hieradata :hierarchy: - {{ hieradata_files }} - -- 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 }}" - -# hieradata_content needs to be formed an hash where each key is a datafile -# and the value is the hieradata to write in this datafile. -# -# Example: -# -# extraconfig: -# foo: bar -# foo2: bar2 -# other_hierafile: -# foo: bar3 -- name: Copy hieradata files for all hosts - when: hieradata_template != "" and not hieradata_per_host|bool - ignore_errors: yes - include: all_hosts.yaml - vars: - hieradata_content: "{{ lookup('file', hieradata_template ~ '.rendered') | from_yaml }}" - -# hieradata_content needs to be formed an hash where each key is a host composed -# of datafiles and the value for each datafile is the hieradata to write in it. -# -# Example: -# -# controller1: -# extraconfig: -# foo: bar -# foo2: bar2 -# other_hierafile: -# foo: bar3 -# controller2: -# extraconfig: -# foo: bar2 -# foo2: bar3 -# other_hierafile: -# foo: bar -- name: Copy hieradata files per host - when: hieradata_template != "" and hieradata_per_host|bool - ignore_errors: yes - include: per_host.yaml host={{ inventory_hostname }} data={{ hieradata_content[inventory_hostname] }} - vars: - hieradata_content: "{{ lookup('file', hieradata_template ~ '.rendered') | from_yaml }}" + {{ hieradata_files | to_nice_yaml if hieradata_files | type_debug == 'list' else hieradata_files }} diff --git a/roles/tripleo-hieradata/tasks/per_host.yaml b/roles/tripleo-hieradata/tasks/per_host.yaml deleted file mode 100644 index 026583e10..000000000 --- a/roles/tripleo-hieradata/tasks/per_host.yaml +++ /dev/null @@ -1,9 +0,0 @@ -- name: Copy hieradata for host {{ host }} - copy: - dest: "/etc/puppet/hieradata/{{ filename }}.json" - mode: 0600 - content: "{{ data['datafiles'][filename] }}" - loop: "{{ data['datafiles'] | list }}" - loop_control: - loop_var: filename - when: "'datafiles' in data"