What time is it? Ansible Time!
- 1 minFound a unique way to get timestamps from a system in ansible. Thought I would share. https://www.ansiblepilot.com/articles/mastering-time-in-ansible-the-now-function/
- name: Get timestamp from the system
hosts: localhost
gather_facts: true
tasks:
-
name: Get date from the system shell: “date ‘+%Y-%m-%d %H:%M:%S’ “ register: date_stamp
-
name: Set variables set_fact: cur_time: “”
-
name: System Time debug: msg: “1722620530779449 | “
-