Ansible templates with timestamps -


i'm trying figure out if there's way of adding timestamp template file in ansible everytime run ansible playbook uses template, adds in destination file time of execution of playbook.

for example, i'm templating configuration file ansible , want on destination machine appear timestamp on first line...

e.g.

cat something.conf_template config lines 

after templating:

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

the contents should be

cat something.conf #in comment timestamp, format irrelevant config lines 

do know ansible module can this?

you can add # {{ ansible_managed }} top of template. variable defined in configuration file have default of:

ansible managed: {file} modified on %y-%m-%d %h:%m:%s {uid} on {host}

note since contains timestamp default means every time template task invoked update destination file current timestamp.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -