꼭두각시 : 변수와 문자열을 연결하는 방법
-
21-12-2019 - |
문제
꼭두각시 변수와 문자열을 연결하고 싶습니다
$agents_location='/home/agent2/adikari5'
file { $agents_location+"/filename.zip":
mode => "0777",
owner => 'root',
group => 'root',
source => 'puppet:///modules/filecopy/wso2as-5.2.1.zip',
}
.
위의 코드와 같이 $ agent_location과 휴지 부분에 연결하여 파일의 경로를 만드는 것입니다.그것을하는 올바른 방법은 무엇입니까?
해결책
${}
로 문자열의 변수를 간섭 할 수 있습니다.
file { "${agents_locations}/filename.zip":
...
}
.
큰 따옴표 에 유의하십시오.그들 없이는 경로 이름이 문자 그대로 당신이 작성한 것, 즉 ${agents_locations}/filename.zip
대신 /home/agent2/adikari5/filename.zip
입니다.
문서 참조 : http://docs.puppetlabs.com/puppet/latest/referces/lang_variables..html # 보간
제휴하지 않습니다 StackOverflow