Better header

Updates according to file rather than repository
certbot_on_virtu
_benjamin 2021-02-10 19:18:04 +01:00
parent 52d0d6ebce
commit ff864b50a1
1 changed files with 6 additions and 2 deletions

View File

@ -1,15 +1,19 @@
--- ---
# Custom header # Custom header
dirty: "{{lookup('pipe', 'git diff --quiet || echo dirty')}}" dirty: "{% if template_path is defined %}{{ lookup('pipe', 'git diff --quiet -- ' + template_path | quote + ' || echo dirty') }}{% else %}{{ lookup('pipe', 'git diff --quiet || echo dirty') }}{% endif %}"
ansible_header: | ansible_header: |
+++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++
Ansible managed, don't modify the file locally. Ansible managed, don't modify the file locally.
See https://gitlab.crans.org/nounous/ansible. See https://gitlab.crans.org/nounous/ansible.
{% if template_path is defined %}{% set _, rpath = template_path.split('roles/', 1) %}Commit: {% if dirty %}({{dirty}}) {% endif %}{{ lookup('pipe', 'git log -n 1 --pretty=format:%H -- ' + template_path | quote) }}
{% if dirty %}Run by: {{ ansible_env.SUDO_USER }}
{% else %}Author: {{ lookup('pipe', 'git log -n 1 --pretty=format:%an -- ' + template_path | quote) }}
{% endif %}Template: roles/{{ rpath }}
{% else %}
Run by: {{ ansible_env.SUDO_USER }} Run by: {{ ansible_env.SUDO_USER }}
Latest commit: {% if dirty %}({{dirty}}) {% endif %}{{ lookup('pipe', 'git rev-parse HEAD') }} Latest commit: {% if dirty %}({{dirty}}) {% endif %}{{ lookup('pipe', 'git rev-parse HEAD') }}
{% if template_path is defined %}{% set _, rpath = template_path.split('roles/') %}Template: roles/{{ rpath }}
{% endif %} {% endif %}
+++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++