have a look at hiera ta achieve what you want.
If you have an hierarchy like
"%{::osfamily}"
You can create some yaml files in
etc/puppet/hieradata/RedHat.yaml
---
pack_util::packages:
- curl
- htop
and in
/etc/puppet hieradata/Debian.yaml
---
pack_util::packages:
- curl_deb
- htop_deb
And so on.
Assuming you are using puppet 3
This is one possible way, and check the docs for the correct syntax and
usage, but is shouls get you going
Hope this helps
Jo
On 02/12/2014 02:52 PM, CedrX wrote:
I have the answer.
I read here :
https://groups.google.com/forum/#!topic/puppet-users/I9Y-p3UY8JE that
variables are immutable
Le mercredi 12 février 2014 14:16:33 UTC+1, CedrX a écrit :
Hi
I would like to modify a class variable.
This variable contains a list of packages to install
The goal is to make this list of packages different for each type
of os (case $operatingsystem)
Here uis my code
class pack_utils {
$packages = [
"curl",
"htop",
"lshw",
"lsof"
]
case $operatingsystem {
debian, ubuntu : {
# Here i would like to add packages name
in array packages defined above
notice("value of packages: $packages")
}
}
package { $packages:
ensure => present,
}
}
How i can do to modify the value of $packages ?
Thanks in advance
CedrX
--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/61285dae-5535-4794-8cd4-293081d13196%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Johan De Wit
Open Source Consultant
Red Hat Certified Engineer (805008667232363)
Puppet Certified Professional 2013 (PCP0000006)
_________________________________________________________
Open-Future Phone +32 (0)2/255 70 70
Zavelstraat 72 Fax +32 (0)2/255 70 71
3071 KORTENBERG Mobile +32 (0)474/42 40 73
BELGIUM http://www.open-future.be
_________________________________________________________
Next Events:
Zabbix Certified Training |
http://www.open-future.be/zabbix-certified-training-10-till-12th-march
Zabbix for Large Environments Training |
http://www.open-future.be/zabbix-large-environments-training-13-till-14th-march
Puppet Intruction Course |
http://www.open-future.be/puppet-introduction-course-14th-april
Puppet Advanced Training |
http://www.open-future.be/puppet-advanced-training-15-till-17th-april
Subscribe to our newsletter | http://eepurl.com/BUG8H
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/52FB8040.7070107%40open-future.be.
For more options, visit https://groups.google.com/groups/opt_out.