[files]
path /opt/files
allow *.client.domain
Put your shell file in the path you specified. Now you just need to set up a file and exec resource. Note the source item in the file resource and the require item in exec.
file { '/etc/shell_file':
ensure => present,
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet://puppet/files/shell_file',
}
exec { '/etc/shell_file': require => File['/etc/shell_file'] }
--
Peter M. Bukowinski
Systems Engineer
Janelia Farm Research Campus, HHMI
> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com (mailto:puppet...@googlegroups.com).
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com (mailto:puppet-users...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
In your QoS.sh file, make sure to use explicit paths to executables, e.g:
use '/sbin/iptables -blah …' NOT 'iptables -blah …'
--
Peter M. Bukowinski
Systems Engineer
Janelia Farm Research Campus, HHMI
On Friday, June 17, 2011 at 10:44 AM, Annie Rana wrote:
> Hi Luke,
> What's your shell script expected to
> do?
> The shell script would generate Iptables rules
>
> How do you know it didn't work?
> I can check using ipatbles -L or iptables -t mangle -L commands
>
>
> If you run it by hand in a root shell, does it work then?
> Yes
>
> If so,
> there might be an environment problem when running from Puppet, like
> $PATH or something. Try set the parameter "logoutput => true" in the
> exec resource.
> I did but no affect.
>
> Thanks again, much appreciated your help and time.
> On Fri, Jun 17, 2011 at 3:26 PM, Luke Bigum <Luke....@lmax.com (mailto:Luke....@lmax.com)> wrote:
> > How do you know it didn't work? What's your shell script expected to
> > do? If you run it by hand in a root shell, does it work then? If so,
> > there might be an environment problem when running from Puppet, like
> > $PATH or something. Try set the parameter "logoutput => true" in the
> > exec resource.
> >
> > On Jun 17, 3:18 pm, Annie Rana <annier...@gmail.com (mailto:annier...@gmail.com)> wrote:
> > > Thanks but it couldn't work though i got the message that shell script is
> > > successfully executed.
> > >
> > > On Fri, Jun 17, 2011 at 2:44 PM, Luke Bigum <Luke.Bi...@lmax.com (mailto:Luke.Bi...@lmax.com)> wrote:
> > > > Annie,
> > >
> > > > http://docs.puppetlabs.com/references/stable/type.html#exec
> > >
> > > > By default the expected return code is probably zero, your script is
> > > > returning 1. Whether this is correct or not I don't know, but you can
> > > > tell puppet to expect a different return code:
> > >
> > > > exec { '/etc/shell_file':
> > > > require => File['/etc/shell_file'],
> > > > returns => 1,
> > > > }
> > >
> > > > On Jun 17, 2:36 pm, Annie Rana <annier...@gmail.com (mailto:annier...@gmail.com)> wrote:
> > > > > I apologize for posting wrong log messages, here is the correct log:
> > >
> > > > > notice: Starting catalog run
> > > > > notice: //File[/tmp/QoS/QoS.sh (http://QoS.sh)]/ensure: created
> > > > > err: //Exec[/tmp/QoS/QoS.sh (http://QoS.sh)]/returns: change from notrun to 0 failed:
> > > > > /tmp/QoS/QoS.sh (http://QoS.sh) returned 1 instead of 0 at
> > > > /etc/puppet/manifests/site.pp:10
> > > > > notice: Finished catalog run in 0.46 seconds
> > >
> > > > > Any help please?
> > >
> > > > > On Fri, Jun 17, 2011 at 2:09 PM, Annie Rana <annier...@gmail.com (mailto:annier...@gmail.com)> wrote:
> > > > > > Hi Peter, thanks for your reply. I managed to copy the shell file
> > > > puppet
> > > > > > client using the file resource recipe you specified but exec is
> > > > throwing an
> > > > > > error, which is as follows:
> > >
> > > > > > info: No classes to store
> > > > > > info: Caching catalog at /var/lib/puppet/state/localconfig.yaml
> > > > > > notice: Starting catalog run
> > > > > > err: //File[/tmp/QoS/QoS.sh (http://QoS.sh)]/ensure: change from absent to file failed:
> > > > > > Could not set file on ensure: No such file or directory -
> > > > > > /tmp/QoS/QoS.sh.puppettmp at /etc/puppet/manifests/site.pp:7
> > > > > > notice: //Exec[/tmp/QoS/QoS.sh (http://QoS.sh)]: Dependency file[/tmp/QoS/QoS.sh (http://QoS.sh)] has 1
> > > > > > failures
> > > > > > warning: //Exec[/tmp/QoS/QoS.sh (http://QoS.sh)]: Skipping because of failed
> > > > dependencies
> > > > > > notice: Finished catalog run in 0.38 seconds
> > >
> > > > > > When I tried running the shell script manually using the following
> > > > command
> > >
> > > > > > '/tmp/QoS/QoS.sh (http://QoS.sh); echo $?'
> > >
> > > > > > , it worked fine printing 0 at the end. Any help what is wrong with
> > > > exec
> > > > > > resource recipe?
> > >
> > > > > > Thanks in advance for your time.
> > >
> > > > > > Regards,
> > >
> > > > > > A.
> > >
> > > > > > On Thu, Jun 16, 2011 at 8:42 PM, Peter Bukowinski <pmb...@gmail.com (mailto:pmb...@gmail.com)
> > > > > > > puppet...@googlegroups.com (mailto:puppet...@googlegroups.com)).> > > > (mailto:
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@googlegroups.com) (mailto:
> > > > > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@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...@googlegroups.com (mailto:puppet...@googlegroups.com).
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@googlegroups.com).
> > > > > > > For more options, visit this group at> > > > To post to this group, send email to puppet...@googlegroups.com (mailto:puppet...@googlegroups.com).
> > > > > > > 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 unsubscribe from this group, send email to
> > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@googlegroups.com).
> > > > For more options, visit this group at> > To post to this group, send email to puppet...@googlegroups.com (mailto:puppet...@googlegroups.com).
> > > > 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 unsubscribe from this group, send email to puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@googlegroups.com).
use '/sbin/iptables -blah …' NOT 'iptables -blah …'
--
Peter M. Bukowinski
Systems Engineer
Janelia Farm Research Campus, HHMI
On Friday, June 17, 2011 at 10:44 AM, Annie Rana wrote:
> Hi Luke,
> What's your shell script expected to
> do?
> The shell script would generate Iptables rules
>
> How do you know it didn't work?
> I can check using ipatbles -L or iptables -t mangle -L commands
>
>
> If you run it by hand in a root shell, does it work then?
> Yes
>
> If so,
> there might be an environment problem when running from Puppet, like
> $PATH or something. Try set the parameter "logoutput => true" in the
> exec resource.
> I did but no affect.
>
> Thanks again, much appreciated your help and time.
> On Fri, Jun 17, 2011 at 3:26 PM, Luke Bigum <Luke....@lmax.com (mailto:Luke....@lmax.com)> wrote:
> > How do you know it didn't work? What's your shell script expected to
> > do? If you run it by hand in a root shell, does it work then? If so,
> > there might be an environment problem when running from Puppet, like
> > $PATH or something. Try set the parameter "logoutput => true" in the
> > exec resource.
> >
> > On Jun 17, 3:18 pm, Annie Rana <annier...@gmail.com (mailto:annier...@gmail.com)> wrote:
> > > Thanks but it couldn't work though i got the message that shell script is
> > > successfully executed.
> > >
> > > On Fri, Jun 17, 2011 at 2:44 PM, Luke Bigum <Luke.Bi...@lmax.com (mailto:Luke.Bi...@lmax.com)> wrote:
> > > > Annie,
> > >
> > > > http://docs.puppetlabs.com/references/stable/type.html#exec
> > >
> > > > By default the expected return code is probably zero, your script is
> > > > returning 1. Whether this is correct or not I don't know, but you can
> > > > tell puppet to expect a different return code:
> > >
> > > > exec { '/etc/shell_file':
> > > > require => File['/etc/shell_file'],
> > > > returns => 1,
> > > > }
> > >
> > > > On Jun 17, 2:36 pm, Annie Rana <annier...@gmail.com (mailto:annier...@gmail.com)> wrote:
> > > > > I apologize for posting wrong log messages, here is the correct log:
> > >
> > > > > notice: Starting catalog run
> > > > > notice: //File[/tmp/QoS/QoS.sh (http://QoS.sh)]/ensure: created
> > > > > err: //Exec[/tmp/QoS/QoS.sh (http://QoS.sh)]/returns: change from notrun to 0 failed:
> > > > > /tmp/QoS/QoS.sh (http://QoS.sh) returned 1 instead of 0 at
> > > > /etc/puppet/manifests/site.pp:10
> > > > > notice: Finished catalog run in 0.46 seconds
> > >
> > > > > Any help please?
> > >
> > > > > On Fri, Jun 17, 2011 at 2:09 PM, Annie Rana <annier...@gmail.com (mailto:annier...@gmail.com)> wrote:
> > > > > > Hi Peter, thanks for your reply. I managed to copy the shell file
> > > > puppet
> > > > > > client using the file resource recipe you specified but exec is
> > > > throwing an
> > > > > > error, which is as follows:
> > >
> > > > > > info: No classes to store
> > > > > > info: Caching catalog at /var/lib/puppet/state/localconfig.yaml
> > > > > > notice: Starting catalog run
> > > > > > err: //File[/tmp/QoS/QoS.sh (http://QoS.sh)]/ensure: change from absent to file failed:
> > > > > > Could not set file on ensure: No such file or directory -
> > > > > > /tmp/QoS/QoS.sh.puppettmp at /etc/puppet/manifests/site.pp:7
> > > > > > notice: //Exec[/tmp/QoS/QoS.sh (http://QoS.sh)]: Dependency file[/tmp/QoS/QoS.sh (http://QoS.sh)] has 1
> > > > > > failures
> > > > > > warning: //Exec[/tmp/QoS/QoS.sh (http://QoS.sh)]: Skipping because of failed
> > > > dependencies
> > > > > > notice: Finished catalog run in 0.38 seconds
> > >
> > > > > > When I tried running the shell script manually using the following
> > > > command
> > >
> > > > > > '/tmp/QoS/QoS.sh (http://QoS.sh); echo $?'
> > >
> > > > > > , it worked fine printing 0 at the end. Any help what is wrong with
> > > > exec
> > > > > > resource recipe?
> > >
> > > > > > Thanks in advance for your time.
> > >
> > > > > > Regards,
> > >
> > > > > > A.
> > >
> > > > > > On Thu, Jun 16, 2011 at 8:42 PM, Peter Bukowinski <pmb...@gmail.com (mailto:pmb...@gmail.com)
> > > > > > > > To post to this group, send email to puppet...@googlegroups.com (mailto:puppet...@googlegroups.com)
> > > > (mailto:
> > > > > > > puppet...@googlegroups.com (mailto:puppet...@googlegroups.com)).
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@googlegroups.com) (mailto:
> > > > > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@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...@googlegroups.com (mailto:puppet...@googlegroups.com).
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@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...@googlegroups.com (mailto:puppet...@googlegroups.com).
> > > > To unsubscribe from this group, send email to
> > > > puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@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...@googlegroups.com (mailto:puppet...@googlegroups.com).
> > To unsubscribe from this group, send email to puppet-users...@googlegroups.com (mailto:puppet-users%2Bunsu...@googlegroups.com).
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.