Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to make a puppet-server executes the manifest is different from the default manifest

I use both the server-puppet and client-puppet. So, I wrote a detailed commands for the server-puppet and client-puppet... .

On puppet server:

[root@gold ~]# hostname gold

[root@gold ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.52.132 gold.localdomain gold 192.168.52.133 samuray.localdomain samuray

[root@gold ~]# ls -l /etc/puppet/manifests/ total 8 -rw-r--r--. 1 root root 123 Aug 16 20:19 new2.pp -rw-r--r--. 1 root root 116 Aug 16 20:14 site.pp

[root@gold ~]# cat /etc/puppet/manifests/site.pp class passwd { file { "/etc/passwd": owner => root, group => root, mode => 644, } } node default { include passwd }

[root@gold ~]# cat /etc/puppet/manifests/new2.pp class tmp { file { "/tmp/tmp": ensure => file, owner => root, group => root, mode => 777, } } node default { include tmp }

[root@gold ~]# /etc/init.d/puppetmaster restart Stopping puppetmaster: [ OK ] Starting puppetmaster: [ OK ]

On Puppet client:

[root@samuray ~]# hostname samuray

[root@samuray ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.52.133 samuray.localdomain samuray 192.168.52.132 gold.localdomain gold

[root@samuray ~]# puppet agent --test Notice: Ignoring --listen on onetime run Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for samuray.localdomain Info: Applying configuration version '1408210443' Notice: /Stage[main]/Passwd/File[/etc/passwd]/mode: mode changed '0644' to '0777' Notice: Finished catalog run in 0.08 seconds

[root@samuray ~]# ls -l /tmp/tmp -rw-r--r--. 1 root root 0 Aug 16 20:09 /tmp/tmp

It is clear that the right to file /etc/passwd, and in the file / tmp/ tmp is not changed -(

How to make a puppet-server executes the manifest is different from the default manifest

I use both the server-puppet and client-puppet. So, I wrote a detailed commands for the server-puppet and client-puppet... .

On puppet server:

[root@gold ~]# hostname
gold

gold [root@gold ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.52.132 gold.localdomain gold 192.168.52.133 samuray.localdomain samuray

samuray [root@gold ~]# ls -l /etc/puppet/manifests/ total 8 -rw-r--r--. 1 root root 123 Aug 16 20:19 new2.pp -rw-r--r--. 1 root root 116 Aug 16 20:14 site.pp

site.pp [root@gold ~]# cat /etc/puppet/manifests/site.pp class passwd { file { "/etc/passwd": owner => root, group => root, mode => 644, } } node default { include passwd }

} [root@gold ~]# cat /etc/puppet/manifests/new2.pp class tmp { file { "/tmp/tmp": ensure => file, owner => root, group => root, mode => 777, } } node default { include tmp }

} [root@gold ~]# /etc/init.d/puppetmaster restart Stopping puppetmaster: [ OK ] Starting puppetmaster: [ OK ]

]

On Puppet client:

[root@samuray ~]# hostname
samuray

samuray [root@samuray ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.52.133 samuray.localdomain samuray 192.168.52.132 gold.localdomain gold

gold [root@samuray ~]# puppet agent --test Notice: Ignoring --listen on onetime run Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for samuray.localdomain Info: Applying configuration version '1408210443' Notice: /Stage[main]/Passwd/File[/etc/passwd]/mode: mode changed '0644' to '0777' Notice: Finished catalog run in 0.08 seconds

seconds [root@samuray ~]# ls -l /tmp/tmp -rw-r--r--. 1 root root 0 Aug 16 20:09 /tmp/tmp

/tmp/tmp

It is clear that the right to file /etc/passwd, and in the file / tmp/ tmp is not changed -(