在执行我的木偶程序时,“归档[/ tmp / $ {filename}]似乎不在目录中”

时间:2017-06-29 14:18:03

标签: puppet archive puppet-enterprise

我的Puppet类看起来像这样:

class aoa_agent_installation::splunk_install {
    $sourcefile = $osfamily ? {
        'Solaris' => 'puppet:///modules/aoa_agent_installation/splunkforwarder-6.5.2-67571ef4b87d-SunOS-sparc.tar.Z',
        'RedHat' => 'puppet:///modules/aoa_agent_installation/splunkforwarder-6.5.2-67571ef4b87d-Linux-x86_64.tgz',
        'AIX' => 'puppet:///modules/aoa_agent_installation/splunkforwarder-6.5.2-67571ef4b87d-AIX-powerpc.tgz',
    }

    $dirname = 'splunkforwarder'
    $filename = "${dirname}.tar.gz"
    $install_path = "/opt/${dirname}"

    file { $install_path:
        ensure => directory,
        owner  => 'findev',
        group  => 'finacle',
        mode   => '0777',
    }

    archive { $filename:
        path         => "/tmp/${filename}",
        source       => $sourcefile,
        extract      => true,
        extract_path => '/opt',
        creates      => "${install_path}",
        cleanup      => true,
        user         => 'findev',
        group        => 'finacle',
        require      => File[$install_path],
    }

    exec {'start_splunk_service':
        path        => '/usr/bin:/bin:/usr/sbin:/sbin',
        user        => 'findev',
        command     => '/opt/splunkforwarder/bin/splunk start --accept-license && echo "1" > /tmp/splunk_status.txt',
        onlyif      => [ 
            "test -f /opt/splunkforwarder/bin/splunk",
            "test `ps -ef | grep -v grep | grep splunk | wc -l` -eq 0",
            ],
        environment => ["HOME=/app/finacle"],
        require     => Archive[$filename],
    }

    file { '/opt/splunkforwarder/etc/system/local/deploymentclient.conf': 
        ensure  => present,
        owner   => 'findev',
        group   => 'finacle',
        mode    => "0777",
        source  => 'puppet:///modules/aoa_agent_installation/deploymentclient.conf',
        require => Archive[$filename],
    }

    exec {'restart_start_splunk_service':
        path        => '/usr/bin:/bin:/usr/sbin:/sbin',
        user        => 'findev',
        command     => '/opt/splunkforwarder/bin/splunk restart && echo "0" > /tmp/splunk_status.txt',
        onlyif      => [ 
            "test -f /opt/splunkforwarder/bin/splunk",
            "test `cat /tmp/splunk_status.txt | tr -s ' '` -eq 1",
            ],
        environment => ["HOME=/app/finacle"],
        require     => File['/opt/splunkforwarder/etc/system/local/deploymentclient.conf'],
    }
}

我收到以下错误:

  

错误:   无法从远程服务器检索目录:SERVER上的错误500:服务器错误:无效关系:Exec [start_splunk_service] {require =>存档[/ tmp / $ {filename}]},因为存档[/ tmp / $ {filename}]似乎不在目录中

0 个答案:

没有答案