What is the execution order in a manifest file

37 views
Skip to first unread message

Malintha Adikari

unread,
Jun 25, 2014, 8:04:16 AM6/25/14
to puppet...@googlegroups.com
Hi,

In my manifest file there are 3 elements ( 2 defined types and one exec)

define fill_templates($location) {
    file { "$location/$name/":
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0777',
        content => template("config/${name}.erb"),
}

}

fill_templates { $filelist: location=>$agentLocation}

exec { "unzip_pack":
command => "unzip ${product_pack}",
cwd => $agentLocation,
path      => $command_path,
logoutput => true,
timeout => 3600,
require => File["${agentLocation}/${product_pack}"],
}



$foo = [{"addr" => $source, "port" => $destination},                                    
          {"addr" => "bat", "port" => "2"}]  
                                 
  testmod::bar {$foo:}  
                                                      
  define testmod::bar () {                                                     
    $var1 = $name["addr"]                                                      
    $var2 = $name["port"]                                                      
    notify {"**********************${var1}_${var2}***********************************": }    

When I execute this manifest what is the order of the above 3 elements execution. I have noticed the they are executed in mixed order. How can I  define the order of execution in this kind of scenario ?

Regards,
Malintha Adikari                              
  }

Jason Antman

unread,
Jun 25, 2014, 11:16:02 AM6/25/14
to puppet...@googlegroups.com
You should use the 'require' metaparameter, or if you absolutely need to, explicit ordering. docs.puppetlabs.com will give you further information.

You should also read the Style Guide, and not throw all of that in one manifest.


--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/fcdb2227-918e-4273-a5da-6dd29c0000a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jcbollinger

unread,
Jun 26, 2014, 9:32:48 AM6/26/14
to puppet...@googlegroups.com


On Wednesday, June 25, 2014 7:04:16 AM UTC-5, Malintha Adikari wrote:

When I execute this manifest what is the order of the above 3 elements execution. I have noticed the they are executed in mixed order.


No, they're not.  Declarations in any manifest are processed to-to-bottom, left-to-right.

BUT the end result of processing those declarations is a catalog of all the resources to be managed on the target node.  When that catalog is applied, either by "puppet agent" or "puppet apply", resources are not necessarily applied in the order in which they were added to the catalog.


How can I  define the order of execution in this kind of scenario ?



 Influencing the order in which resources are applied is the role of resource relationships.
 

John

Henrik Lindberg

unread,
Jun 26, 2014, 11:31:44 AM6/26/14
to puppet...@googlegroups.com
On 2014-25-06 14:04, Malintha Adikari wrote:

> How can I define the order of execution in this kind of scenario ?
>
This explains how it works:
http://puppet-on-the-edge.blogspot.se/2014/04/getting-your-puppet-ducks-in-row.html
--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

Reply all
Reply to author
Forward
0 new messages