Hello,
I have group_vars/all/timezone.yml including variable host_timezone and below playbook is the answer, but I don't know how this playbook find a group_vars/all/timezone.yml file without vars_files.
--- - name: Time Synchronization hosts: database_servers roles: - rhel-system-roles.timesync post_tasks: - name: Set timezone timezone: name: "{{ host_timezone }}" notify: reboot host handlers: - name: reboot host reboot:
Hi @spurs
This is a good question and it can be explained by the Ansible variable precedence: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variab...
Ansible already expects that what it finds in group_vars and host_vars files or directories are variables, so you don't need to declare them in vars_files.
thank you! but i need to use vars_files when my variable files are in the vars folder?
Hi @spurs
This is a good question and it can be explained by the Ansible variable precedence: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#understanding-variab...
thank you!
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.