Reputation: 253
I am new user of Puppet and I created my web01.pp file to do following tasks.
install nginx server
configure nginx server
my web01 files looks like
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..."
}
}
after that I created
/etc/puppet/files/web01.conf
and use these commands
puppet apply manifests/web01.pp
and get this error
Error: Could not run: Could not find file manifests/web01.pp
Is there anything I missed or to configure to apply ?
Upvotes: 0
Views: 1176
Reputation: 16
Fix the following then make sure you are in manifests directory before you run the puppet apply command:
file { "/var/www/web01":
source => "puppet:///files/web01.conf",
notify => Service['nginx'],
you declared /var/www/web01 as a dir earlier then you tried to create file with the same name
fix:
file { "/var/www/web01/web01.conf":
source => "puppet:///files/web01.conf",
notify => Service['nginx'],
Upvotes: 0