简体   繁体   English

Puppet文件资源需要归档资源

[英]Puppet file resource require archive resource

I am using Puppet for doing my Vagrant provisioning. 我正在使用Puppet进行我的Vagrant配置。 I used the archive module at https://forge.puppet.com/puppet/archive/types to download and extract glassfish like this: 我使用https://forge.puppet.com/puppet/archive/types上的归档模块来下载和提取这样的glassfish:

archive { '/tmp/glassfish-4.1.1.zip':
  ensure        => present,
  extract       => true,
  extract_path  => '/opt/',
  source        => 'http://download.java.net/glassfish/4.1.1/release/glassfish-4.1.1.zip',
  cleanup       => true,
  creates       => '/opt/glassfish4',
}

After that resource is applied, I want to move a file into the newly created glassfish directory like this 应用该资源后,我想将文件移动到新创建的glassfish目录中

file { 'domain.xml':
  ensure  => file,
  path    => '/opt/glassfish4/glassfish/domains/domain1/config/domain.xml',
  source  => 'puppet:///modules/glassfish/domain.xml',
}

I want to require in the file move resource that the extraction was already done, since the extraction is not creating a file, but rather a directory. 我想在文件移动资源中要求提取已经完成,因为提取不是创建文件,而是创建目录。 Something like 就像是

require => FILE['..']

is not working. 不管用。

You should add a require on the archive task so your file task will be something like 您应该在归档任务上添加一个require ,以便您的文件任务类似

  file { 'domain.xml':
    ensure  => file,
    path    => '/opt/glassfish4/glassfish/domains/domain1/config/domain.xml',
    source  => 'puppet:///modules/glassfish/domain.xml',
    require => Archive['/tmp/glassfish-4.1.1.zip'],
  }

so that the copy of the domain.xml file will be done after the archive task. 以便在归档任务之后完成domain.xml文件的副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM