How to use the output of a command inside ansible ini_file value

Solution 1:

Ansible can generate its own date and time strings and do its own MD5 sums without calling out to external programs. Consider:

---
- hosts: localhost
  connection: local
  tasks:
    - debug:
        msg: "{{ ansible_date_time.iso8601 | hash('md5') }}"

Note that ansible_date_time contains the last time you gathered facts from the remote server, not necessarily the current time. If you always gather facts on every playbook run, then this should not be a problem.