[chef] Re: Re: Re: Re: Force recipe to run at the end


Chronological Thread 
  • From: Julien Vehent < >
  • To: < >
  • Subject: [chef] Re: Re: Re: Re: Force recipe to run at the end
  • Date: Tue, 25 Sep 2012 22:02:12 -0400

On 2012-09-22 23:08, Phil Dibowitz wrote:
On 09/22/2012 05:22 PM, Julien Vehent wrote:

    def foo()
      # add server to outbound firewall rules
      node['afw']['rules']\
          ["Haproxy local LB to #{server['hostname']}:#{port}"] = {
            'protocol' => 'tcp',
            'direction' => 'out',
            'user' => 'haproxy',
            'destination' => "#{server['hostname']}",
            'dport' => "#{port}"
          }
    end

OK, so that's fine, you're adding to the node object, which you have access
to
from the template. Don't pass that data into the template via "variables",
just access node directly in the template ERB and you have access to all the
data added anywhere in any cookbook.


Thanks. I updated the cookbook: http://community.opscode.com/cookbooks/afw
One thing that I'm not 100% comfortable with (despite the great help on #chef) is how to export a single function from a given module to other cookbooks. In this case, I have AFW.create_rule() that simply calls the internal function AFWCore.process_rule(). I'm guessing this could be done better, but being primarily a sysadmin/security and not really a rubyist, I'm not sure how.

Advices and comments are most welcome. The github repos is here: https://github.com/jvehent/AFW/


Cheers,
Julien



Archive powered by MHonArc 2.6.16.

§