How do you source the vars file? You have two options. A vars_files directive before the tasks section.
vars_files: - your_vars_file.yml A task that explicitly includes a vars file. include_vars: file: your_vars_file.yml There are other variants of this so read the docs on the ansible website. Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123 On Oct 25, 2022, at 10:58 AM, Jacquelin C <[email protected]<mailto:[email protected]>> wrote: Hello team, I would like to use variables in a vars file, like this : ############## --- # file vars/users.yml timestamp: sep2023: 1693864800 # date --date=09/05/2023 +%s users: a_user: name: a_user passwd: $6$FF.DN/vbue.2i9/vla6h8xpZhx4L/dppBbnnCWN8hZ0 uid: 3007 comment: log receiver expires: '{{timestamp.sep2023}}' ############## but when load the file with ansible.builtin.include_vars I get the error : timestamp' is undefined How can i do that ? -- 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]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/d8b1759f-8f14-419b-baf9-d33809283298n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2Fd8b1759f-8f14-419b-baf9-d33809283298n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cbf00d5eba20c44da0e6b08dab6995434%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638023066907532456%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KohOssLC6V%2BPm5Gm5e%2BhK2TrzqUw0vVPIsnGXtQD%2B9A%3D&reserved=0>. -- 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/37C539F3-623C-4FC3-8DC0-B2CF28DC8667%40nist.gov.
