2016-10-06 1 views
-1

ファイル内容に変更がない場合、特定のexecおよびファイルリソースをスキップします。予想通り、ファイルおよびサービスの組み合わせのためにその作業... は例えば、ファイル内容に変更がない場合、人形機能をスキップします

file { 'configfile.cfg': 
    ensure => file, 
    path => '/etc/configfile.cfg', 
    mode => '0644', 
    owner => 'root', 
    group => 'root', 
    content => template($template_file), 
    require => Package[$main_package], 
    notify => Service[$service], 

    } 

    service { $service: 
    ensure  => $ensure, 
    enable  => $enable, 
    hasrestart => true, 
    hasstatus => true, 
    require => [ Package[$main_package], File['configfile.cfg'] ], 

    } 

上記のコードは動作しています。サービスが...それは/etc/configfile.cfgの変化を検出した場合にのみ、再起動し

しかし、私は、ファイルやexecの組み合わせのために同じアプローチを次のですが、その作業はありません....以下のコード

を参照してください。
exec { 'purge-config-files': 
     before => [File["${config_file_service}"], File["${config_file_host}"]], 
     command => "/bin/rm -f ${baseconfigdir}/*", 
     notify => Domain_ip_map[$domain_ip_map_titles], 
} 

file { 'deployconfig.cfg': 
      ensure => file, 
      path => '/home/path/deployconfig.cfg', 
      mode => '0644', 
      owner => 'root', 
      group => 'root', 
      content => "test", 
      notify => Exec['purge-config-files'], 
} 

このコードは期待どおりに動作しません。 /home/path/deployconfig.cfgに変更がない場合でも、Exec ['purge-config-files']は常に が実行されます...これはなぜですか?

答えて

1

私が購読してのrefreshOnly

入れるのを忘れ答え

exec { 'purge-config-files': 
     before => [File["${config_file_service}"], File["${config_file_host}"]], 
     command => "/bin/rm -f ${baseconfigdir}/*", 
     notify => Domain_ip_map[$domain_ip_map_titles], 
     subscribe=> File['deployconfig.cfg'], 
     refreshonly => true, 
} 

を見つけました....

関連する問題