Remove hieradata ansible tasks for datafiles

Depends-On: https://review.opendev.org/673731
Change-Id: I84e2ff3f25b311236ac94f3f4df270d600e59ac5
This commit is contained in:
Rabi Mishra 2019-08-06 09:08:47 +05:30
parent 9a25d23d09
commit 102dccc234
3 changed files with 1 additions and 70 deletions

View File

@ -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 }}"

View File

@ -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 }}

View File

@ -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"