Skip to content

Commit

Permalink
Add changes to run ansible.builtin.template locally (#170)
Browse files Browse the repository at this point in the history
* Add changes to run a.b.template locally
* Add update to documentation

Signed-off-by: rsuplina <[email protected]>
  • Loading branch information
rsuplina authored Dec 15, 2023
1 parent b5b5c88 commit 539d9a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roles/assemble_template/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ argument_specs:
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.
Fragment files must be located on the Ansible controller since M(ansible.builtin.template) only executes on the controller.
This ensures that the template processing occurs on the Ansible controller machine.
author: "Ronald Suplina <[email protected]>"
options:
cluster_template_fragments_directory:
Expand Down
3 changes: 3 additions & 0 deletions roles/assemble_template/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
use_regex: yes
recurse: yes
register: fragments
delegate_to: localhost

- name: Create a temporary directory
ansible.builtin.tempfile:
state: directory
register: fragments_temp_directory
delegate_to: localhost

- name: Loop through fragment files and template them
ansible.builtin.template:
Expand All @@ -36,6 +38,7 @@
loop_var: __fragment
label: "{{ __fragment.path | basename }}"
when: fragments.matched > 0
delegate_to: localhost

- name: Create cluster template
cloudera.cluster.assemble_cluster_template:
Expand Down

0 comments on commit 539d9a3

Please sign in to comment.