Quantcast
Channel: User Nathan Basanese - Stack Overflow
Viewing all articles
Browse latest Browse all 61

May I use variables and concatenate in Puppet resource names?

$
0
0

I'm wondering if one can put variables in resource names, for example:

$c6release = $::operatingsystemmajrelease
  ##  [EPEL(5, 6, or 7)-x86_64]
yumrepo { 'EPEL' + $c6release + '-x86_64':  ##  This is the part I'm asking about.
    baseurl  => "http://repo.centos.com/cobbler/repo_mirror/EPEL" + $c6release + "-x86_64/",
    gpgcheck => false,
    enabled  => true,
    priority => '2';
}

I've been able to use arrays to make multiple file resources before, but I can't seem to use it in the way described above.

I've found the following in my research:

http://www.nico.schottelius.org/blog/puppet-name-is-not-as-expected-but-classname/ (This is for Puppet 2.7, though)

https://ask.puppet.com/question/13266/trying-to-use-namevar-list-with-name-or-title-variable/

https://docs.puppet.com/puppet/latest/reference/lang_resources.html

Could one use a defined resource type to take care of this?

https://docs.puppet.com/puppet/latest/reference/lang_defined_types.html

Anyway, the above seem to indicate that I can use variables for Puppet resource names, but I can't seem to get them to work.

May one use variables in resource names?


Viewing all articles
Browse latest Browse all 61

Latest Images

Trending Articles





Latest Images