cancel
Showing results for 
Search instead for 
Did you mean: 
Ravi_Shanker
Flight Engineer
Flight Engineer
  • 686 Views

RH294v9k Chapter 10 Section 10.5: Lab: Creating Roles

Jump to solution

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

Certification ID: 111-010-393
Labels (2)
0 Kudos
1 Solution

Accepted Solutions
Ravi_Shanker
Flight Engineer
Flight Engineer
  • 434 Views

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.

Certification ID: 111-010-393

View solution in original post

0 Kudos
1 Reply
Ravi_Shanker
Flight Engineer
Flight Engineer
  • 435 Views

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.

Certification ID: 111-010-393
0 Kudos
Join the discussion
You must log in to join this conversation.