Guest User

Untitled

a guest
Jul 26th, 2017
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. Hi, My goal is to display the vars using hiera MODULE level.
  2.  
  3. Here is my module structure and code.
  4.  
  5. directory/file: /etc/puppetlabs/code/environments/production/modules/sshd/manifests/init.pp
  6. ===============
  7.  
  8. class sshd (
  9. String $autoupdate,
  10. String $service_name,
  11. ) {
  12. exec { 'print vars on console':
  13. path => '/bin',
  14. command => "echo service Name: ${service_name}",
  15. logoutput => true,
  16. }
  17. }
  18.  
  19. directory/file: /etc/puppetlabs/code/environments/production/modules/sshd/hiera.yaml
  20. =================
  21. ---
  22. version: 5
  23. defaults:
  24. datadir: data
  25. data_hash: yaml_data
  26. hierarchy:
  27. - name: "OS family"
  28. path: "os/%{facts.os.family}.yaml"
  29.  
  30. - name: "common"
  31. path: "common.yaml"
  32.  
  33.  
  34. directory/file: /etc/puppetlabs/code/environments/production/modules/sshd/hieradata/common.yaml
  35. =================
  36.  
  37. ---
  38. sshd::autoupdate: false
  39. sshd::service_name: ntpd
  40.  
  41.  
  42. But when Im running the script from agent, It is displaying error like
  43.  
  44. Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Class[Sshd]:
  45. expects a value for parameter 'autoupdate'
  46. expects a value for parameter 'service_name' at /etc/puppetlabs/code/environments/production/manifests/site.pp:6:3 on node puppetclient.
  47.  
  48. file: /etc/puppetlabs/code/environments/production/manifests/site.pp
  49. =======
  50. node default {
  51. include file_test
  52. include jira
  53. include profile::hiera_test
  54. include user::create_user
  55. include sshd
  56. }
  57.  
  58. Question: why it is taking vars from hiera.yaml which is defined at "/etc/puppetlabs/code/environments/production/hieradata/common.yaml" butnot from "/etc/puppetlabs/code/environments/production/modules/sshd/hieradata/common.yaml"
  59.  
  60. file: /etc/puppetlabs/code/environments/production/hieradata/common.yaml
  61. ===========
  62. ---
  63. profile::hiera_test::ssl: false
  64. profile::hiera_test::backups_enabled: true
  65. user::create_user::username: sriman
  66. user::create_user::password: sriman
  67. #sshd::autoupdate: "false"
  68. #sshd::service_name: "sshd"
Add Comment
Please, Sign In to add comment