Hi,
is there a way to make sure a file is installed only if a certain
package is installed on the client?
e.g. I want to distribute the client key for NX via puppet. However I
only want to install these files if package ''freenx'' is
installed on the
client.
I tried adding ''require => package["freenx"]'' but
then puppetd complains
it doesn''t know how to install freenx. However I don''t want
it to
install freenx even if it would figure out how to do that. If freenx is
not installed I just don''t want this class to have any net effect.
--------------------------
class nx_clientkey {
remotefile { "/var/lib/nxserver/home/.ssh/authorized_keys2":
source =>
"os/$operatingsystem/nx/authorized_keys2",
ensure => file,
mode => 600 }
remotefile { "/var/lib/nxserver/home/.ssh/default.id_dsa.pub":
source =>
"os/$operatingsystem/nx/default.id_dsa.pub",
ensure => file,
mode => 600 }
remotefile
{ "/var/lib/nxserver/home/.ssh/default.id_dsa.pub.backup":
source =>
"os/$operatingsystem/nx/default.id_dsa.pub.backup",
ensure => file ,
mode => 600 }
}
---------------------------
Nico
Thijs Oppermann
2007-Jun-29 17:09 UTC
Re: Installing a file only if a package is available
On 29/06/07, Nico De Ranter <nico@sonycom.com> wrote:> > > Hi, > > is there a way to make sure a file is installed only if a certain > package is installed on the client? > > e.g. I want to distribute the client key for NX via puppet. However I > only want to install these files if package ''freenx'' is installed on the > client. > > I tried adding ''require => package["freenx"]'' but then puppetd complains > it doesn''t know how to install freenx. However I don''t want it to > install freenx even if it would figure out how to do that. If freenx is > not installed I just don''t want this class to have any net effect.If you normally manage the freenx package with puppet (i.e. you can be sure that if the machine has freenx it came there through something like: package { "freenx": ensure => latest, } then you can do a check to see if this node has that package defined: case defined(Package["freenx"]) { true: { # yes, is a freenx machine, so install other stuff } } Or something like that. If not, then you could get there by creating a custom facter fact with reports whether freenx is on the machine. And maybe some other possibilities that I''ve missed. Hope that helps, Thijs --------------------------> class nx_clientkey { > remotefile { "/var/lib/nxserver/home/.ssh/authorized_keys2": > source => "os/$operatingsystem/nx/authorized_keys2", > ensure => file, > mode => 600 } > remotefile { "/var/lib/nxserver/home/.ssh/default.id_dsa.pub": > source => "os/$operatingsystem/nx/default.id_dsa.pub", > ensure => file, > mode => 600 } > remotefile > { "/var/lib/nxserver/home/.ssh/default.id_dsa.pub.backup": > source => > "os/$operatingsystem/nx/default.id_dsa.pub.backup", > ensure => file , > mode => 600 } > } > --------------------------- > > Nico > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users >_______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
HARRIS Jimmy \(AXA-Tech-AU\)
2007-Jul-03 06:13 UTC
Re: Installing a file only if a package is available
Does the case statement below actually work? I''d like to conditionally
include some extra munin plugins if Samba is installed, but I get a
"Syntax error at ''Package''..." error when I try to
use the "case
defined" statement.
(apologies for top posting but Outlook drops the quoting if I don''t do
so)
If you normally manage the freenx package with puppet (i.e. you
can be sure that if the machine has freenx it came there through
something like:
package { "freenx":
ensure => latest,
}
then you can do a check to see if this node has that package
defined:
case defined(Package["freenx"]) {
true: {
# yes, is a freenx machine, so install other stuff
}
}
*********************************************************************************
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege. If you are not
the intended recipient you must not use, distribute or copy this
email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA-Tech Australia. Thank you.
**********************************************************************************
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users
Thijs Oppermann
2007-Jul-03 09:57 UTC
Re: Installing a file only if a package is available
On 03/07/07, HARRIS Jimmy (AXA-Tech-AU) <Jimmy.Harris@axa-tech.com> wrote:> > Does the case statement below actually work? I''d like to conditionally > include some extra munin plugins if Samba is installed, but I get a "Syntax > error at ''Package''..." error when I try to use the "case defined" statement. > > (apologies for top posting but Outlook drops the quoting if I don''t do so) >It should. I''m using it all over the place now. You need 0.23 on the server though, I think. So maybe that''s your problem? gr, Thijs If you normally manage the freenx package with puppet (i.e. you can be sure> that if the machine has freenx it came there through something like: > > package { "freenx": > ensure => latest, > } > > then you can do a check to see if this node has that package defined: > > case defined(Package["freenx"]) { > true: { > # yes, is a freenx machine, so install other stuff > } > } > > > > > > > > > ********************************************************************************* > Important Note > This email (including any attachments) contains information which is > confidential and may be subject to legal privilege. If you are not > the intended recipient you must not use, distribute or copy this > email. If you have received this email in error please notify the > sender immediately and delete this email. Any views expressed in this > email are not necessarily the views of AXA-Tech Australia. Thank you. > > ********************************************************************************** > > _______________________________________________ > Puppet-users mailing list > Puppet-users@madstop.com > https://mail.madstop.com/mailman/listinfo/puppet-users > >_______________________________________________ Puppet-users mailing list Puppet-users@madstop.com https://mail.madstop.com/mailman/listinfo/puppet-users
On Jul 3, 2007, at 4:57 AM, Thijs Oppermann wrote:> It should. I''m using it all over the place now. You need 0.23 on > the server though, I think. So maybe that''s your problem?Yeah, this was only fixed in 0.23.0. -- The world tolerates conceit from those who are successful, but not from anybody else. -- John Blake --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
HARRIS Jimmy \(AXA-Tech-AU\)
2007-Jul-04 00:21 UTC
Re: Installing a file only if a package is available
You''re correct, I was using 0.22.4. Upgrading using dlutter''s
yum
repository fixed the problem.
Thanks for the help and pointing out a very useful Puppet option.
james
________________________________
From: puppet-users-bounces@madstop.com
[mailto:puppet-users-bounces@madstop.com] On Behalf Of Thijs Oppermann
Sent: Tuesday, 3 July 2007 7:57 PM
To: Puppet User Discussion
Subject: Re: [Puppet-users] Installing a file only if a package
is available
On 03/07/07, HARRIS Jimmy (AXA-Tech-AU)
<Jimmy.Harris@axa-tech.com> wrote:
Does the case statement below actually work? I''d like
to conditionally include some extra munin plugins if Samba is installed,
but I get a "Syntax error at ''Package''..." error
when I try to use the
"case defined" statement.
(apologies for top posting but Outlook drops the quoting
if I don''t do so)
It should. I''m using it all over the place now. You need 0.23 on
the server though, I think. So maybe that''s your problem?
gr,
Thijs
If you normally manage the freenx package with
puppet (i.e. you can be sure that if the machine has freenx it came
there through something like:
package { "freenx":
ensure => latest,
}
then you can do a check to see if this node has
that package defined:
case defined(Package["freenx"]) {
true: {
# yes, is a freenx machine, so install other
stuff
}
}
************************************************************************
*********
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege. If you are not
the intended recipient you must not use, distribute or copy this
email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA-Tech Australia. Thank you.
************************************************************************
**********
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users
_____________________________________________________________________
This e-mail has been scanned for viruses by MCI''s Internet
Managed
Scanning Services - powered by MessageLabs. For further
information
visit http://www.mci.com
*********************************************************************************
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege. If you are not
the intended recipient you must not use, distribute or copy this
email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA-Tech Australia. Thank you.
**********************************************************************************
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users