Skip to content

Commit

Permalink
Add requested changes
Browse files Browse the repository at this point in the history
Signed-off-by: rsuplina <[email protected]>
  • Loading branch information
rsuplina committed Dec 1, 2023
1 parent 533fd77 commit b564b9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
4 changes: 3 additions & 1 deletion roles/assemble_template/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@

---

assemble_template_json_regex_pattren : '.*\.json$'
# cluster_template_fragments_regex: '.*\.json$'
cluster_template_fragments_directory: "{{ mandatory }}"
cluster_template_file: "{{ mandatory }}"
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,22 @@

argument_specs:
main:
short_description: "Discover fragment files, template them, and create a cluster template"
description:
- "This role performs the following tasks:"
- " Discovers fragment files in a specified directory, creates a temporary directory, loops through fragment files, templates them, and places them in the temporary directory,"
- " assembles a cluster template from the templated files and then it removes the temporary directory"

author: "Ronald Suplina"
short_description: "Discover and render files into a cluster template"
description: |
Discovers fragment files in a specified directory, loops through fragment files
rendering them through M(ansible.builtin.template), places them in a temporary directory,
and then assembles a single, final cluster template.
author: "Ronald Suplina <[email protected]>"
options:
cluster_template_fragments_directory:
description: "Path to the directory containing fragment files for the cluster template"
type: "str"
type: "path"
required: true

cluster_template_destination_directory:
description: "Destination directory for the assembled cluster template"
type: "str"
cluster_template_file:
description: "Destination of the assembled cluster template"
type: "path"
required: true

assemble_template_json_regex_pattern:
cluster_template_fragments_regex:
description: "Regex pattern for filtering fragment files (optional)"
type: "str"
required: false
required: false
6 changes: 3 additions & 3 deletions roles/assemble_template/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

- name: Discover fragment files
ansible.builtin.find:
paths: "{{ cluster_template_fragments_directory | mandatory }}"
patterns: "{{ assemble_template_json_regex_pattren | default(omit) }}"
paths: "{{ cluster_template_fragments_directory }}"
patterns: "{{ cluster_template_fragments_regex | default(omit) }}"
use_regex: yes
recurse: yes
register: fragments
Expand All @@ -40,7 +40,7 @@
- name: Create cluster template
cloudera.cluster.assemble_cluster_template:
src: "{{ fragments_temp_directory.path }}"
dest: "{{ cluster_template_destination_directory | mandatory }}"
dest: "{{ cluster_template_file }}"

- name: Remove temporary directory
ansible.builtin.file:
Expand Down

0 comments on commit b564b9a

Please sign in to comment.