ok that works to some extent. But I probably seem to need someting not toooo dynamic after all :-/
I did not get this entirely when we started. I need to create the variable value once at the beginning of the playbook but need to get back to it later down the road with the same initial value. So more like it works inside a bash script (despite the fact it's a playbook). I can think of a workaround for my current task, but still would be wondering whether this can be done. > On 03/23/2023 11:18 AM CET Dick Visser <[email protected]> wrote: > > > 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. --- gunnar wagner | fichtestr. 1, 19386 lübz | fon: 0176 7808 9090 -- 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/528456589.310414.1679591958435%40office.mailbox.org.
