- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,701 Views
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:
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,634 Views
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,657 Views
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,580 Views
thank you! but i need to use vars_files when my variable files are in the vars folder?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,635 Views
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,580 Views
thank you!