You are using shell command inside an ansible vars file. That will not work. Take a look at https://docs.ansible.com/ansible/latest/collections/ansible/builtin/strftime_filter.html
On Thu, 23 Mar 2023 at 10:58, dulhaver via Ansible Project <[email protected]> wrote: > > I am trying to define a variable in defaults.yml with some kind of dynamic. > Conrete creating a directory with the current timestamp at the end of the > name. > > data_dir: /file/to/dir_$(date +%F_%H%M%S) > > gives me exactly the directory name 'dir_$(date +%F_%H%M%S)' and not > dir_2023_03_23_115122. > > How can I achieve such? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/403472752.247990.1679565525283%40office.mailbox.org. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLb-QBXJpjBwwXbZR84NCVh7eXFCAgcpEok4tXt2uCahRQ%40mail.gmail.com.
