Create a fact with the hash of the latest commit of Ansible repo

certbot_on_virtu
_pollion 2019-12-17 18:16:35 +01:00
parent f5e33e78fd
commit acf2ab3d0f
2 changed files with 24 additions and 0 deletions
roles/local-facts
templates/facts.d

View File

@ -0,0 +1,22 @@
---
- name: get git version
shell: git rev-parse HEAD
register: git_version
delegate_to: 127.0.0.1
become: False
- name: Create local_fact directory
file:
path: /etc/ansible/facts.d/
state: directory
- name: Create hash.fact file
file:
path: /etc/ansible/facts.d/hash.fact
state: touch
- name: Update latest commit hash
template:
src: facts.d/hash.fact.j2
dest: /etc/ansible/facts.d/hash.fact
mode: 0644

View File

@ -0,0 +1,2 @@
[commit]
latest_commit_hash: {{ git_version.stdout }}