Hi There,
You can, however once a class is defined you must then apply it to the node 
using 'include'

Example:

[ Keiran ~]$ cat /tmp/example.pp

class class1 {
        exec { exec1 :
                command => "/bin/touch /tmp/${title}",
            }

    }

class class2 {
        exec { exec2 :
                command => "/bin/touch /tmp/${title}",
            }

    }

include class1
include class2

[ Keiran ~]$ puppet apply /tmp/example.pp
notice: /Stage[main]/Class2/Exec[exec2]/returns: executed successfully
notice: /Stage[main]/Class1/Exec[exec1]/returns: executed successfully
notice: Finished catalog run in 0.17 seconds
[ Keiran ~]$ ls -al /tmp/ |grep -i class
-rw-r--r--  1 Keiran Keiran     0 Feb 18 10:27 class1
-rw-r--r--  1 Keiran Keiran     0 Feb 18 10:27 class2
[ Keiran ~]$


Defining multiple classes in a single manifest for non-testing/learning may 
not always be deemed as best practice, It might be worth having a read of 
the following documentation:
- http://docs.puppetlabs.com/puppet/2.7/reference/lang_classes.html
- http://docs.puppetlabs.com/guides/style_guide.html

Hope this helps,

K





On Monday, February 18, 2013 7:07:39 AM UTC, yarlagadda ramya wrote:
>
> Hi all,
>
> Can we write many classes in a single manifest and apply that manifest??
> For example i have created  manifest, file1.pp and it includes the 
> following:
>
> class one{
>               exec{"--"
>               command => "  ",
>                       cwd => "   ",     
>                       }
>               } 
>
>
> class two{
>               exec{"--"
>               command => "  ",
>                       cwd => "   ",     
>                       }
>               } 
>
> now can i write a manifest like this and apply it?
>
> Can any one pls help me with it?
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to