Pass a variable from bash into chef template

Umesh Moghariya

In my chef recipe, I have a bash ruby block. I need some value generated from it passed to my templates. For example, the joke variable in here:

bash "create opal user" do
 code <<-EOH                                                                                                                                                
  joke='my funny joke'
  echo $joke
 EOH
end


template '/joke.txt' do
  source 'joke.txt.erb'
  variable(joke:"#{joke}")
end
coderanger

Answered in IRC, Chef doesn't work like this in general. The shell_out helper can sometimes be used but overall you should try to not structure your recipes this way.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Pass variable from awk to bash

From Dev

How to set a variable in a chef template?

From Dev

pass variable from controller to template laravel

From Dev

AngularJS pass variable from custom directive to template

From Dev

Pass variable from javascript to django template

From Dev

Meteor pass a dynamic variable from template to helper

From Dev

How to pass a variable from Express to a Jade template

From Dev

Pass variable from applescript to executable bash file

From Dev

How to pass a variable from bash to regex

From Dev

Pass a variable from bash script to a makefile

From Dev

Pass the variable and value from python to bash

From Dev

Setting chef vault variable in template.erb

From Dev

Pass variable to template callback

From Dev

Pass variable to component template

From Dev

Pass a variable to the next template

From Dev

pass custom variable/parameter from email template to phtml file

From Dev

How to pass variable from kendo grid to template function

From Dev

How to pass variable from jade-loader to a jade template file?

From Dev

How to pass JavaScript variable from Django-object in html template?

From Dev

How to pass a variable from python Django to HTML template

From Dev

pass custom variable/parameter from email template to phtml file

From Dev

Pass PHP variable from html to php and email template

From Dev

How to pass a variable in PHP/Wordpress from child template to parent

From Dev

How to pass variable from view page to base template

From Dev

Pass a variable by reference from Angular2 template

From Dev

Chef: append to an exsting file from an "erb" template

From Dev

Pass empty variable in bash

From Dev

Is there a way to pass a variable from an awk statement to a bash function as an argument?

From Dev

How to pass quoted arguments from variable to bash script

Related Related

  1. 1

    Pass variable from awk to bash

  2. 2

    How to set a variable in a chef template?

  3. 3

    pass variable from controller to template laravel

  4. 4

    AngularJS pass variable from custom directive to template

  5. 5

    Pass variable from javascript to django template

  6. 6

    Meteor pass a dynamic variable from template to helper

  7. 7

    How to pass a variable from Express to a Jade template

  8. 8

    Pass variable from applescript to executable bash file

  9. 9

    How to pass a variable from bash to regex

  10. 10

    Pass a variable from bash script to a makefile

  11. 11

    Pass the variable and value from python to bash

  12. 12

    Setting chef vault variable in template.erb

  13. 13

    Pass variable to template callback

  14. 14

    Pass variable to component template

  15. 15

    Pass a variable to the next template

  16. 16

    pass custom variable/parameter from email template to phtml file

  17. 17

    How to pass variable from kendo grid to template function

  18. 18

    How to pass variable from jade-loader to a jade template file?

  19. 19

    How to pass JavaScript variable from Django-object in html template?

  20. 20

    How to pass a variable from python Django to HTML template

  21. 21

    pass custom variable/parameter from email template to phtml file

  22. 22

    Pass PHP variable from html to php and email template

  23. 23

    How to pass a variable in PHP/Wordpress from child template to parent

  24. 24

    How to pass variable from view page to base template

  25. 25

    Pass a variable by reference from Angular2 template

  26. 26

    Chef: append to an exsting file from an "erb" template

  27. 27

    Pass empty variable in bash

  28. 28

    Is there a way to pass a variable from an awk statement to a bash function as an argument?

  29. 29

    How to pass quoted arguments from variable to bash script

HotTag

Archive