CentOS 7
Sponsored Link

Puppet : How to use [node Section]2015/07/22

 
It's possible to set resources for every clients by using "node" section like follows.
[1] Set resources to "www01.srv.world" and others. ("default" section is applied on other clients.)
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
node 'www01.srv.world' {
    file { '/home/testfile.txt':
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => 644,
        content => 'This is the puppet test file.',
    }
}
node default {
    user { 'cent':
        ensure     => present,
        home       => '/home/cent',
        managehome => true,
        password   => '$6$0XTc2rjlxxxxxxxx',
    }
}
[2] Set resources to "www01.srv.world" and "www.srv.world" and others.
[root@dlp ~]#
vi /etc/puppet/manifests/site.pp
node 'www01.srv.world' {
    file { '/home/testfile.txt':
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => 644,
        content => 'This is the puppet test file.',
    }
}
node 'www.srv.world' inherits 'www01.srv.world' {
    file { '/home/testfile2.txt':
        ensure  => file,
        content => 'inherits test file.',
    }
}
node default {
    user { 'cent':
        ensure     => present,
        home       => '/home/cent',
        managehome => true,
        password   => '$6$0XTc2rjlxxxxxxxx',
    }
}
Matched Content