Rost
2012-Aug-08 13:42 UTC
[Puppet Users] Exec resource don''t write file after the command
Hi all, I''m trying to have the exec resource write a file after the command but it don''t. here is the resource declaration class gepet { notify { ''begin'':} file { ''/root/essai/html'': ensure => present, content => "Wrote By Yves Nton", notify => Exec[''test''], } exec { ''test'': path => "/usr/bin:/usr/sbin:/bin", cwd => "/root/essai", command => "rm -rf /root/essai/html", creates => "/root/essai/exec.txt", refreshonly => true } notify { ''end'': require => File[''/root/essai/html''] } } suggestions ? Thanks -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4u6oOxidJJUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Brian Gallew
2012-Aug-08 13:45 UTC
Re: [Puppet Users] Exec resource don''t write file after the command
The "creates" attribute tells Puppet that the "command" attribute actually creates a file, and that the Exec{} should not be run if that file exists. You need to alter your command: command => "rm -rf /root/essai/html;touch /root/essai/exec.txt" On Wed, Aug 8, 2012 at 6:42 AM, Rost <ynguieye@gmail.com> wrote:> Hi all, > > I''m trying to have the exec resource write a file after the command but it > don''t. > > here is the resource declaration > > class gepet { > notify { ''begin'':} > file { ''/root/essai/html'': > ensure => present, > content => "Wrote By Yves Nton", > notify => Exec[''test''], > } > exec { ''test'': > path => "/usr/bin:/usr/sbin:/bin", > cwd => "/root/essai", > command => "rm -rf /root/essai/html", > creates => "/root/essai/exec.txt", > refreshonly => true > } > notify { ''end'': > require => File[''/root/essai/html''] > } > } > > suggestions ? > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/4u6oOxidJJUJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rost
2012-Aug-08 14:00 UTC
[Puppet Users] Re: Exec resource don''t write file after the command
thanks Brian, You are right !!! It''s working Le mercredi 8 août 2012 15:42:02 UTC+2, Rost a écrit :> > Hi all, > > I''m trying to have the exec resource write a file after the command but it > don''t. > > here is the resource declaration > > class gepet { > notify { ''begin'':} > file { ''/root/essai/html'': > ensure => present, > content => "Wrote By Yves Nton", > notify => Exec[''test''], > } > exec { ''test'': > path => "/usr/bin:/usr/sbin:/bin", > cwd => "/root/essai", > command => "rm -rf /root/essai/html", > creates => "/root/essai/exec.txt", > refreshonly => true > } > notify { ''end'': > require => File[''/root/essai/html''] > } > } > > suggestions ? > Thanks >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/7SmuU8bDuQcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.