Dennis Jacobfeuerborn
2012-Apr-22 01:15 UTC
[Puppet Users] Only write file if copy on master is present
Hi, I''m trying to find a way to configure the firewall on centos systems using puppet by copying the /etc/sysconfig/iptables file and restarting the iptables service. That part is simple to accomplish. The twist I need to add though is that I only want to do this if a copy of that file for the node exists on the server. If this file doesn''t exists then I want puppet to not replace the file on the client and not restart the service. Is there a way to accomplish this sort of conditional execution? Regards, Dennis -- 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/-/oAUk_tpcqooJ. 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.
Krzysztof Wilczynski
2012-Apr-22 18:49 UTC
[Puppet Users] Re: Only write file if copy on master is present
Hi, On Sunday, 22 April 2012 02:15:19 UTC+1, Dennis Jacobfeuerborn wrote: [...]> The twist I need to add though is that I only want to do this if a copy of > that file for the node exists on the server. If this file doesn''t >exists then I want puppet to not replace the file on the client and not> restart the service. > > Is there a way to accomplish this sort of conditional execution? >Have a look on: https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/exists.rb Maybe it will be of any use to you in this case. KW -- 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/-/7QWPj4QhYvkJ. 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.
Dennis Jacobfeuerborn
2012-Apr-23 12:59 UTC
[Puppet Users] Re: Only write file if copy on master is present
Thanks, this looks like it will do the trick. The lack of puppet:// support probably means I will have to hard-code a path to a directory somewhere but that shouldn''t be to big of a deal. On Sunday, April 22, 2012 8:49:50 PM UTC+2, matti wrote:> > Hi, > > On Sunday, 22 April 2012 02:15:19 UTC+1, Dennis Jacobfeuerborn wrote: > > [...] > >> The twist I need to add though is that I only want to do this if a copy >> of that file for the node exists on the server. If this file doesn''t >> > exists then I want puppet to not replace the file on the client and not >> restart the service. >> >> Is there a way to accomplish this sort of conditional execution? >> > > Have a look on: > https://github.com/kwilczynski/puppet-functions/blob/master/lib/puppet/parser/functions/exists.rb > > Maybe it will be of any use to you in this case. > > KW >-- 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/-/5HEbo-N91H8J. 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.
Krzysztof Wilczynski
2012-Apr-23 13:57 UTC
[Puppet Users] Re: Only write file if copy on master is present
Hi, On Monday, 23 April 2012 13:59:00 UTC+1, Dennis Jacobfeuerborn wrote:> Thanks, this looks like it will do the trick. The lack of puppet:// > support probably means I will have to hard-code a path to a directory > somewhere but that shouldn''t be to big of a deal. >[...] Apologies for that :-( Adding support for "puppet://" is quite tricky (there is a lot going on under-the-hood with this one), and I never have the time to do it (unless somebody is willing to help out and/or sponsor). For the time being, please bare with fully-qualified paths ... KW -- 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/-/EkfQJ_W21WUJ. 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.
Dennis Jacobfeuerborn
2012-Apr-23 15:14 UTC
[Puppet Users] Re: Only write file if copy on master is present
I didn''t mean to imply that this was your fault and I already knew that the puppet support probably was missing because it''s quite tricky to implement. Since I''ve started looking into writing my own functions and modules and get a bit deeper into puppet I might actually look into this myself if I find the time. If I make any progress there you can expect a pull request for the changes :) On Monday, April 23, 2012 3:57:08 PM UTC+2, matti wrote:> > Hi, > > On Monday, 23 April 2012 13:59:00 UTC+1, Dennis Jacobfeuerborn wrote: > >> Thanks, this looks like it will do the trick. The lack of puppet:// >> support probably means I will have to hard-code a path to a directory >> somewhere but that shouldn''t be to big of a deal. >> > [...] > > Apologies for that :-( > > Adding support for "puppet://" is quite tricky (there is a lot going on > under-the-hood with this one), and I never have the time to do it (unless > somebody is willing to help out and/or sponsor). > > For the time being, please bare with fully-qualified paths ... > > KW >-- 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/-/NAMjjrnooXwJ. 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.
Krzysztof Wilczynski
2012-Apr-23 16:27 UTC
[Puppet Users] Re: Only write file if copy on master is present
Hi, On Monday, 23 April 2012 16:14:59 UTC+1, Dennis Jacobfeuerborn wrote: [...]> If I make any progress there you can expect a pull request for the changes > :) >[...] Thank you! That''s very kind :) Let me know if I can help and/or we can join efforts. KW -- 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/-/FSqkMxG3cyEJ. 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.