From 102dccc2346499220e2dd9b66fbf77864a63742c Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Tue, 6 Aug 2019 09:08:47 +0530 Subject: [PATCH] Remove hieradata ansible tasks for datafiles Depends-On: https://review.opendev.org/673731 Change-Id: I84e2ff3f25b311236ac94f3f4df270d600e59ac5 --- roles/tripleo-hieradata/tasks/all_hosts.yaml | 8 --- roles/tripleo-hieradata/tasks/main.yaml | 54 +------------------- roles/tripleo-hieradata/tasks/per_host.yaml | 9 ---- 3 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 roles/tripleo-hieradata/tasks/all_hosts.yaml delete mode 100644 roles/tripleo-hieradata/tasks/per_host.yaml 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"