loki77
2012-Jul-14 21:19 UTC
[Puppet Users] execute a command if a package isn''t installed, then install the package
Hi, I''m trying to install the ''unbound'' dns resolver in ubuntu via puppet and I''m running into some issues. The issue isn''t that the package doesn''t install, but rather that apt automatically starts the daemon - and when the daemon starts, it updates resolv.conf in a way that breaks DNS. There''s a command, ''resolvconf --disable-updates'' that will stop unbound from making the change it wants to. What I''d like to do is: - If unbound isn''t installed, then execute --disable-updates - Then install unbound - Then --enable-updates Is there anyway to do this? Thanks. -- 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.
Peter Bukowinski
2012-Jul-14 22:30 UTC
Re: [Puppet Users] execute a command if a package isn''t installed, then install the package
On Jul 14, 2012, at 5:19 PM, loki77 <loki77@gmail.com> wrote:> Hi, I''m trying to install the ''unbound'' dns resolver in ubuntu via > puppet and I''m running into some issues. The issue isn''t that the > package doesn''t install, but rather that apt automatically starts the > daemon - and when the daemon starts, it updates resolv.conf in a way > that breaks DNS. > > There''s a command, ''resolvconf --disable-updates'' that will stop > unbound from making the change it wants to. What I''d like to do is: > > - If unbound isn''t installed, then execute --disable-updates > - Then install unbound > - Then --enable-updates > > Is there anyway to do this? Thanks.You can either write a custom fact that gets set when unbound is installed/active and use that in an if block around the stop-install-start procedure, or use the ''resolvconf --disable-updates'' exec resource''s ''unless'' parameter to test for a running unbound daemon prior to installing the package. -- Peter Bukowinski -- 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.
loki77
2012-Jul-16 03:13 UTC
[Puppet Users] Re: execute a command if a package isn''t installed, then install the package
The only downside to that is that resolvconf could be left disabled for longer than just the installation of the package. While I don''t think this will be a problem in most cases I''m hoping there''s another way to handle this. Thanks! On Jul 14, 3:30 pm, Peter Bukowinski <pmb...@gmail.com> wrote:> On Jul 14, 2012, at 5:19 PM, loki77 <lok...@gmail.com> wrote: > > > Hi, I''m trying to install the ''unbound'' dns resolver in ubuntu via > > puppet and I''m running into some issues. The issue isn''t that the > > package doesn''t install, but rather that apt automatically starts the > > daemon - and when the daemon starts, it updates resolv.conf in a way > > that breaks DNS. > > > There''s a command, ''resolvconf --disable-updates'' that will stop > > unbound from making the change it wants to. What I''d like to do is: > > > - If unbound isn''t installed, then execute --disable-updates > > - Then install unbound > > - Then --enable-updates > > > Is there anyway to do this? Thanks. > > You can either write a custom fact that gets set when unbound is installed/active and use that in an if block around the stop-install-start procedure, or use the ''resolvconf --disable-updates'' exec resource''s ''unless'' parameter to test for a running unbound daemon prior to installing the package. > > -- > Peter Bukowinski-- 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.
Martin Alfke
2012-Jul-16 08:12 UTC
Re: [Puppet Users] execute a command if a package isn''t installed, then install the package
Hi On 15.07.2012, at 00:30, Peter Bukowinski wrote:> On Jul 14, 2012, at 5:19 PM, loki77 <loki77@gmail.com> wrote: > >> Hi, I''m trying to install the ''unbound'' dns resolver in ubuntu via >> puppet and I''m running into some issues. The issue isn''t that the >> package doesn''t install, but rather that apt automatically starts the >> daemon - and when the daemon starts, it updates resolv.conf in a way >> that breaks DNS. >> >> There''s a command, ''resolvconf --disable-updates'' that will stop >> unbound from making the change it wants to. What I''d like to do is: >> >> - If unbound isn''t installed, then execute --disable-updates >> - Then install unbound >> - Then --enable-updates >> >> Is there anyway to do this? Thanks. > > You can either write a custom fact that gets set when unbound is installed/active and use that in an if block around the stop-install-start procedure, or use the ''resolvconf --disable-updates'' exec resource''s ''unless'' parameter to test for a running unbound daemon prior to installing the package.You can use require and notify within the package resource to run exec statements. e.g. (untested) exec { ''disable'': command => ''/path/to/resolvconf --disable-updates'', onlyif => ''dpkg -l | grep -c unbound | wc -l'', } exec { ''enable'': command => ''/path/tp/resolvconf --enable-updates'', unless => ''dpkg -l | grep -c unbound | wc -l'', } package { ''unbound'': requires => Exec[''disable''], notify => Exec[''enable''], } - Martin -- 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.