Simple timestamped templates

I'm trying to figure out if there is a way to add a timestamp to the template file in Ansible so that every time I run the Ansible boot book that uses a specific template, it adds a playbook to the target file.

For example, I create a template configuration file using Ansible, and I want it to appear on the destination machine with a timestamp in the first line ...

eg.

cat something.conf_template
some config lines

After the templates:

- template: src=/mytemplates/something.conf_template dest=/etc/something.conf owner=smth group=smth mode=0644

content should be

cat something.conf
#in this comment is the timestamp, format irrelevant
some config lines

Do you know any module that can do this?

+4
source share
1 answer

# {{ ansible_managed }} . , :

Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host}

, , , , , .

+5

Source: https://habr.com/ru/post/1609620/


All Articles