Puppet:错误:无法运行:找不到文件清单/ web01.pp

时间:2016-07-08 20:58:53

标签: puppet

我是Puppet的新用户,我创建了我的web01.pp文件来执行以下任务。

  1. 安装nginx服务器

  2. 配置nginx服务器

  3. 将我已创建的索引文件从一个目录复制到客户端计算机中的另一个目录
  4. 使用sudo权限添加用户
  5. 我的web01文件看起来像

        node 'web01.example.com' {
      package { 'apache2.2-common':
        ensure => absent,
      }
      package { 'nginx':
        ensure => installed,
        require => Package['apache2.2-common'],
      }
      service { 'nginx':
        ensure => running,
        require => Package['nginx'],
      }
    exec { 'mkdir -p /var/www/web01':
        command => '/bin/mkdir -p /var/www/web01'
    }
    exec { 'cp -rf /root/site/index.php /var/www/web01/':
        command => '/bin/cp -rf /root/site/index.php /var/www/web01/'
    }
       file { "/var/www/web01":
               source => "puppet:///files/web01.conf",
               notify => Service['nginx'],
    }
    
    user { 'newuser':
        # (namevar) The user name
        name      => 'newuser',  
        # The user's status: 'present','absent','role'
        ensure    => 'present',
        # Eventual user's secondary groups (use array for many)
        groups    => [ 'sudo' ],
        # The user's password. As it appears in /etc/shadow
        # Use single quotes to avoid unanted evaluation of $* as variables
        # Typical users' attributes
        shell     => '/bin/bash',
        home      => '/home/newuser',
        sshkeytype => "ssh-rsa",
        sshkey     => "AAAA..."
    
    }
    
    } 
    
    之后我创建了

      

    /etc/puppet/files/web01.conf

    并使用这些命令

      

    puppet apply manifests / web01.pp

    并收到此错误

    Error: Could not run: Could not find file manifests/web01.pp
    

    我有什么遗漏或配置申请吗?

1 个答案:

答案 0 :(得分:0)

修复以下内容,然后在运行puppet apply命令之前确保您处于清单目录中:

file { "/var/www/web01":
       source => "puppet:///files/web01.conf",
       notify => Service['nginx'],

您之前将/ var / www / web01声明为dir然后尝试创建具有相同名称的文件

修正:

file { "/var/www/web01/web01.conf":
       source => "puppet:///files/web01.conf",
       notify => Service['nginx'],