Try:

  file { "/etc/mysql":
     ensure => directory,
     mode => 0755,
     owner => root,
     group => root,
  }

  file { "/etc/mysql/my.cnf":
    source => "puppet:///modules/mysql-server/my.cnf",
    owner => "mysql", group => "mysql",
    mode  => 644,
    notify => Service["mysql"],
    require => File["/etc/mysql"]
  }

--
Nathan Clemons
http://www.livemocha.com
The worlds largest online language learning community



On Wed, Oct 12, 2011 at 2:49 PM, olympus stance <olympus.sta...@gmail.com>wrote:

> Hi Jacob,
>
> My init.pp file is a symbolic link to the mysql-server.pp in the classes
> directory. It looks like this:
>
> -------
> class mysql-server {
>
>   package { "mysql-server": ensure => installed }
>   package { "mysql-client": ensure => installed }
>   service { "mysql":
>              enable => false,
>              require => Package["mysql-server"],
>
>           }
>
>   file { "/etc/mysql/my.cnf":
>     source => "puppet:///modules/mysql-server/my.cnf",
>     owner => "mysql", group => "mysql",
>     mode  => 644,
>     notify => Service["mysql"],
>   }
>
>
>
>   exec { "run-mysqld":
>     path => ["/bin", "/usr/sbin"],
>     command => "/usr/sbin/mysqld &",
>   }
>
>   exec { "set-mysql-password":
>     path => ["/bin", "/usr/bin"],
>     command => "mysqladmin -uroot password secret",
>   }
>
>
>   exec { "set-nagios-password":
>     path => ["/bin", "/usr/bin"],
>     command => "/usr/bin/mysql -u root  -e \"CREATE USER 'nagios'@'%'
> IDENTIFIED BY 'secret';\"",
>   }
>
>
> }
> ---------------------------
>
>
> It looks like it does indeed try to create the my.cnf file before mysql
> gets installed. How can i rectify that
>
> Thanks!!
>
>
> On Wed, Oct 12, 2011 at 5:37 PM, Jacob Helwig <ja...@puppetlabs.com>wrote:
>
>> On Wed, 12 Oct 2011 14:33:47 -0700, John Bower wrote:
>> >
>> > Hello,
>> >
>> > I'm trying to share a file between the client and the server.
>> >
>> > On the server the file is located at: /etc/puppet/modules/mysql-server/
>> > files/my.cnf
>> >
>> > the code that references to this file is as follows:
>> >
>> >   file { "/etc/mysql/my.cnf":
>> >     source => "puppet:///modules/mysql-server/my.cnf",
>> >     owner => "mysql", group => "mysql",
>> >     mode  => 644,
>> >     notify => Service["mysql"],
>> >   }
>> >
>> > Essentially, I want the client to store the my.cnf file to /etc/mysq/
>> > my.cnf
>> >
>> > However i keep getting this error:
>> > err: /Stage[main]/Mysql-server/File[/etc/mysql/my.cnf]/ensure: change
>> > from absent to file failed: Could not set 'file on ensure: No such
>> > file or directory - /etc/mysql/my.cnf.puppettmp_9888 at /etc/puppet/
>> > modules/mysql-server/manifests/init.pp:15
>> >
>> >
>> >
>> > i tried setting  source => "puppet:///modules/mysql-server/files/
>> > my.cnf",
>> >
>> >
>> > But that did not make a difference. Please help.
>> >
>>
>> Does /etc/mysql exist on the client machine?
>>
>> --
>> Jacob Helwig
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to