In the RHLS training for RH294v9k the last lab for role creation has a variable mentioned in the playbook which has to be moved to appropriate roles yml file.
I have moved the variable values in defaults/main.yml where as the check script is expecting it in vars/main.yml file for the role..
I am trying to understand why vars/main.yml is considered the correct answer when the same result can be achieved by putting in defaults/main.yml as well. Would it not be just a case of variable precedence?
Looking forward to explanations for the right answer considered as vars/main.yml and why not defaults/main.yml ?
Thanks in Advance
Ravi Shanker
I got the answer to my query. The README.md mentions.
------------------------------------------------------------------------------------------------
Role Variables
--------------
* defaults/main.yml contains variables used to configure the httpd.conf template
* vars/main.yml contains the name of the httpd service, the name of the RPM
package, the location of the service's configuration file, and the name of the firewall service.
------------------------------------------------------------------------------------------------
Since there is no variable in templates files the defaults/main.yml is empty and not required. Rest all variabled go in vars/main.yml.
Sorry my bad, missed the fine print in exercise.
I got the answer to my query. The README.md mentions.
------------------------------------------------------------------------------------------------
Role Variables
--------------
* defaults/main.yml contains variables used to configure the httpd.conf template
* vars/main.yml contains the name of the httpd service, the name of the RPM
package, the location of the service's configuration file, and the name of the firewall service.
------------------------------------------------------------------------------------------------
Since there is no variable in templates files the defaults/main.yml is empty and not required. Rest all variabled go in vars/main.yml.
Sorry my bad, missed the fine print in exercise.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.