Skip to content

Commit

Permalink
fix git lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jun 26, 2025
1 parent 0cba97d commit ad1c8e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ansible/generate_hcl_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
base_dir: "{{ playbook_dir }}/.."
template_dir: "{{ playbook_dir }}/templates"
output_dir: "{{ base_dir }}"
commit_id: "{{ lookup('git', 'rev-parse HEAD') }}"

# Extract current structure
current:
Expand All @@ -27,6 +26,16 @@
cluster_dir: "cluster"

tasks:
- name: Get git commit ID
ansible.builtin.shell: git rev-parse HEAD
register: git_commit_result
changed_when: false
failed_when: false

- name: Set commit ID variable
ansible.builtin.set_fact:
commit_id: "{{ git_commit_result.stdout | default('unknown') }}"

- name: Check if config file exists
ansible.builtin.stat:
path: "{{ config_file }}"
Expand Down Expand Up @@ -86,6 +95,7 @@
module_enablement_overrides: "{{ config.cluster.module_enablement_overrides | default({}) }}"
# README template variables
generated_date: "{{ ansible_date_time.iso8601 }}"
commit_id: "{{ commit_id }}"

- name: Print directory configuration
ansible.builtin.debug:
Expand Down

0 comments on commit ad1c8e2

Please sign in to comment.