Skip to content

Instantly share code, notes, and snippets.

@sigio
Created June 15, 2022 12:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sigio/0e4217bf5fe5bc4494df691dcfdb545e to your computer and use it in GitHub Desktop.
Save sigio/0e4217bf5fe5bc4494df691dcfdb545e to your computer and use it in GitHub Desktop.
At the end of every role:
- import_tasks: "common_tasks/update_localfacts.yaml"
And in that file:
---
- name: update localfacts
ini_file:
path: "/etc/ansible/facts.d/custom.fact"
section: "deployedroles"
option: "{{ ansible_role_name }}"
value: "{{ ansible_date_time.iso8601 }}"
mode: "0644"
owner: "root"
group: "root"
changed_when: false
# Don't report as changed, as it always changes, and is no functional change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment