puppet 클래스, 모듈
[root@puppet manifests]# cat test.pp 
class nginx {                                #    
	package {'nginx':                    #    
		ensure => present,
	}
	service {'nginx':
		ensure => true,
		require => Package['nginx'],
	}
}
include nginx                                 #   
#class {'nginx'}                              #            집행 하 다.
puppet apply test.pp -v -d  전 삼 류
[root@puppet manifests]# cat test1.pp 
$webserver = $operatingsystem ? {                      
	/^(?i-mx:redhat|centos|fedora)/ => 'httpd',
	/^(?i-mx:ubuntu|debian)/	=> 'apache2',
}
class httpd ($pkgname='apache2') {
	package {"$pkgname":
		ensure=>present,
		}
	service {"$pkgname":
		ensure=>true,
		require=>Package["$pkgname"],
		}
}
class {'httpd':
	pkgname => $webserver ,
}  집행 하 다.
puppet apply test1.pp -v -d  상속
[root@puppet manifests]# cat test2.pp 
class nginx {
	package {"nginx":
		ensure=>present,
	}
}
	
class nginx::rproxy inherits nginx {
	file {'/etc/nginx/nginx.conf':
		ensure=>file,
		source=>'/tmp/nginx/nginx.rproxy.conf',
		notify=>Service['nginx'],
	}
	service {'nginx':
		ensure=>true,
	}
}
class nginx::web inherits nginx {
	file {'/ect/nginx/nginx.conf':
		ensure=>file,
		source=>'/tmp/nginx/nginx.web.conf',
		notify=>Service['nginx'],
	}
	service {'nginx':
		ensure=>true,
	}
}
class {'nginx::rproxy'}  
    
[root@puppet manifests]# cat node.pp 
import "/etc/puppet/manifests/test2.pp"
include nginx::rproxy  집행 하 다.
puppet apply node.pp -v -d  모듈
[root@puppet puppet]# cd modules/   #  nginx  
[root@puppet modules]# ls
nginx
[root@puppet modules]# mkdir -pv nginx/{manifests,files,templates,lib}  #        
[root@puppet nginx]# cd manifests/
[root@puppet manifests]# ls
init.pp  nginx.rproxy.pp  nginx.web.pp   #init.pp             
[root@puppet manifests]# cat init.pp nginx.rproxy.pp nginx.web.pp   #  3              
class nginx {
	package {"nginx":
		ensure=>file,
	}
}
class nginx::rproxy inherits nginx {
	file {'/etc/nginx/nginx.conf':
		ensure=>file,
		source=>'puppet:///modules/nginx/nginx.rproxy.conf',  #       files        
		notify=>Service['nginx'],
	}
	service {'nginx':
		ensure=>true,
	}
}
class nginx::web inherits nginx {
	file {'/ect/nginx/nginx.conf':
		ensure=>file,
		source=>'puppet:///modules/nginx/nginx.web.conf',
		notify=>Service['nginx'],
	}
	service {'nginx':
		ensure=>true,
	}
}
[root@puppet files]# cp /tmp/nginx/nginx.* .  #copy    files                 files
[root@puppet files]# ls 
nginx.rproxy.conf  nginx.web.conf    
[root@puppet manifests]# cat init.pp 
class nginx {
	package {"nginx":
		ensure=>present,
	}
	file {'/etc/nginx/nginx.conf':
		ensure=>file,
		source=>'puppet:///modules/nginx/nginx.web.conf',
	}
	service {'nginx':
		ensure=>true,
	}
}
  
[root@puppet manifests]# puppet apply -e 'include nginx' -v -d  네트워크 모델 아래 모듈
class jdk{                                #          rpm            files   
	file {'/opt/jdk-8u45-linux-x64.rpm':
		source=>'puppet:///modules/jdk/jdk-8u45-linux-x64.rpm',
		group=>'root',
		owner=>'root',
	}
	file{'/etc/profile.d/java.sh':
	#	ensure=>present,
		source=>'puppet:///modules/jdk/java.sh',
		group=>'root',
		owner=>'root',
	}
	exec {'install':
		cwd=>'/opt',
		path=>'/usr/local/bin:/usr/bin:/bin:',
		command=>'rpm -ivh jdk-8u45-linux-x64.rpm',
		creates=>'/usr/java/jdk1.8.0_45/bin/java',
		subscribe=>File['/opt/jdk-8u45-linux-x64.rpm'],
		require=>File['/opt/jdk-8u45-linux-x64.rpm'],
	}
	exec {'sh':
		cwd=>'/etc/profile.d/',
		creates=>'/etc/profile.d/java.sh',
		path=>'/usr/local/bin:/usr/bin:/bin',
		command=>'sh java.sh',
		require=>File['/etc/profile.d/java.sh'],
	}
}  그리고 사이트. pp 에서 설명 합 니 다.
node 'agent.cc.com'{
        include jdk
}
                이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.